reorganize fish config in separate files
This commit is contained in:
parent
ba56361b3c
commit
3f2a8fcb40
4 changed files with 42 additions and 51 deletions
5
fish/.config/fish/conf.d/abbr.fish
Normal file
5
fish/.config/fish/conf.d/abbr.fish
Normal file
|
@ -0,0 +1,5 @@
|
|||
if status --is-interactive
|
||||
abbr --add --global lg 'lazygit'
|
||||
abbr --add --global jsonpp "python -mjson.tool"
|
||||
end
|
||||
|
12
fish/.config/fish/conf.d/prompt.fish
Normal file
12
fish/.config/fish/conf.d/prompt.fish
Normal file
|
@ -0,0 +1,12 @@
|
|||
# set command timing in prompt
|
||||
set fish_command_timer_time_format ''
|
||||
source ~/.config/fish/command_timer.sh
|
||||
|
||||
# Removes greeting message
|
||||
set fish_greeting
|
||||
|
||||
set -g __fish_git_prompt_show_informative_status 1
|
||||
set -g __fish_git_prompt_shorten_branch_len 20
|
||||
set -g __fish_git_prompt_showcolorhints 1
|
||||
|
||||
|
25
fish/.config/fish/conf.d/virtualenv.fish
Normal file
25
fish/.config/fish/conf.d/virtualenv.fish
Normal file
|
@ -0,0 +1,25 @@
|
|||
set -x VIRTUAL_ENV_DISABLE_PROMPT true
|
||||
|
||||
# Autosource python virtualenv
|
||||
function __autovenv_python --on-variable PWD
|
||||
set -l base $PWD
|
||||
set -l has_venv false
|
||||
|
||||
while test $base != '/'
|
||||
if test -f $base/.venv/bin/activate.fish
|
||||
set has_venv $base/.venv
|
||||
break
|
||||
end
|
||||
set base (dirname $base)
|
||||
end
|
||||
|
||||
if test -n "$VIRTUAL_ENV" -a $has_venv = 'false'
|
||||
deactivate
|
||||
else if test $has_venv != 'false'
|
||||
if test -z "$VIRTUAL_ENV" -o "$VIRTUAL_ENV" != "$has_env"
|
||||
source "$has_venv/bin/activate.fish"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
## PATH
|
||||
|
||||
set -x PATH $PATH ~/.local/bin ~/.go/bin ~/.npm/bin
|
||||
set -x VIRTUAL_ENV_DISABLE_PROMPT true
|
||||
set -x EDITOR nvim
|
||||
|
||||
## SSH init
|
||||
|
@ -16,53 +15,3 @@ end
|
|||
## Go utils
|
||||
set -x GOPATH ~/.go
|
||||
|
||||
## aliases
|
||||
alias jsonpp "python -mjson.tool"
|
||||
|
||||
# Emulates !!
|
||||
function bind_bang
|
||||
switch (commandline -t)[-1]
|
||||
case "!"
|
||||
commandline -t $history[1]; commandline -f repaint
|
||||
case "*"
|
||||
commandline -i !
|
||||
end
|
||||
end
|
||||
|
||||
function fish_user_key_bindings
|
||||
bind ! bind_bang
|
||||
end
|
||||
|
||||
# Autosource python virtualenv
|
||||
function __autovenv_python --on-variable PWD
|
||||
set -l base $PWD
|
||||
set -l has_venv false
|
||||
|
||||
while test $base != '/'
|
||||
if test -f $base/.venv/bin/activate.fish
|
||||
set has_venv $base/.venv
|
||||
break
|
||||
end
|
||||
set base (dirname $base)
|
||||
end
|
||||
|
||||
if test -n "$VIRTUAL_ENV" -a $has_venv = 'false'
|
||||
deactivate
|
||||
else if test $has_venv != 'false'
|
||||
if test -z "$VIRTUAL_ENV" -o "$VIRTUAL_ENV" != "$has_env"
|
||||
source "$has_venv/bin/activate.fish"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# set command timing in prompt
|
||||
set fish_command_timer_time_format ''
|
||||
source ~/.config/fish/command_timer.sh
|
||||
|
||||
# Removes greeting message
|
||||
set fish_greeting
|
||||
|
||||
set -g __fish_git_prompt_show_informative_status 1
|
||||
set -g __fish_git_prompt_shorten_branch_len 20
|
||||
set -g __fish_git_prompt_showcolorhints 1
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue