# completion as advised by arch wiki complete -cf sudo man which # reduce history size export HISTCONTROL=ignoreboth # completions if [ -f /usr/share/bash-completion/completions/pass ]; then . /usr/share/bash-completion/completions/pass fi # export PS1='bash-\v-\u@\h \W\$ ' #export PS1='\[\033[38;5;208m\]\u@\h:\w\$\[\033[0m\] ' # vi mode #set -o vi # prevent clobbering of files # echo "output" >| file.txt to do it manually set -o noclobber # Setting PATH export PATH=~/.cargo/bin:$PATH export PATH=~/bin/:$PATH # openai keys source $HOME/dotfiles/openai_key # aliases alias pacget="pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S" alias pacdel="pacman -Qq | fzf --multi --preview 'pacman -Qi {1}' | xargs -ro sudo pacman -Rns" alias gloga='git log --oneline --decorate --graph --all' alias batnote='batnote-source-code' alias am='append_to_masterlist' alias vi='vim' alias ls='ls --color=auto' alias h='hey_openai' alias hd='openai_data' alias xclip='xclip -selection c' alias notes="cd ~/Documents/Notes/" alias blog="cd ~/code/html/yulqen.org/" alias bud="cd ~/Budget/hledger/" alias getip="curl ifconfig.me" alias tprojects="task rc.list.all.projects=1 projects" alias ttags="task rc.list.all.tags=1 tags" alias tkilled="task +killlist list" alias ttagged="task tags.any: list" alias tuntagged="task tags.none: list" alias ttoday="task ml_due_or_scheduled_today" alias tl="/home/lemon/Documents/Notes/todo/todo.sh list" alias t="/home/lemon/Documents/Notes/todo/todo.sh" alias khal="$HOME/src/virtualenvs/khal-venv/bin/khal" alias vdirsyncer="$HOME/src/virtualenvs/khal-venv/bin/vdirsyncer" alias khard="$HOME/src/virtualenvs/khal-venv/bin/khard" # Environment variables export LEDGER_FILE="$HOME/Budget/hledger/budget.ledger" #export TERM="screen-256color" arch wiki says not to set this here. export LESS="-iMRS -x2" export NOTES_DIR="~/Documents/Notes" export RANGER_LOAD_DEFAULT_RC="FALSE" # export FZF_DEFAULT_COMMAND="rg --files --hidden --glob '!.git' " export FZF_DEFAULT_COMMAND='ag -l --path-to-ignore ~/.ignore --nocolor --hidden -g ""' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_DEFAULT_OPTS="--color info:108,prompt:109,spinner:108,pointer:168,marker:168" # fzf source /usr/share/fzf/key-bindings.bash source /usr/share/fzf/completion.bash # gpg export=GPG_TTY="$(tty)" export=SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" gpgconf --launch gpg-agent #completion for todo.sh source ~/Documents/Notes/todo/todo_completion complete -o default -o nospace -F _todo t source $HOME/secrets # Functions ############################################################## # Quick way to create a new blog post with Hugo from wherever # on the filesystem. # Used ChatGPT to get the substitution and escaping correct. # Called with a single string argument. # ############################################################ function newpost() { if [[ $# -ne 1 ]]; then echo "Give me the title!"; return; fi title="$1" # convert title to lowercase and replace spaces with hyphens for the slug slug=$(echo "$title" | tr '[:upper:]' '[:lower:]' | tr ' ' '-') # create the new post file with Hugo cd $HOME/code/html/yulqen.org post_path="content/blog/$slug.md" hugo new "$post_path" # update the front matter with the original title string echo "Looking for $post_path..." awk -v title="$title" '{gsub(/title: .*/, "title: \""title"\"")}1' "$post_path" > tmp && mv tmp "$post_path" vim $post_path } ################################################################### # To output in cat, just call todj. # To enable editing the files in vim, call todj vim. # You can use less or any other tool to display the text if you wish # Arguments: # None # Output: # Writes to stdout or opens program passed as first argument ################################################################### todj () { CMD=${1:-"cat"} $CMD $(find /home/lemon/Documents/Notes/journal -name "*$(date '+%Y-%m-%d')*") } ######################################################################### # This function takes two arguments as strings. The idea is to enable # passing file data into the function, such as a csv file or some code. # Call like this openai_data "Please optimise the following function in # python" "$(> "$ml" cat "$ml" } # Colors for ls - yellow directories # export LS_COLORS="$LS_COLORS:di=1;33" # Install Ruby Gems to ~/gems export GEM_HOME="$HOME/gems" export PATH="$HOME/gems/bin:$PATH" export PATH="$HOME/go/bin:$PATH" export PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"