Initial commit with fish, i3, nvim and polybar configuration

This commit is contained in:
Marc Sastre Rienitz
2020-05-17 20:00:08 +02:00
commit e15ad6aa30
30 changed files with 4032 additions and 0 deletions

38
.config/fish/aliases.fish Normal file
View File

@@ -0,0 +1,38 @@
# vim
alias vim="nvim"
alias vi="nvim"
# dotfiles
alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
# git aliases
alias gs='git status'
alias gd='git diff'
alias gdom='git diff origin/master'
alias gdomns='git diff origin/master --name-status'
alias ga='git add'
alias gall='git add --all'
alias gc='git commit'
alias gcm='git commit -m'
alias gcam='git commit -am'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gm='git merge'
alias gmom='git merge origin/master'
alias gstash='git stash'
alias gsl='git stash list'
alias gsp='git stash pop'
alias gg='git lgb'
alias gpull='git pull'
alias gpush='git push'
# Postgres connections
alias local_psql='psql -d vilynx-db -U vilynx-web'
alias test_psql='psql -h postgres2.test.east.vilynx.com -d vilynx-db -U vilynx-web -p 5432'
alias prod_psql='ssh -f vilynxro@apache71.prod.east.vilynx.com -L 5440:localhost:5433 sleep 600; psql -h localhost -p 5440 -d vilynx-db -U vilynx-web'
# Redshift connection
alias test_redshift='psql -h redshift.test.east.vilynx.com -d dagda_insights -p 5439 -U dagda_user'
alias prod_redshift='psql -h redshift.east.vilynx.com -d dagda_insights -p 5439 -U dagda_user'
alias kraken_psql='psql -h kraken.vpn.vilynx.com -d vilynx-db -U vilynx-web -p 5432'

View File

@@ -0,0 +1 @@
fisher complete

View File

@@ -0,0 +1 @@
# fisher copy-user-key-bindings

64
.config/fish/config.fish Normal file
View File

@@ -0,0 +1,64 @@
set fish_greeting ""
#########################
# ALIASES #
#########################
alias ll='ls -alhF'
alias la='ls -A'
alias l='ls -CF'
. ~/.config/fish/aliases.fish
#########################
# FUNCTIONS #
#########################
# Manage AWS credentials
function aws-credentials
if test -d ~/.aws
rm ~/.aws;
end
ln -s .aws.$argv .aws
end
# Activate venv
function venv
if type -q deactivate
deactivate;
end
. ~/venv/$argv/bin/activate.fish
end
# Go to vilynx repo folder and activate venv
function repo
if test -d ~/vilynx/repos/$argv
cd ~/vilynx/repos/$argv;
venv $argv
else
echo "Could'nt find repo $argv"
end
end
# Clear postgresql cache
function clear_psql_cache
sudo service postgresql stop
echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo service postgresql start
end
# Install "minimal" python packages
function setup-python
pip install autopep8 flake8 isort ipython pdbpp pip-tools pynvim
end
#########################
# THEME #
#########################
set -g theme_color_scheme zenburn
#########################
# MISC #
#########################
set -x VIRTUAL_ENV_DISABLE_PROMPT 1
set -x PGHOST localhost
set -x PYENV_ROOT "$HOME/.pyenv"
set -x PATH "$PYENV_ROOT/bin" $PATH

View File

@@ -0,0 +1,39 @@
# This file is automatically generated by the fish.
# Do NOT edit it directly, your changes will be overwritten.
SET FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
SET FZF_LEGACY_KEYBINDINGS:1
SET FZF_PREVIEW_DIR_CMD:ls
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
SET FZF_TMUX_HEIGHT:40\x25
SET __fish_classic_git_prompt_initialized:\x1d
SET __fish_init_2_39_8:\x1d
SET __fish_init_2_3_0:\x1d
SET fish_color_autosuggestion:555\x1ebrblack
SET fish_color_cancel:\x2dr
SET fish_color_command:\x2d\x2dbold
SET fish_color_comment:red
SET fish_color_cwd:green
SET fish_color_cwd_root:red
SET fish_color_end:brmagenta
SET fish_color_error:brred
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
SET fish_color_history_current:\x2d\x2dbold
SET fish_color_host:normal
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
SET fish_color_normal:normal
SET fish_color_operator:bryellow
SET fish_color_param:cyan
SET fish_color_quote:yellow
SET fish_color_redirection:brblue
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SET fish_color_status:red
SET fish_color_user:brgreen
SET fish_color_valid_path:\x2d\x2dunderline
SET fish_greeting:
SET fish_key_bindings:fish_vi_key_bindings
SET fish_pager_color_completion:\x1d
SET fish_pager_color_description:B3A06D\x1eyellow
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SET fish_user_paths:/home/marc/\x2efzf/bin

2
.config/fish/fishfile Normal file
View File

@@ -0,0 +1,2 @@
jorgebucaran/fish-bax
oh-my-fish/theme-bobthefish

View File

@@ -0,0 +1,636 @@
function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthefish'
switch "$color_scheme"
case 'user'
__bobthefish_user_color_scheme_deprecated
return
case 'terminal' 'terminal-dark*'
set -l colorfg black
[ "$color_scheme" = 'terminal-dark-white' ]; and set colorfg white
set -x color_initial_segment_exit white red --bold
set -x color_initial_segment_su white green --bold
set -x color_initial_segment_jobs white blue --bold
set -x color_path black white
set -x color_path_basename black white --bold
set -x color_path_nowrite magenta $colorfg
set -x color_path_nowrite_basename magenta $colorfg --bold
set -x color_repo green $colorfg
set -x color_repo_work_tree black $colorfg --bold
set -x color_repo_dirty brred $colorfg
set -x color_repo_staged yellow $colorfg
set -x color_vi_mode_default brblue $colorfg --bold
set -x color_vi_mode_insert brgreen $colorfg --bold
set -x color_vi_mode_visual bryellow $colorfg --bold
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_username white black --bold
set -x color_hostname white black
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
case 'terminal-light*'
set -l colorfg white
[ "$color_scheme" = 'terminal-light-black' ]; and set colorfg black
set -x color_initial_segment_exit black red --bold
set -x color_initial_segment_su black green --bold
set -x color_initial_segment_jobs black blue --bold
set -x color_path white black
set -x color_path_basename white black --bold
set -x color_path_nowrite magenta $colorfg
set -x color_path_nowrite_basename magenta $colorfg --bold
set -x color_repo green $colorfg
set -x color_repo_work_tree white $colorfg --bold
set -x color_repo_dirty brred $colorfg
set -x color_repo_staged yellow $colorfg
set -x color_vi_mode_default brblue $colorfg --bold
set -x color_vi_mode_insert brgreen $colorfg --bold
set -x color_vi_mode_visual bryellow $colorfg --bold
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_username black white --bold
set -x color_hostname black white
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
case 'terminal2' 'terminal2-dark*'
set -l colorfg black
[ "$color_scheme" = 'terminal2-dark-white' ]; and set colorfg white
set -x color_initial_segment_exit grey red --bold
set -x color_initial_segment_su grey green --bold
set -x color_initial_segment_jobs grey blue --bold
set -x color_path brgrey white
set -x color_path_basename brgrey white --bold
set -x color_path_nowrite magenta $colorfg
set -x color_path_nowrite_basename magenta $colorfg --bold
set -x color_repo green $colorfg
set -x color_repo_work_tree brgrey $colorfg --bold
set -x color_repo_dirty brred $colorfg
set -x color_repo_staged yellow $colorfg
set -x color_vi_mode_default brblue $colorfg --bold
set -x color_vi_mode_insert brgreen $colorfg --bold
set -x color_vi_mode_visual bryellow $colorfg --bold
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_username brgrey white --bold
set -x color_hostname brgrey white
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
case 'terminal2-light*'
set -l colorfg white
[ "$color_scheme" = 'terminal2-light-black' ]; and set colorfg black
set -x color_initial_segment_exit brgrey red --bold
set -x color_initial_segment_su brgrey green --bold
set -x color_initial_segment_jobs brgrey blue --bold
set -x color_path grey black
set -x color_path_basename grey black --bold
set -x color_path_nowrite magenta $colorfg
set -x color_path_nowrite_basename magenta $colorfg --bold
set -x color_repo green $colorfg
set -x color_repo_work_tree grey $colorfg --bold
set -x color_repo_dirty brred $colorfg
set -x color_repo_staged yellow $colorfg
set -x color_vi_mode_default brblue $colorfg --bold
set -x color_vi_mode_insert brgreen $colorfg --bold
set -x color_vi_mode_visual bryellow $colorfg --bold
set -x color_vagrant brcyan $colorfg
set -x color_k8s magenta white --bold
set -x color_username grey black --bold
set -x color_hostname grey black
set -x color_rvm brmagenta $colorfg --bold
set -x color_nvm brgreen $colorfg --bold
set -x color_virtualfish brblue $colorfg --bold
set -x color_virtualgo brblue $colorfg --bold
set -x color_desk brblue $colorfg --bold
case 'zenburn'
set -l grey 333333 # a bit darker than normal zenburn grey
set -l red CC9393
set -l green 7F9F7F
set -l yellow E3CEAB
set -l orange DFAF8F
set -l blue 8CD0D3
set -l white DCDCCC
set -x color_initial_segment_exit $white $red --bold
set -x color_initial_segment_su $white $green --bold
set -x color_initial_segment_jobs $white $blue --bold
set -x color_path $grey $white
set -x color_path_basename $grey $white --bold
set -x color_path_nowrite $grey $red
set -x color_path_nowrite_basename $grey $red --bold
set -x color_repo $green $grey
set -x color_repo_work_tree $grey $grey --bold
set -x color_repo_dirty $red $grey
set -x color_repo_staged $yellow $grey
set -x color_vi_mode_default $grey $yellow --bold
set -x color_vi_mode_insert $green $white --bold
set -x color_vi_mode_visual $yellow $grey --bold
set -x color_vagrant $blue $green --bold
set -x color_k8s $green $white --bold
set -x color_username $grey $blue --bold
set -x color_hostname $grey $blue
set -x color_rvm $red $grey --bold
set -x color_nvm $green $white --bold
set -x color_virtualfish $blue $grey --bold
set -x color_virtualgo $blue $grey --bold
set -x color_desk $blue $grey --bold
case 'base16-light'
set -l base00 181818
set -l base01 282828
set -l base02 383838
set -l base03 585858
set -l base04 b8b8b8
set -l base05 d8d8d8
set -l base06 e8e8e8
set -l base07 f8f8f8
set -l base08 ab4642 # red
set -l base09 dc9656 # orange
set -l base0A f7ca88 # yellow
set -l base0B a1b56c # green
set -l base0C 86c1b9 # cyan
set -l base0D 7cafc2 # blue
set -l base0E ba8baf # violet
set -l base0F a16946 # brown
set -l colorfg $base00
set -x color_initial_segment_exit $base02 $base08 --bold
set -x color_initial_segment_su $base02 $base0B --bold
set -x color_initial_segment_jobs $base02 $base0D --bold
set -x color_path $base06 $base02
set -x color_path_basename $base06 $base01 --bold
set -x color_path_nowrite $base06 $base08
set -x color_path_nowrite_basename $base06 $base08 --bold
set -x color_repo $base0B $colorfg
set -x color_repo_work_tree $base06 $colorfg --bold
set -x color_repo_dirty $base08 $colorfg
set -x color_repo_staged $base09 $colorfg
set -x color_vi_mode_default $base04 $colorfg --bold
set -x color_vi_mode_insert $base0B $colorfg --bold
set -x color_vi_mode_visual $base09 $colorfg --bold
set -x color_vagrant $base0C $colorfg --bold
set -x color_k8s $base06 $colorfg --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_rvm $base08 $colorfg --bold
set -x color_nvm $base0B $colorfg --bold
set -x color_virtualfish $base0D $colorfg --bold
set -x color_virtualgo $base0D $colorfg --bold
set -x color_desk $base0D $colorfg --bold
case 'base16' 'base16-dark'
set -l base00 181818
set -l base01 282828
set -l base02 383838
set -l base03 585858
set -l base04 b8b8b8
set -l base05 d8d8d8
set -l base06 e8e8e8
set -l base07 f8f8f8
set -l base08 ab4642 # red
set -l base09 dc9656 # orange
set -l base0A f7ca88 # yellow
set -l base0B a1b56c # green
set -l base0C 86c1b9 # cyan
set -l base0D 7cafc2 # blue
set -l base0E ba8baf # violet
set -l base0F a16946 # brown
set -l colorfg $base07
set -x color_initial_segment_exit $base05 $base08 --bold
set -x color_initial_segment_su $base05 $base0B --bold
set -x color_initial_segment_jobs $base05 $base0D --bold
set -x color_path $base02 $base05
set -x color_path_basename $base02 $base06 --bold
set -x color_path_nowrite $base02 $base08
set -x color_path_nowrite_basename $base02 $base08 --bold
set -x color_repo $base0B $colorfg
set -x color_repo_work_tree $base02 $colorfg --bold
set -x color_repo_dirty $base08 $colorfg
set -x color_repo_staged $base09 $colorfg
set -x color_vi_mode_default $base03 $colorfg --bold
set -x color_vi_mode_insert $base0B $colorfg --bold
set -x color_vi_mode_visual $base09 $colorfg --bold
set -x color_vagrant $base0C $colorfg --bold
set -x color_k8s $base0B $colorfg --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_rvm $base08 $colorfg --bold
set -x color_nvm $base0B $colorfg --bold
set -x color_virtualfish $base0D $colorfg --bold
set -x color_virtualgo $base0D $colorfg --bold
set -x color_desk $base0D $colorfg --bold
case 'solarized-light'
set -l base03 002b36
set -l base02 073642
set -l base01 586e75
set -l base00 657b83
set -l base0 839496
set -l base1 93a1a1
set -l base2 eee8d5
set -l base3 fdf6e3
set -l yellow b58900
set -l orange cb4b16
set -l red dc322f
set -l magenta d33682
set -l violet 6c71c4
set -l blue 268bd2
set -l cyan 2aa198
set -l green 859900
set colorfg $base03
set -x color_initial_segment_exit $base02 $red --bold
set -x color_initial_segment_su $base02 $green --bold
set -x color_initial_segment_jobs $base02 $blue --bold
set -x color_path $base2 $base00
set -x color_path_basename $base2 $base01 --bold
set -x color_path_nowrite $base2 $orange
set -x color_path_nowrite_basename $base2 $orange --bold
set -x color_repo $green $colorfg
set -x color_repo_work_tree $base2 $colorfg --bold
set -x color_repo_dirty $red $colorfg
set -x color_repo_staged $yellow $colorfg
set -x color_vi_mode_default $blue $colorfg --bold
set -x color_vi_mode_insert $green $colorfg --bold
set -x color_vi_mode_visual $yellow $colorfg --bold
set -x color_vagrant $violet $colorfg --bold
set -x color_k8s $green $colorfg --bold
set -x color_username $base2 $blue --bold
set -x color_hostname $base2 $blue
set -x color_rvm $red $colorfg --bold
set -x color_nvm $green $colorfg --bold
set -x color_virtualfish $cyan $colorfg --bold
set -x color_virtualgo $cyan $colorfg --bold
set -x color_desk $cyan $colorfg --bold
case 'solarized' 'solarized-dark'
set -l base03 002b36
set -l base02 073642
set -l base01 586e75
set -l base00 657b83
set -l base0 839496
set -l base1 93a1a1
set -l base2 eee8d5
set -l base3 fdf6e3
set -l yellow b58900
set -l orange cb4b16
set -l red dc322f
set -l magenta d33682
set -l violet 6c71c4
set -l blue 268bd2
set -l cyan 2aa198
set -l green 859900
set colorfg $base3
set -x color_initial_segment_exit $base2 $red --bold
set -x color_initial_segment_su $base2 $green --bold
set -x color_initial_segment_jobs $base2 $blue --bold
set -x color_path $base02 $base0
set -x color_path_basename $base02 $base1 --bold
set -x color_path_nowrite $base02 $orange
set -x color_path_nowrite_basename $base02 $orange --bold
set -x color_repo $green $colorfg
set -x color_repo_work_tree $base02 $colorfg --bold
set -x color_repo_dirty $red $colorfg
set -x color_repo_staged $yellow $colorfg
set -x color_vi_mode_default $blue $colorfg --bold
set -x color_vi_mode_insert $green $colorfg --bold
set -x color_vi_mode_visual $yellow $colorfg --bold
set -x color_vagrant $violet $colorfg --bold
set -x color_k8s $green $colorfg --bold
set -x color_username $base02 $blue --bold
set -x color_hostname $base02 $blue
set -x color_rvm $red $colorfg --bold
set -x color_nvm $green $colorfg --bold
set -x color_virtualfish $cyan $colorfg --bold
set -x color_virtualgo $cyan $colorfg --bold
set -x color_desk $cyan $colorfg --bold
case 'light'
# light medium dark
# ------ ------ ------
set -l red cc9999 ce000f 660000
set -l green addc10 189303 0c4801
set -l blue 48b4fb 005faf 255e87
set -l orange f6b117 unused 3a2a03
set -l brown bf5e00 803f00 4d2600
set -l grey cccccc 999999 333333
set -l white ffffff
set -l black 000000
set -l ruby_red af0000
set -x color_initial_segment_exit $grey[3] $red[2] --bold
set -x color_initial_segment_su $grey[3] $green[2] --bold
set -x color_initial_segment_jobs $grey[3] $blue[3] --bold
set -x color_path $grey[1] $grey[2]
set -x color_path_basename $grey[1] $grey[3] --bold
set -x color_path_nowrite $red[1] $red[3]
set -x color_path_nowrite_basename $red[1] $red[3] --bold
set -x color_repo $green[1] $green[3]
set -x color_repo_work_tree $grey[1] $white --bold
set -x color_repo_dirty $red[2] $white
set -x color_repo_staged $orange[1] $orange[3]
set -x color_vi_mode_default $grey[2] $grey[3] --bold
set -x color_vi_mode_insert $green[2] $grey[3] --bold
set -x color_vi_mode_visual $orange[1] $orange[3] --bold
set -x color_vagrant $blue[1] $white --bold
set -x color_k8s $green[1] $colorfg --bold
set -x color_username $grey[1] $blue[3] --bold
set -x color_hostname $grey[1] $blue[3]
set -x color_rvm $ruby_red $grey[1] --bold
set -x color_nvm $green $grey[1] --bold
set -x color_virtualfish $blue[2] $grey[1] --bold
set -x color_virtualgo $blue[2] $grey[1] --bold
set -x color_desk $blue[2] $grey[1] --bold
case 'gruvbox'
# light medium dark darkest
# ------ ------ ------ -------
set -l red fb4934 cc241d
set -l green b8bb26 98971a
set -l yellow fabd2f d79921
set -l aqua 8ec07c 689d6a
set -l blue 83a598 458588
set -l grey cccccc 999999 333333
set -l fg fbf1c7 ebdbb2 d5c4a1 a89984
set -l bg 504945 282828
set -x color_initial_segment_exit $fg[1] $red[2] --bold
set -x color_initial_segment_su $fg[1] $green[2] --bold
set -x color_initial_segment_jobs $fg[1] $aqua[2] --bold
set -x color_path $bg[1] $fg[2]
set -x color_path_basename $bg[1] $fg[2] --bold
set -x color_path_nowrite $red[1] $fg[2]
set -x color_path_nowrite_basename $red[1] $fg[2] --bold
set -x color_repo $green[2] $bg[1]
set -x color_repo_work_tree $bg[1] $fg[2] --bold
set -x color_repo_dirty $red[2] $fg[2]
set -x color_repo_staged $yellow[1] $bg[1]
set -x color_vi_mode_default $fg[4] $bg[2] --bold
set -x color_vi_mode_insert $blue[1] $bg[2] --bold
set -x color_vi_mode_visual $yellow[1] $bg[2] --bold
set -x color_vagrant $blue[2] $fg[2] --bold
set -x color_k8s $green[2] $fg[2] --bold
set -x color_username $fg[3] $blue[2] --bold
set -x color_hostname $fg[3] $blue[2]
set -x color_rvm $red[2] $fg[2] --bold
set -x color_nvm $green[1] $fg[2] --bold
set -x color_virtualfish $blue[2] $fg[2] --bold
set -x color_virtualgo $blue[2] $fg[2] --bold
set -x color_desk $blue[2] $fg[2] --bold
case 'dracula' # https://draculatheme.com
set -l bg 282a36
set -l current_line 44475a
set -l selection 44475a
set -l fg f8f8f2
set -l comment 6272a4
set -l cyan 8be9fd
set -l green 50fa7b
set -l orange ffb86c
set -l pink ff79c6
set -l purple bd93f9
set -l red ff5555
set -l yellow f1fa8c
set -x color_initial_segment_exit $fg $red --bold
set -x color_initial_segment_su $fg $purple --bold
set -x color_initial_segment_jobs $fg $comment --bold
set -x color_path $selection $fg
set -x color_path_basename $selection $fg --bold
set -x color_path_nowrite $selection $red
set -x color_path_nowrite_basename $selection $red --bold
set -x color_repo $green $bg
set -x color_repo_work_tree $selection $fg --bold
set -x color_repo_dirty $red $bg
set -x color_repo_staged $yellow $bg
set -x color_vi_mode_default $bg $yellow --bold
set -x color_vi_mode_insert $green $bg --bold
set -x color_vi_mode_visual $orange $bg --bold
set -x color_vagrant $pink $bg --bold
set -x color_k8s $green $fg --bold
set -x color_username $selection $cyan --bold
set -x color_hostname $selection $cyan
set -x color_rvm $red $bg --bold
set -x color_nvm $green $bg --bold
set -x color_virtualfish $comment $bg --bold
set -x color_virtualgo $cyan $bg --bold
set -x color_desk $comment $bg --bold
case 'nord'
set -l base00 2E3440
set -l base01 3B4252
set -l base02 434C5E
set -l base03 4C566A
set -l base04 D8DEE9
set -l base05 E5E9F0
set -l base06 ECEFF4
set -l base07 8FBCBB
set -l base08 88C0D0
set -l base09 81A1C1
set -l base0A 5E81AC
set -l base0B BF616A
set -l base0C D08770
set -l base0D EBCB8B
set -l base0E A3BE8C
set -l base0F B48EAD
set -l colorfg $base00
set -x color_initial_segment_exit $base05 $base08 --bold
set -x color_initial_segment_su $base05 $base0B --bold
set -x color_initial_segment_jobs $base08 $base0D --bold
set -x color_path $base02 $base05
set -x color_path_basename $base02 $base06 --bold
set -x color_path_nowrite $base02 $base08
set -x color_path_nowrite_basename $base02 $base08 --bold
set -x color_repo $base0E $colorfg
set -x color_repo_work_tree $base02 $colorfg --bold
set -x color_repo_dirty $base0B $colorfg
set -x color_repo_staged $base0D $colorfg
set -x color_vi_mode_default $base08 $colorfg --bold
set -x color_vi_mode_insert $base06 $colorfg --bold
set -x color_vi_mode_visual $base07 $colorfg --bold
set -x color_vagrant $base02 $colorfg --bold
set -x color_k8s $base02 $colorfg --bold
set -x color_username $base02 $base0D --bold
set -x color_hostname $base02 $base0D
set -x color_rvm $base09 $colorfg --bold
set -x color_nvm $base09 $colorfg --bold
set -x color_virtualfish $base09 $colorfg --bold
set -x color_virtualgo $base09 $colorfg --bold
set -x color_desk $base09 $colorfg --bold
case '*' # default dark theme
# light medium dark
# ------ ------ ------
set -l red cc9999 ce000f 660000
set -l green addc10 189303 0c4801
set -l blue 48b4fb 005faf 255e87
set -l orange f6b117 unused 3a2a03
set -l brown bf5e00 803f00 4d2600
set -l grey cccccc 999999 333333
set -l white ffffff
set -l black 000000
set -l ruby_red af0000
set -l go_blue 00d7d7
set -x color_initial_segment_exit $white $red[2] --bold
set -x color_initial_segment_su $white $green[2] --bold
set -x color_initial_segment_jobs $white $blue[3] --bold
set -x color_path $grey[3] $grey[2]
set -x color_path_basename $grey[3] $white --bold
set -x color_path_nowrite $red[3] $red[1]
set -x color_path_nowrite_basename $red[3] $red[1] --bold
set -x color_repo $green[1] $green[3]
set -x color_repo_work_tree $grey[3] $white --bold
set -x color_repo_dirty $red[2] $white
set -x color_repo_staged $orange[1] $orange[3]
set -x color_vi_mode_default $grey[2] $grey[3] --bold
set -x color_vi_mode_insert $green[2] $grey[3] --bold
set -x color_vi_mode_visual $orange[1] $orange[3] --bold
set -x color_vagrant $blue[1] $white --bold
set -x color_k8s $green[2] $white --bold
set -x color_username $grey[1] $blue[3] --bold
set -x color_hostname $grey[1] $blue[3]
set -x color_rvm $ruby_red $grey[1] --bold
set -x color_nvm $green[1] $white --bold
set -x color_virtualfish $blue[2] $grey[1] --bold
set -x color_virtualgo $go_blue $black --bold
set -x color_desk $blue[2] $grey[1] --bold
end
end
function __bobthefish_user_color_scheme_deprecated
set -q __color_initial_segment_exit; or set -l __color_initial_segment_exit ffffff ce000f --bold
set -q __color_initial_segment_su; or set -l __color_initial_segment_su ffffff 189303 --bold
set -q __color_initial_segment_jobs; or set -l __color_initial_segment_jobs ffffff 255e87 --bold
set -q __color_path; or set -l __color_path 333333 999999
set -q __color_path_basename; or set -l __color_path_basename 333333 ffffff --bold
set -q __color_path_nowrite; or set -l __color_path_nowrite 660000 cc9999
set -q __color_path_nowrite_basename; or set -l __color_path_nowrite_basename 660000 cc9999 --bold
set -q __color_repo; or set -l __color_repo addc10 0c4801
set -q __color_repo_work_tree; or set -l __color_repo_work_tree 333333 ffffff --bold
set -q __color_repo_dirty; or set -l __color_repo_dirty ce000f ffffff
set -q __color_repo_staged; or set -l __color_repo_staged f6b117 3a2a03
set -q __color_vi_mode_default; or set -l __color_vi_mode_default 999999 333333 --bold
set -q __color_vi_mode_insert; or set -l __color_vi_mode_insert 189303 333333 --bold
set -q __color_vi_mode_visual; or set -l __color_vi_mode_visual f6b117 3a2a03 --bold
set -q __color_vagrant; or set -l __color_vagrant 48b4fb ffffff --bold
set -q __color_username; or set -l __color_username cccccc 255e87 --bold
set -q __color_hostname; or set -l __color_hostname cccccc 255e87
set -q __color_rvm; or set -l __color_rvm af0000 cccccc --bold
set -q __color_virtualfish; or set -l __color_virtualfish 005faf cccccc --bold
set -q __color_virtualgo; or set -l __color_virtualgo 005faf cccccc --bold
set -q __color_desk; or set -l __color_desk 005faf cccccc --bold
set_color black -b red --bold
echo "The 'user' color scheme is deprecated."
set_color normal
set_color black -b red
echo "To define a custom color scheme, create a 'bobthefish_colors' function:"
set_color normal
echo
echo "function bobthefish_colors -S -d 'Define a custom bobthefish color scheme'
# optionally include a base color scheme...
___bobthefish_colors default
# then override everything you want! note that these must be defined with `set -x`
set -x color_initial_segment_exit $__color_initial_segment_exit
set -x color_initial_segment_su $__color_initial_segment_su
set -x color_initial_segment_jobs $__color_initial_segment_jobs
set -x color_path $__color_path
set -x color_path_basename $__color_path_basename
set -x color_path_nowrite $__color_path_nowrite
set -x color_path_nowrite_basename $__color_path_nowrite_basename
set -x color_repo $__color_repo
set -x color_repo_work_tree $__color_repo_work_tree
set -x color_repo_dirty $__color_repo_dirty
set -x color_repo_staged $__color_repo_staged
set -x color_vi_mode_default $__color_vi_mode_default
set -x color_vi_mode_insert $__color_vi_mode_insert
set -x color_vi_mode_visual $__color_vi_mode_visual
set -x color_vagrant $__color_vagrant
set -x color_username $__color_username
set -x color_hostname $__color_hostname
set -x color_rvm $__color_rvm
set -x color_virtualfish $__color_virtualfish
set -x color_virtualgo $__color_virtualgo
set -x color_desk $__color_desk
end"
echo
end

View File

@@ -0,0 +1,3 @@
function __bobthefish_display_colors -d 'Print example prompts using the current color scheme'
bobthefish_display_colors
end

View File

@@ -0,0 +1,93 @@
function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish'
# Powerline glyphs
set -x branch_glyph \uE0A0
set -x right_black_arrow_glyph \uE0B0
set -x right_arrow_glyph \uE0B1
set -x left_black_arrow_glyph \uE0B2
set -x left_arrow_glyph \uE0B3
# Additional glyphs
set -x detached_glyph \u27A6
set -x tag_glyph \u2302
set -x nonzero_exit_glyph '! '
set -x superuser_glyph '$ '
set -x bg_job_glyph '% '
set -x hg_glyph \u263F
# Python glyphs
set -x superscript_glyph \u00B9 \u00B2 \u00B3
set -x virtualenv_glyph 'py' # \u25F0
set -x pypy_glyph \u1D56
set -x ruby_glyph ''
set -x go_glyph ''
# Desk glyphs
set -x desk_glyph \u25F2
# Kubernetes glyphs
set -x k8s_glyph \u2388 # '⎈'
# Vagrant glyphs
set -x vagrant_running_glyph \u2191 # ↑ 'running'
set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff'
set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted'
set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved'
set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping'
set -x vagrant_unknown_glyph '!' # strange cases
# Git glyphs
set -x git_dirty_glyph '*'
set -x git_staged_glyph '~'
set -x git_stashed_glyph '$'
set -x git_untracked_glyph '…'
set -x git_ahead_glyph \u2191 # '↑'
set -x git_behind_glyph \u2193 # '↓'
set -x git_plus_glyph '+'
set -x git_minus_glyph '-'
set -x git_plus_minus_glyph '±'
# Disable Powerline fonts (unless we're using nerd fonts instead)
if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ]
set branch_glyph \u2387
set right_black_arrow_glyph ''
set right_arrow_glyph ''
set left_black_arrow_glyph ''
set left_arrow_glyph ''
end
# Use prettier Nerd Fonts glyphs
if [ "$theme_nerd_fonts" = "yes" ]
set branch_glyph \uF418
set detached_glyph \uF417
set tag_glyph \uF412
set virtualenv_glyph \uE73C ' '
set ruby_glyph \uE791 ' '
set go_glyph \uE626 ' '
set node_glyph \uE718 ' '
set vagrant_running_glyph \uF431 # ↑ 'running'
set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff'
set vagrant_aborted_glyph \uF468 # ✕ 'aborted'
set vagrant_unknown_glyph \uF421 # strange cases
set git_dirty_glyph \uF448 '' # nf-oct-pencil
set git_staged_glyph \uF0C7 '' # nf-fa-save
set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip
set git_untracked_glyph \uF128 '' # nf-fa-question
# set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h
set git_ahead_glyph \uF47B # nf-oct-chevron_up
set git_behind_glyph \uF47C # nf-oct-chevron_down
set git_plus_glyph \uF0DE # fa-sort-asc
set git_minus_glyph \uF0DD # fa-sort-desc
set git_plus_minus_glyph \uF0DC # fa-sort
end
# Avoid ambiguous glyphs
if [ "$theme_avoid_ambiguous_glyphs" = "yes" ]
set git_untracked_glyph '...'
end
end

View File

@@ -0,0 +1,46 @@
set -g bax_version 1.0.0
complete -xc bax -n __fish_use_subcommand -a --help -d "Show usage help"
complete -xc bax -n __fish_use_subcommand -a --version -d "$bax_version"
function bax
switch "$argv"
case {,-}-h{elp,} ""
echo "usage: bax <bash commands> Run a bash command"
echo " bax --help Show this help"
echo " bax --version Show the current version"
case {,-}-v{ersion,}
echo "bax version $bax_version"
case \*
set -l delim "@@@@bax@@@@"
command bash -c "
$argv
status=\$?
[ \$status -eq 0 ] && echo $delim && alias && echo $delim && command awk '
BEGIN {
for (k in ENVIRON)
if (gsub(/\n/, \"\\\n\", ENVIRON[k]) >= 0)
print k, ENVIRON[k]
}
' || echo $delim \$status
" | command awk -v delim="$delim" '
$0 != delim || !++i {
if ($1 == delim) exit $2
else if (i < 2) print (i ? $0 : gsub(/\$/, "\\\$") >= 0 ? "echo \"" $0 "\"" : "")
else env[$1] = (gsub(/\\\n/, "\n") >= 0 ? substr($0, length($1) + 2) : "")
}
END {
for (k in env)
if (len++ && k !~ /^(_|SHLVL|PS1|XPC_SERVICE_NAME|AWK(LIB)?PATH)$|^BASH_FUNC/\
&& !(k in ENVIRON && ENVIRON[k] == env[k]))
print (\
k == "PATH" && gsub(/:/, "\" \"", env[k]) >= 0\
? "set PATH \"" env[k] "\"" : k == "PWD"\
? "cd \"" env[k] "\"" : "set -gx " k " \"" env[k] "\""\
)
if (!len) print "exit " $2
else for (k in ENVIRON) if (!(k in env)) print "set -e " k
}
' | source
end
end

View File

@@ -0,0 +1,135 @@
function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes'
set -l color_schemes default light \
solarized solarized-light \
base16 base16-light \
gruvbox zenburn \
dracula \
terminal terminal-dark-white \
terminal-light terminal-light-black \
terminal2 terminal2-dark-white \
terminal2-light terminal2-light-black
switch "$color_scheme"
case '--all'
for scheme in $color_schemes
echo
echo "$scheme:"
bobthefish_display_colors $scheme
end
return
case $color_schemes
__bobthefish_colors $color_scheme
case ''
[ -n "$theme_color_scheme" ]
and echo "$theme_color_scheme:"
__bobthefish_colors $theme_color_scheme
type -q bobthefish_colors
and bobthefish_colors
case '*'
echo 'usage: bobthefish_display_colors [--all] [color_scheme]'
return
end
__bobthefish_glyphs
echo
set_color normal
__bobthefish_start_segment $color_initial_segment_exit
echo -n exit $nonzero_exit_glyph
set_color -b $color_initial_segment_su
echo -n su $superuser_glyph
set_color -b $color_initial_segment_jobs
echo -n jobs $bg_job_glyph
__bobthefish_finish_segments
set_color normal
echo -n "(<- initial_segment)"
echo
__bobthefish_start_segment $color_path
echo -n /color/path/
set_color -b $color_path_basename
echo -ns basename ' '
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_path_nowrite
echo -n /color/path/nowrite/
set_color -b $color_path_nowrite_basename
echo -ns basename ' '
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_path
echo -n /color/path/
set_color -b $color_path_basename
echo -ns basename ' '
__bobthefish_start_segment $color_repo
echo -n "$branch_glyph repo $git_stashed_glyph "
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_path
echo -n /color/path/
set_color -b $color_path_basename
echo -ns basename ' '
__bobthefish_start_segment $color_repo_dirty
echo -n "$tag_glyph repo_dirty $git_dirty_glyph "
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_path
echo -n /color/path/
set_color -b $color_path_basename
echo -ns basename ' '
__bobthefish_start_segment $color_repo_staged
echo -n "$detached_glyph repo_staged $git_staged_glyph "
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_vi_mode_default
echo -ns vi_mode_default ' '
__bobthefish_finish_segments
__bobthefish_start_segment $color_vi_mode_insert
echo -ns vi_mode_insert ' '
__bobthefish_finish_segments
__bobthefish_start_segment $color_vi_mode_visual
echo -ns vi_mode_visual ' '
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_vagrant
echo -ns $vagrant_running_glyph ' ' vagrant ' '
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_username
echo -n username
set_color normal
set_color -b $color_hostname[1] $color_hostname[2..-1]
echo -ns @hostname ' '
__bobthefish_finish_segments
echo
__bobthefish_start_segment $color_rvm
echo -ns $ruby_glyph rvm ' '
__bobthefish_finish_segments
__bobthefish_start_segment $color_virtualfish
echo -ns $virtualenv_glyph virtualfish ' '
__bobthefish_finish_segments
__bobthefish_start_segment $color_virtualgo
echo -ns $go_glyph virtualgo ' '
__bobthefish_finish_segments
__bobthefish_start_segment $color_desk
echo -ns $desk_glyph desk ' '
__bobthefish_finish_segments
echo -e "\n"
end

View File

@@ -0,0 +1,10 @@
function fish_greeting -d "What's up, fish?"
set_color $fish_color_autosuggestion
uname -nmsr
# TODO: `command -q -s` only works on fish 2.5+, so hold off on that for now
command -s uptime >/dev/null
and command uptime
set_color normal
end

View File

@@ -0,0 +1,9 @@
# This is handled inside fish_mode_prompt (see `__bobthefish_prompt_vi`)
#
# If you want to override this with your own mode prompt, disable bobthefish's
# built-in mode prompt in your fish config:
#
# set -g theme_display_vi no
function fish_mode_prompt
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
# You can override some default right prompt options in your config.fish:
# set -g theme_date_format "+%a %H:%M"
function __bobthefish_cmd_duration -S -d 'Show command duration'
[ "$theme_display_cmd_duration" = "no" ]
and return
[ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]
and return
if [ "$CMD_DURATION" -lt 5000 ]
echo -ns $CMD_DURATION 'ms'
else if [ "$CMD_DURATION" -lt 60000 ]
__bobthefish_pretty_ms $CMD_DURATION s
else if [ "$CMD_DURATION" -lt 3600000 ]
set_color $fish_color_error
__bobthefish_pretty_ms $CMD_DURATION m
else
set_color $fish_color_error
__bobthefish_pretty_ms $CMD_DURATION h
end
set_color $fish_color_normal
set_color $fish_color_autosuggestion
[ "$theme_display_date" = "no" ]
or echo -ns ' ' $__bobthefish_left_arrow_glyph
end
function __bobthefish_pretty_ms -S -a ms -a interval -d 'Millisecond formatting for humans'
set -l interval_ms
set -l scale 1
switch $interval
case s
set interval_ms 1000
case m
set interval_ms 60000
case h
set interval_ms 3600000
set scale 2
end
switch $FISH_VERSION
case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
# Fish 2.3 and lower doesn't know about the -s argument to math.
math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
case 2.\*
# Fish 2.x always returned a float when given the -s argument.
math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
case \*
math -s$scale "$ms/$interval_ms"
echo -ns $interval
end
end
function __bobthefish_timestamp -S -d 'Show the current timestamp'
[ "$theme_display_date" = "no" ]
and return
set -q theme_date_format
or set -l theme_date_format "+%c"
echo -n ' '
date $theme_date_format
end
function fish_right_prompt -d 'bobthefish is all about the right prompt'
set -l __bobthefish_left_arrow_glyph \uE0B3
if [ "$theme_powerline_fonts" = "no" ]
set __bobthefish_left_arrow_glyph '<'
end
set_color $fish_color_autosuggestion
__bobthefish_cmd_duration
__bobthefish_timestamp
set_color normal
end

View File

@@ -0,0 +1,34 @@
# You can override some default title options in your config.fish:
# set -g theme_title_display_process no
# set -g theme_title_display_path no
# set -g theme_title_display_user yes
# set -g theme_title_use_abbreviated_path no
function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
if [ "$theme_title_display_user" = 'yes' ]
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
set -l IFS .
hostname | read -l hostname __
echo -ns (whoami) '@' $hostname ' '
end
end
end
function fish_title
__bobthefish_title_user
if [ "$theme_title_display_process" = 'yes' ]
echo $_
[ "$theme_title_display_path" != 'no' ]
and echo ' '
end
if [ "$theme_title_display_path" != 'no' ]
if [ "$theme_title_use_abbreviated_path" = 'no' ]
echo $PWD
else
prompt_pwd
end
end
end

View File

@@ -0,0 +1,3 @@
function fish_user_key_bindings
fzf_key_bindings
end

View File

@@ -0,0 +1,435 @@
set -g fisher_version 3.2.10
function fisher -a cmd -d "fish package manager"
set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME ~/.cache
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
set -g fish_config $XDG_CONFIG_HOME/fish
set -g fisher_cache $XDG_CACHE_HOME/fisher
set -g fisher_config $XDG_CONFIG_HOME/fisher
set -q fisher_path; or set -g fisher_path $fish_config
set -g fishfile $fish_config/fishfile
for path in {$fish_config,$fisher_path}/{functions,completions,conf.d} $fisher_cache
if test ! -d $path
command mkdir -p $path
end
end
if test ! -e $fisher_path/completions/fisher.fish
echo "fisher complete" >$fisher_path/completions/fisher.fish
_fisher_complete
end
if test -e $fisher_path/conf.d/fisher.fish
switch "$version"
case \*-\*
command rm -f $fisher_path/conf.d/fisher.fish
case 2\*
case \*
command rm -f $fisher_path/conf.d/fisher.fish
end
else
switch "$version"
case \*-\*
case 2\*
echo "fisher copy-user-key-bindings" >$fisher_path/conf.d/fisher.fish
end
end
# 2019-10-22: temp code, migrates fishfile from old path back to $fish_config
if test -e "$fisher_path/fishfile"; and test ! -e "$fishfile"
command mv -f "$fisher_path/fishfile" "$fishfile"
end
switch "$cmd"
case {,self-}complete
_fisher_complete
case copy-user-key-bindings
_fisher_copy_user_key_bindings
case ls
set -e argv[1]
if test -s "$fishfile"
set -l file (_fisher_fmt <$fishfile | _fisher_parse -R | command sed "s|@.*||")
_fisher_ls | _fisher_fmt | command awk -v FILE="$file" "
BEGIN { for (n = split(FILE, f); ++i <= n;) file[f[i]] } \$0 in file && /$argv[1]/
" | command sed "s|^$HOME|~|"
end
case self-update
_fisher_self_update (status -f)
case self-uninstall
_fisher_self_uninstall
case {,-}-v{ersion,}
echo "fisher version $fisher_version" (status -f | command sed "s|^$HOME|~|")
case {,-}-h{elp,}
_fisher_help
case ""
_fisher_commit --
case add rm
if not isatty
while read -l arg
set argv $argv $arg
end
end
if test (count $argv) = 1
echo "fisher: invalid number of arguments" >&2
_fisher_help >&2
return 1
end
_fisher_commit $argv
case \*
echo "fisher: unknown flag or command \"$cmd\"" >&2
_fisher_help >&2
return 1
end
end
function _fisher_complete
complete -ec fisher
complete -xc fisher -n __fish_use_subcommand -a add -d "Add packages"
complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove packages"
complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed packages matching REGEX"
complete -xc fisher -n __fish_use_subcommand -a --help -d "Show usage help"
complete -xc fisher -n __fish_use_subcommand -a --version -d "$fisher_version"
complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update to the latest version"
for pkg in (fisher ls)
complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg
end
end
function _fisher_copy_user_key_bindings
if functions -q fish_user_key_bindings
functions -c fish_user_key_bindings fish_user_key_bindings_copy
end
function fish_user_key_bindings
for file in $fisher_path/conf.d/*_key_bindings.fish
source $file >/dev/null 2>/dev/null
end
if functions -q fish_user_key_bindings_copy
fish_user_key_bindings_copy
end
end
end
function _fisher_ls
for pkg in $fisher_config/*/*/*
command readlink $pkg; or echo $pkg
end
end
function _fisher_fmt
command sed "s|^[[:space:]]*||;s|^$fisher_config/||;s|^~|$HOME|;s|^\.\/*|$PWD/|;s|^https*:/*||;s|^github\.com/||;s|/*\$||"
end
function _fisher_help
echo "usage: fisher add <package...> Add packages"
echo " fisher rm <package...> Remove packages"
echo " fisher Update all packages"
echo " fisher ls [<regex>] List installed packages matching <regex>"
echo " fisher --help Show this help"
echo " fisher --version Show the current version"
echo " fisher self-update Update to the latest version"
echo " fisher self-uninstall Uninstall from your system"
echo "examples:"
echo " fisher add jethrokuan/z rafaelrinaldi/pure"
echo " fisher add gitlab.com/foo/bar@v2"
echo " fisher add ~/path/to/local/pkg"
echo " fisher add <file"
echo " fisher rm rafaelrinaldi/pure"
echo " fisher ls | fisher rm"
echo " fisher ls fish-\*"
end
function _fisher_self_update -a file
set -l url "https://raw.githubusercontent.com/jorgebucaran/fisher/master/fisher.fish"
echo "fetching $url" >&2
command curl -s "$url?nocache" >$file.
set -l next_version (command awk '{ print $4 } { exit }' <$file.)
switch "$next_version"
case "" $fisher_version
command rm -f $file.
if test -z "$next_version"
echo "fisher: cannot update fisher -- are you offline?" >&2
return 1
end
echo "fisher is already up-to-date" >&2
case \*
echo "linking $file" | command sed "s|$HOME|~|" >&2
command mv -f $file. $file
source $file
echo "updated to fisher $fisher_version -- hooray!" >&2
_fisher_complete
end
end
function _fisher_self_uninstall
for pkg in (_fisher_ls)
_fisher_rm $pkg
end
for file in $fisher_cache $fisher_config $fisher_path/{functions,completions,conf.d}/fisher.fish $fishfile
echo "removing $file"
command rm -Rf $file 2>/dev/null
end | command sed "s|$HOME|~|" >&2
for name in (set -n | command awk '/^fisher_/')
set -e "$name"
end
functions -e (functions -a | command awk '/^_fisher/') fisher
complete -c fisher --erase
end
function _fisher_commit -a cmd
set -e argv[1]
set -l elapsed (_fisher_now)
if test ! -e "$fishfile"
command touch $fishfile
echo "created new fishfile in $fishfile" | command sed "s|$HOME|~|" >&2
end
set -l old_pkgs (_fisher_ls | _fisher_fmt)
for pkg in (_fisher_ls)
_fisher_rm $pkg
end
command rm -Rf $fisher_config
command mkdir -p $fisher_config
set -l next_pkgs (_fisher_fmt <$fishfile | _fisher_parse -R $cmd (printf "%s\n" $argv | _fisher_fmt))
set -l actual_pkgs (_fisher_fetch $next_pkgs)
set -l updated_pkgs
for pkg in $old_pkgs
if contains -- $pkg $actual_pkgs
set updated_pkgs $updated_pkgs $pkg
end
end
if test -z "$actual_pkgs$updated_pkgs$old_pkgs$next_pkgs"
echo "fisher: nothing to commit -- try adding some packages" >&2
return 1
end
set -l out_pkgs
if test "$cmd" = "rm"
set out_pkgs $next_pkgs
else
for pkg in $next_pkgs
if contains -- (echo $pkg | command sed "s|@.*||") $actual_pkgs
set out_pkgs $out_pkgs $pkg
end
end
end
printf "%s\n" (_fisher_fmt <$fishfile | _fisher_parse -W $cmd $out_pkgs | command sed "s|^$HOME|~|") >$fishfile
_fisher_complete
command awk -v A=(count $actual_pkgs) -v U=(count $updated_pkgs) -v O=(count $old_pkgs) -v E=(_fisher_now $elapsed) '
BEGIN {
res = fmt("removed", O - U, fmt("updated", U, fmt("added", A - U)))
printf((res ? res : "done") " in %.2fs\n", E / 1000)
}
function fmt(action, n, s) {
return n ? (s ? s ", " : s) action " " n " package" (n > 1 ? "s" : "") : s
}
' >&2
end
function _fisher_parse -a mode cmd
set -e argv[1..2]
command awk -v FS="[[:space:]]*#+" -v MODE="$mode" -v CMD="$cmd" -v ARGSTR="$argv" '
BEGIN {
for (n = split(ARGSTR, a, " "); i++ < n;) pkgs[getkey(a[i])] = a[i]
}
!NF { next } { k = getkey($1) }
MODE == "-R" && !(k in pkgs) && $0 = $1
MODE == "-W" && (/^#/ || k in pkgs || CMD != "rm") { print pkgs[k] (sub($1, "") ? $0 : "") }
MODE == "-W" || CMD == "rm" { delete pkgs[k] }
END {
for (k in pkgs) {
if (CMD != "rm" || MODE == "-W") print pkgs[k]
else print "fisher: cannot remove \""k"\" -- package is not in fishfile" > "/dev/stderr"
}
}
function getkey(s, a) {
return (split(s, a, /@+|:/) > 2) ? a[2]"/"a[1]"/"a[3] : a[1]
}
'
end
function _fisher_fetch
set -l pkg_jobs
set -l out_pkgs
set -l next_pkgs
set -l local_pkgs
set -q fisher_user_api_token; and set -l curl_opts -u $fisher_user_api_token
for pkg in $argv
switch $pkg
case \~\* /\*
set -l path (echo "$pkg" | command sed "s|^~|$HOME|")
if test -e "$path"
set local_pkgs $local_pkgs $path
else
echo "fisher: cannot add \"$pkg\" -- is this a valid file?" >&2
end
continue
end
command awk -v PKG="$pkg" -v FS=/ '
BEGIN {
if (split(PKG, tmp, /@+|:/) > 2) {
if (tmp[4]) sub("@"tmp[4], "", PKG)
print PKG "\t" tmp[2]"/"tmp[1]"/"tmp[3] "\t" (tmp[4] ? tmp[4] : "master")
} else {
pkg = split(PKG, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1]
tag = tmp[2] ? tmp[2] : "master"
print (\
pkg ~ /^github/ ? "https://codeload."pkg"/tar.gz/"tag : \
pkg ~ /^gitlab/ ? "https://"pkg"/-/archive/"tag"/"tmp[split(pkg, tmp, "/")]"-"tag".tar.gz" : \
pkg ~ /^bitbucket/ ? "https://"pkg"/get/"tag".tar.gz" : pkg \
) "\t" pkg
}
}
' | read -l url pkg branch
if test ! -d "$fisher_config/$pkg"
fish -c "
echo fetching $url >&2
command mkdir -p $fisher_config/$pkg $fisher_cache/(command dirname $pkg)
if test ! -z \"$branch\"
command git clone $url $fisher_config/$pkg --branch $branch --depth 1 2>/dev/null
or echo fisher: cannot clone \"$url\" -- is this a valid url\? >&2
else if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_config/$pkg 2>/dev/null
command rm -Rf $fisher_cache/$pkg
command mv -f $fisher_config/$pkg/* $fisher_cache/$pkg
command rm -Rf $fisher_config/$pkg
command cp -Rf {$fisher_cache,$fisher_config}/$pkg
else if test -d \"$fisher_cache/$pkg\"
echo fisher: cannot connect to server -- looking in \"$fisher_cache/$pkg\" | command sed 's|$HOME|~|' >&2
command cp -Rf $fisher_cache/$pkg $fisher_config/$pkg/..
else
command rm -Rf $fisher_config/$pkg
echo fisher: cannot add \"$pkg\" -- is this a valid package\? >&2
end
" >/dev/null &
set pkg_jobs $pkg_jobs (_fisher_jobs --last)
set next_pkgs $next_pkgs "$fisher_config/$pkg"
end
end
if set -q pkg_jobs[1]
while for job in $pkg_jobs
contains -- $job (_fisher_jobs); and break
end
end
for pkg in $next_pkgs
if test -d "$pkg"
set out_pkgs $out_pkgs $pkg
_fisher_add $pkg
end
end
end
set -l local_prefix $fisher_config/local/$USER
if test ! -d "$local_prefix"
command mkdir -p $local_prefix
end
for pkg in $local_pkgs
set -l target $local_prefix/(command basename $pkg)
if test ! -L "$target"
command ln -sf $pkg $target
set out_pkgs $out_pkgs $pkg
_fisher_add $pkg --link
end
end
if set -q out_pkgs[1]
_fisher_fetch (
for pkg in $out_pkgs
if test -s "$pkg/fishfile"
_fisher_fmt <$pkg/fishfile | _fisher_parse -R
end
end)
printf "%s\n" $out_pkgs | _fisher_fmt
end
end
function _fisher_add -a pkg opts
for src in $pkg/{functions,completions,conf.d}/**.* $pkg/*.fish
set -l target (command basename $src)
switch $src
case $pkg/conf.d\*
set target $fisher_path/conf.d/$target
case $pkg/completions\*
set target $fisher_path/completions/$target
case $pkg/{functions,}\*
switch $target
case uninstall.fish
continue
case {init,key_bindings}.fish
set target $fisher_path/conf.d/(command basename $pkg)\_$target
case \*
set target $fisher_path/functions/$target
end
end
echo "linking $target" | command sed "s|$HOME|~|" >&2
if set -q opts[1]
command ln -sf $src $target
else
command cp -f $src $target
end
switch $target
case \*.fish
source $target >/dev/null 2>/dev/null
end
end
end
function _fisher_rm -a pkg
for src in $pkg/{conf.d,completions,functions}/**.* $pkg/*.fish
set -l target (command basename $src)
set -l filename (command basename $target .fish)
switch $src
case $pkg/conf.d\*
test "$filename.fish" = "$target"; and emit "$filename"_uninstall
set target conf.d/$target
case $pkg/completions\*
test "$filename.fish" = "$target"; and complete -ec $filename
set target completions/$target
case $pkg/{,functions}\*
test "$filename.fish" = "$target"; and functions -e $filename
switch $target
case uninstall.fish
source $src
continue
case {init,key_bindings}.fish
set target conf.d/(command basename $pkg)\_$target
case \*
set target functions/$target
end
end
command rm -f $fisher_path/$target
end
if not functions -q fish_prompt
source "$__fish_datadir$__fish_data_dir/functions/fish_prompt.fish"
end
end
function _fisher_jobs
jobs $argv | command awk '/^[0-9]+\t/ { print $1 }'
end
function _fisher_now -a elapsed
switch (command uname)
case Darwin \*BSD
command perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - $ARGV[0])' $elapsed
case \*
math (command date "+%s%3N") - "0$elapsed"
end
end

View File

@@ -0,0 +1 @@
/home/marc/.fzf/shell/key-bindings.fish