What are your most liked alias for long commands or just to give them better names.

Mine are:

alias load="source .load.sh"
alias eload="$EDITOR .load.sh"
alias gpush="git push"
alias gadd="git add --all"
alias gcommit="git commit -m "
alias gst="git status -s"
alias gpull="git pull"
  • ripreddit
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    functions not aliases but super helpful for moving around and searching files in the terminal

    searches for files with fzf and edits them in neovim

    se(){
    	if [[ $1 ]]; then
    		local dir=${@}
    	else
    		local dir=(./)
    	fi
    	local sel=($(fd . $dir[*] -t f -a -H --no-ignore-vcs | fzf --preview 'bat --color=always {1} '))
    	echo "${sel[@]}"
      (( ${#sel[@]} != 0 )) && nvim "${sel[@]}"
    }
    

    searches for a specific term in all files in directory with preview and jumps to that line in editor

    sf(){
    if [[ $1 ]]; then
    	search="$*"
    else
    	read -p "Enter term to search files for: " -r search
    fi
    
    IFS=: read -ra selected < <(
      rg --hidden --color=always --line-number --no-heading --smart-case "${search}" |
        fzf --ansi \
    		--height 80% \
    		--color dark \
            --color "hl:-1:underline,hl+:-1:underline:reverse" \
            --delimiter : \
            --preview 'bat --color=always {1} --line-range=:800 --highlight-line {2}' \
            --preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
    )
    [ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}"
    }