From e1fd61e0faf8712d02af2126620dce0b63e155ce Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Tue, 23 Aug 2022 15:37:54 +0200 Subject: [PATCH] convert lazygit function to widget --- .config/zsh/.zshrc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 70f1b9d24..e496af92d 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -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