Ensure fish config is compatible with Tramp
Ensure that my config.fish does not interfere with Tramp.
This commit is contained in:
parent
dec005ea34
commit
4a1523caba
1 changed files with 195 additions and 185 deletions
|
@ -45,199 +45,209 @@
|
||||||
# embraced Emacs workflow or compiled from some high-level language like
|
# embraced Emacs workflow or compiled from some high-level language like
|
||||||
# Elisp.
|
# Elisp.
|
||||||
|
|
||||||
# Remove the default greeting from fish
|
# Adding this to support tramp.
|
||||||
set fish_greeting ""
|
if test "$TERM" = "dumb"
|
||||||
|
function fish_prompt
|
||||||
|
echo "\$ "
|
||||||
|
end
|
||||||
|
function fish_right_prompt; end
|
||||||
|
function fish_greeting; end
|
||||||
|
function fish_title; end
|
||||||
|
else
|
||||||
|
# Remove the default greeting from fish
|
||||||
|
set fish_greeting ""
|
||||||
|
|
||||||
# Prompt
|
# Prompt
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
# My custom prompt.
|
# My custom prompt.
|
||||||
#
|
#
|
||||||
# Design objectives:
|
# Design objectives:
|
||||||
# - max-length <= 80 characters
|
# - max-length <= 80 characters
|
||||||
# - minimal
|
# - minimal
|
||||||
# - no dependencies (well, you know what I mean)
|
# - no dependencies (well, you know what I mean)
|
||||||
#
|
#
|
||||||
# Components
|
# Components
|
||||||
# - ssh connection
|
# - ssh connection
|
||||||
# - user
|
# - user
|
||||||
# - host
|
# - host
|
||||||
# - git repo
|
# - git repo
|
||||||
# - git branch
|
# - git branch
|
||||||
# - lambda character as prompt
|
# - lambda character as prompt
|
||||||
|
|
||||||
# Cache status before we overwrite it.
|
# Cache status before we overwrite it.
|
||||||
set -l last_status $status
|
set -l last_status $status
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
set -l color_inactive (set_color red --bold)
|
set -l color_inactive (set_color red --bold)
|
||||||
set -l color_active (set_color green --bold)
|
set -l color_active (set_color green --bold)
|
||||||
set -l color_normal (set_color normal)
|
set -l color_normal (set_color normal)
|
||||||
|
|
||||||
# SSH information
|
# SSH information
|
||||||
if set -q SSH_CLIENT; or set -q SSH_TTY
|
if set -q SSH_CLIENT; or set -q SSH_TTY
|
||||||
echo -en "$color_active \bssh ✓ [$color_normal$USER@"(hostname)"$color_active]$color_normal"
|
echo -en "$color_active \bssh ✓ [$color_normal$USER@"(hostname)"$color_active]$color_normal"
|
||||||
else
|
else
|
||||||
echo -en "$color_inactive \bssh ✗ [$color_normal$USER@"(hostname)"$color_inactive]$color_normal"
|
echo -en "$color_inactive \bssh ✗ [$color_normal$USER@"(hostname)"$color_inactive]$color_normal"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Separator
|
||||||
|
echo -n " "
|
||||||
|
|
||||||
|
# Git information
|
||||||
|
set -l git_repo (git rev-parse --show-toplevel 2>/dev/null)
|
||||||
|
set -l git_status $status
|
||||||
|
set -l dir_parent (basename (realpath ..))
|
||||||
|
set -l dir_current (basename (realpath .))
|
||||||
|
if test $git_status -eq 0
|
||||||
|
set -l git_repo_name (basename (git rev-parse --show-toplevel))
|
||||||
|
set -l git_branch (git branch 2>/dev/null | grep '^\*' | cut -d' ' -f2-)
|
||||||
|
echo -en "$color_active \bgit ✓ [$color_normal$git_branch$color_active|$color_normal$git_repo_name$color_active|$color_normal$dir_parent/$dir_current$color_active]$color_normal"
|
||||||
|
else
|
||||||
|
echo -en "$color_inactive \bgit ✗ [$color_normal$dir_parent/$dir_current$color_inactive]$color_normal"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Newline
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Handle root vs non-root
|
||||||
|
if [ "$USER" = "root" ]
|
||||||
|
set -g prompt_sigil "#"
|
||||||
|
else
|
||||||
|
set -g prompt_sigil "λ"
|
||||||
|
end
|
||||||
|
|
||||||
|
# TODO(wpcarro): For root directories like /tmp, there will not be a parent
|
||||||
|
# directory. Support these directories.
|
||||||
|
set -l time (date +"%T")
|
||||||
|
if test $last_status -eq 0
|
||||||
|
# TODO(wpcarro): I'd prefer to use black here instead of white, but for
|
||||||
|
# some reason white is black and black is invisible.
|
||||||
|
set -l color_prompt (set_color white --bold)
|
||||||
|
echo -n "$time$color_prompt $prompt_sigil$color_normal "
|
||||||
|
else
|
||||||
|
set -l color_prompt (set_color red --bold)
|
||||||
|
echo -n "$time$color_prompt $prompt_sigil$color_normal "
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Separator
|
source ./functions.fish
|
||||||
echo -n " "
|
|
||||||
|
|
||||||
# Git information
|
# Setup fzf for fuzzily finding commands, files, directories
|
||||||
set -l git_repo (git rev-parse --show-toplevel 2>/dev/null)
|
source (fzf-share)/key-bindings.fish && fzf_key_bindings
|
||||||
set -l git_status $status
|
|
||||||
set -l dir_parent (basename (realpath ..))
|
|
||||||
set -l dir_current (basename (realpath .))
|
|
||||||
if test $git_status -eq 0
|
|
||||||
set -l git_repo_name (basename (git rev-parse --show-toplevel))
|
|
||||||
set -l git_branch (git branch 2>/dev/null | grep '^\*' | cut -d' ' -f2-)
|
|
||||||
echo -en "$color_active \bgit ✓ [$color_normal$git_branch$color_active|$color_normal$git_repo_name$color_active|$color_normal$dir_parent/$dir_current$color_active]$color_normal"
|
|
||||||
else
|
|
||||||
echo -en "$color_inactive \bgit ✗ [$color_normal$dir_parent/$dir_current$color_inactive]$color_normal"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Newline
|
# TODO: What is the difference between `source` and `eval`
|
||||||
echo
|
# direnv
|
||||||
|
eval (direnv hook fish)
|
||||||
|
|
||||||
# Handle root vs non-root
|
# Miscellaneous
|
||||||
if [ "$USER" = "root" ]
|
alias c='xclip -selection clipboard -i'
|
||||||
set -g prompt_sigil "#"
|
alias p='xclip -selection clipboard -o'
|
||||||
else
|
alias lorem='echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."'
|
||||||
set -g prompt_sigil "λ"
|
alias cat='bat --theme=TwoDark'
|
||||||
end
|
alias vim=nvim
|
||||||
|
alias rg='rg --ignore-case'
|
||||||
|
alias rgh='rg --hidden' # By default, rg skips hidden files
|
||||||
|
alias fdh='fd --hidden' # By default, fd skips hidden files
|
||||||
|
alias tpr='tput reset'
|
||||||
|
alias define=sdcv # uses stardict to lookup a word
|
||||||
|
alias perms='ls -ld' # list the permissions of a directory
|
||||||
|
alias rmrf='rm -rf' # sometimes the space and dash are too much...
|
||||||
|
alias open=xdg-open
|
||||||
|
alias stopx='sudo service lightdm stop' # stop X server session
|
||||||
|
alias please='eval sudo $history[1]'
|
||||||
|
alias chrome=google-chrome
|
||||||
|
alias sys='systemctl'
|
||||||
|
alias sysu='systemctl --user'
|
||||||
|
|
||||||
# TODO(wpcarro): For root directories like /tmp, there will not be a parent
|
# Filesystem
|
||||||
# directory. Support these directories.
|
# TODO: Depend on `mkdir_cd`.
|
||||||
set -l time (date +"%T")
|
alias mdd=mkdir_cd
|
||||||
if test $last_status -eq 0
|
alias ls='exa --sort=type'
|
||||||
# TODO(wpcarro): I'd prefer to use black here instead of white, but for
|
alias ll='exa --long --sort=type'
|
||||||
# some reason white is black and black is invisible.
|
alias la='exa --long --all --sort=type'
|
||||||
set -l color_prompt (set_color white --bold)
|
# TODO: Depend on these functions once they're defined.
|
||||||
echo -n "$time$color_prompt $prompt_sigil$color_normal "
|
alias files=laf
|
||||||
else
|
alias dirs=lad
|
||||||
set -l color_prompt (set_color red --bold)
|
alias links=lal
|
||||||
echo -n "$time$color_prompt $prompt_sigil$color_normal "
|
|
||||||
end
|
# Device and power management
|
||||||
|
alias off='shutdown now'
|
||||||
|
alias suspend='systemctl suspend'
|
||||||
|
alias hibernate='systemctl hibernate'
|
||||||
|
|
||||||
|
# TODO: Debug `Error: No interface specified.`.
|
||||||
|
alias wfls='nmcli device wifi'
|
||||||
|
alias wfc='nmcli device connect'
|
||||||
|
|
||||||
|
# Tmux
|
||||||
|
alias tls='tmux list-sessions'
|
||||||
|
alias ta ='tmux attach'
|
||||||
|
alias td ='tmux detach'
|
||||||
|
|
||||||
|
# Dropbox
|
||||||
|
alias drst='dropbox.py status'
|
||||||
|
|
||||||
|
# GPG
|
||||||
|
alias gpged='gpg --edit-key wpcarro@gmail.com'
|
||||||
|
alias gpge='gpg --encrypt'
|
||||||
|
alias gpgd='gpg --decrypt'
|
||||||
|
alias gpgls='gpg --list-keys'
|
||||||
|
|
||||||
|
# Git
|
||||||
|
# alias glp='git log --graph --pretty="format:"%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'
|
||||||
|
alias g=hub
|
||||||
|
alias git=hub
|
||||||
|
alias ga='git add'
|
||||||
|
alias gc='git commit'
|
||||||
|
alias gco='git checkout'
|
||||||
|
alias gd='git diff'
|
||||||
|
alias gp='git push'
|
||||||
|
alias grbi='git rebase --interactive'
|
||||||
|
alias grba='git rebase --abort'
|
||||||
|
alias grbc='git rebase --continue'
|
||||||
|
alias gprom='git pull --rebase origin master'
|
||||||
|
alias gca='git commit --amend'
|
||||||
|
alias gcan='git commit --amend --no-edit'
|
||||||
|
alias gpf='git push --force'
|
||||||
|
alias gpff='git push --force --no-verify'
|
||||||
|
alias gds='git diff --staged'
|
||||||
|
alias gfx='git commit --fixup'
|
||||||
|
alias gsh='git show'
|
||||||
|
alias gwip='git add . && git commit -m wip'
|
||||||
|
alias gpr='git pull-request'
|
||||||
|
alias gst='git status && hub pr list'
|
||||||
|
|
||||||
|
# Mercurial
|
||||||
|
# The attempt here is to map my well-known, existing `git` aliases to their
|
||||||
|
# Mercurial counterparts. Some may map 1:1, others may be like putting a square
|
||||||
|
# peg into a round hole. I will try and use my best judgement in these cases
|
||||||
|
# while erring on the side of unifying the two APIs.
|
||||||
|
alias hgst='hg status'
|
||||||
|
alias hglp'=hg xl'
|
||||||
|
alias hgp='hg uploadchain'
|
||||||
|
alias hga='hg add'
|
||||||
|
alias hgc='hg commit'
|
||||||
|
alias hgcan='hg amend'
|
||||||
|
alias hgpr='hg mail -r . -m'
|
||||||
|
alias hgd='hg diff'
|
||||||
|
alias hgsh='hg export'
|
||||||
|
alias hgco='hg update'
|
||||||
|
alias hgls='hg citc --list'
|
||||||
|
alias hgrc='hg rebase --continue'
|
||||||
|
alias hgra='hg rebase --abort'
|
||||||
|
alias hgrm='hg citc -d'
|
||||||
|
alias hgconflicts='hg resolve --list "set:unresolved()"'
|
||||||
|
|
||||||
|
# Aptitude (apt)
|
||||||
|
alias apti='sudo apt-get install --assume-yes'
|
||||||
|
alias aptrm='sudo apt remove'
|
||||||
|
|
||||||
|
# Google stuff
|
||||||
|
alias bzb='blaze build'
|
||||||
|
alias bzt='blaze test --test_output=all'
|
||||||
|
alias br=borgcfg
|
||||||
|
alias pils='p4 listclients'
|
||||||
|
alias pirm='p4 citc -d'
|
||||||
|
alias ppls='g4 listclients | sed \'s/^Client wpcarro://\' | sed \'s/:[0-9]*:citc.*$//g\''
|
||||||
|
alias pprm='p4 citc -d -f' # WARNING: This will forcefully delete a CitC client even if contains pending changes.
|
||||||
|
alias aclcheck=/google/data/ro/projects/ganpati/aclcheck
|
||||||
end
|
end
|
||||||
|
|
||||||
source ./functions.fish
|
|
||||||
|
|
||||||
# Setup fzf for fuzzily finding commands, files, directories
|
|
||||||
source (fzf-share)/key-bindings.fish && fzf_key_bindings
|
|
||||||
|
|
||||||
# TODO: What is the difference between `source` and `eval`
|
|
||||||
# direnv
|
|
||||||
eval (direnv hook fish)
|
|
||||||
|
|
||||||
# Miscellaneous
|
|
||||||
alias c='xclip -selection clipboard -i'
|
|
||||||
alias p='xclip -selection clipboard -o'
|
|
||||||
alias lorem='echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."'
|
|
||||||
alias cat='bat --theme=TwoDark'
|
|
||||||
alias vim=nvim
|
|
||||||
alias rg='rg --ignore-case'
|
|
||||||
alias rgh='rg --hidden' # By default, rg skips hidden files
|
|
||||||
alias fdh='fd --hidden' # By default, fd skips hidden files
|
|
||||||
alias tpr='tput reset'
|
|
||||||
alias define=sdcv # uses stardict to lookup a word
|
|
||||||
alias perms='ls -ld' # list the permissions of a directory
|
|
||||||
alias rmrf='rm -rf' # sometimes the space and dash are too much...
|
|
||||||
alias open=xdg-open
|
|
||||||
alias stopx='sudo service lightdm stop' # stop X server session
|
|
||||||
alias please='eval sudo $history[1]'
|
|
||||||
alias chrome=google-chrome
|
|
||||||
alias sys='systemctl'
|
|
||||||
alias sysu='systemctl --user'
|
|
||||||
|
|
||||||
# Filesystem
|
|
||||||
# TODO: Depend on `mkdir_cd`.
|
|
||||||
alias mdd=mkdir_cd
|
|
||||||
alias ls='exa --sort=type'
|
|
||||||
alias ll='exa --long --sort=type'
|
|
||||||
alias la='exa --long --all --sort=type'
|
|
||||||
# TODO: Depend on these functions once they're defined.
|
|
||||||
alias files=laf
|
|
||||||
alias dirs=lad
|
|
||||||
alias links=lal
|
|
||||||
|
|
||||||
# Device and power management
|
|
||||||
alias off='shutdown now'
|
|
||||||
alias suspend='systemctl suspend'
|
|
||||||
alias hibernate='systemctl hibernate'
|
|
||||||
|
|
||||||
# TODO: Debug `Error: No interface specified.`.
|
|
||||||
alias wfls='nmcli device wifi'
|
|
||||||
alias wfc='nmcli device connect'
|
|
||||||
|
|
||||||
# Tmux
|
|
||||||
alias tls='tmux list-sessions'
|
|
||||||
alias ta ='tmux attach'
|
|
||||||
alias td ='tmux detach'
|
|
||||||
|
|
||||||
# Dropbox
|
|
||||||
alias drst='dropbox.py status'
|
|
||||||
|
|
||||||
# GPG
|
|
||||||
alias gpged='gpg --edit-key wpcarro@gmail.com'
|
|
||||||
alias gpge='gpg --encrypt'
|
|
||||||
alias gpgd='gpg --decrypt'
|
|
||||||
alias gpgls='gpg --list-keys'
|
|
||||||
|
|
||||||
# Git
|
|
||||||
# alias glp='git log --graph --pretty="format:"%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'
|
|
||||||
alias g=hub
|
|
||||||
alias git=hub
|
|
||||||
alias ga='git add'
|
|
||||||
alias gc='git commit'
|
|
||||||
alias gco='git checkout'
|
|
||||||
alias gd='git diff'
|
|
||||||
alias gp='git push'
|
|
||||||
alias grbi='git rebase --interactive'
|
|
||||||
alias grba='git rebase --abort'
|
|
||||||
alias grbc='git rebase --continue'
|
|
||||||
alias gprom='git pull --rebase origin master'
|
|
||||||
alias gca='git commit --amend'
|
|
||||||
alias gcan='git commit --amend --no-edit'
|
|
||||||
alias gpf='git push --force'
|
|
||||||
alias gpff='git push --force --no-verify'
|
|
||||||
alias gds='git diff --staged'
|
|
||||||
alias gfx='git commit --fixup'
|
|
||||||
alias gsh='git show'
|
|
||||||
alias gwip='git add . && git commit -m wip'
|
|
||||||
alias gpr='git pull-request'
|
|
||||||
alias gst='git status && hub pr list'
|
|
||||||
|
|
||||||
# Mercurial
|
|
||||||
# The attempt here is to map my well-known, existing `git` aliases to their
|
|
||||||
# Mercurial counterparts. Some may map 1:1, others may be like putting a square
|
|
||||||
# peg into a round hole. I will try and use my best judgement in these cases
|
|
||||||
# while erring on the side of unifying the two APIs.
|
|
||||||
alias hgst='hg status'
|
|
||||||
alias hglp'=hg xl'
|
|
||||||
alias hgp='hg uploadchain'
|
|
||||||
alias hga='hg add'
|
|
||||||
alias hgc='hg commit'
|
|
||||||
alias hgcan='hg amend'
|
|
||||||
alias hgpr='hg mail -r . -m'
|
|
||||||
alias hgd='hg diff'
|
|
||||||
alias hgsh='hg export'
|
|
||||||
alias hgco='hg update'
|
|
||||||
alias hgls='hg citc --list'
|
|
||||||
alias hgrc='hg rebase --continue'
|
|
||||||
alias hgra='hg rebase --abort'
|
|
||||||
alias hgrm='hg citc -d'
|
|
||||||
alias hgconflicts='hg resolve --list "set:unresolved()"'
|
|
||||||
|
|
||||||
# Aptitude (apt)
|
|
||||||
alias apti='sudo apt-get install --assume-yes'
|
|
||||||
alias aptrm='sudo apt remove'
|
|
||||||
|
|
||||||
# Google stuff
|
|
||||||
alias bzb='blaze build'
|
|
||||||
alias bzt='blaze test --test_output=all'
|
|
||||||
alias br=borgcfg
|
|
||||||
alias pils='p4 listclients'
|
|
||||||
alias pirm='p4 citc -d'
|
|
||||||
alias ppls='g4 listclients | sed \'s/^Client wpcarro://\' | sed \'s/:[0-9]*:citc.*$//g\''
|
|
||||||
alias pprm='p4 citc -d -f' # WARNING: This will forcefully delete a CitC client even if contains pending changes.
|
|
||||||
alias aclcheck=/google/data/ro/projects/ganpati/aclcheck
|
|
||||||
|
|
Loading…
Reference in a new issue