Migrate to home-manager
This commit is contained in:
parent
6781866277
commit
2f6d4e1d3c
147 changed files with 6181 additions and 6078 deletions
files/config/fish
72
files/config/fish/vcs.fish
Normal file
72
files/config/fish/vcs.fish
Normal file
|
@ -0,0 +1,72 @@
|
|||
|
||||
function __jj_in_repo
|
||||
jj --ignore-working-copy --quiet root >>/dev/null 2>&1
|
||||
end
|
||||
|
||||
function vcs_root
|
||||
jj workspace root --ignore-working-copy 2>/dev/null || git rev-parse --show-toplevel 2>/dev/null || pwd
|
||||
end
|
||||
|
||||
function vcs_broot
|
||||
br (vcs_root)
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_jump
|
||||
set _dir (vcs_root)
|
||||
if [ "$_dir" = "$PWD" ]
|
||||
set _dir (br -f --conf "$HOME/.config/broot/conf.toml")
|
||||
end
|
||||
[ -n "$_dir" ] && pushd $_dir >>/dev/null
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_status
|
||||
if __jj_in_repo
|
||||
jj status --ignore-working-copy
|
||||
else
|
||||
git status -sb
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_diff
|
||||
if __jj_in_repo
|
||||
jj show $argv
|
||||
else
|
||||
git diff --stat -p -C --color-words $argv
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
|
||||
function vcs_log
|
||||
if __jj_in_repo
|
||||
jj log --ignore-working-copy $argv
|
||||
else
|
||||
git diff --stat -p -C --color-words $argv
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function vcs_ui
|
||||
if __jj_in_repo
|
||||
lazyjj
|
||||
else
|
||||
gitui
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
# Abbreviations
|
||||
|
||||
abbr -a d vcs_diff
|
||||
abbr -a s vcs_status
|
||||
|
||||
# Bindings
|
||||
bind \c_ vcs_jump
|
||||
bind \ea vcs_log
|
||||
bind \ee vcs_broot
|
||||
bind \eg vcs_ui
|
||||
bind \eS vcs_diff
|
||||
bind \es vcs_status
|
Loading…
Add table
Add a link
Reference in a new issue