1
0
Fork 0

convert lazygit function to widget

This commit is contained in:
Luca Bilke 2022-08-23 15:37:54 +02:00
parent af3d3a6480
commit e1fd61e0fa
1 changed files with 5 additions and 9 deletions

View File

@ -87,17 +87,13 @@ bindkey '^o' _lfcd
# bind lazygit to ctrl-g
lg () {
lazygit
tput cuu1;tput el
[ ! -d "$(pwd)/.git" ] && [[ $(read -ek "?Not in a git repository. Create a new git repository? (y/n): ") =~ ^[Yy]$ ]] && git init
[ -d "$(pwd)/.git" ] && lazygit -p $(pwd)
zle reset-prompt
}
_lazygit () {
BUFFER="lg"
zle accept-line
}
zle -N _lazygit
bindkey '^g' _lazygit
zle -N lg{,}
bindkey '^g' lg
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line