diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-10-07 12:34:12 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-11 21:45:31 +1100 |
commit | cbc82cd3c1e8668d37aad049401222a382613f98 (patch) | |
tree | 1925bc51831d4f8c7505947e1cef70e7f88d2e68 /pkg/gui/keybindings.go | |
parent | 29ee2399876bccbc4fe388252545df2763b11029 (diff) |
allow for changing the current directory on exit
For this to work you'll need to put this in your ~/.zshrc (or equivalent rc file):
lg()
{
export LAZYGIT_NEW_DIR_FILE=/Users/jesseduffieldduffield/Library/Application\ Support/jesseduffield/lazygit/.lastd
lazygit "$@"
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
fi
}
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 9bcd7ec42..6b1aec020 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -72,17 +72,22 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { ViewName: "", Key: 'q', Modifier: gocui.ModNone, - Handler: gui.quit, + Handler: gui.handleQuit, + }, { + ViewName: "", + Key: 'Q', + Modifier: gocui.ModNone, + Handler: gui.handleQuitWithoutChangingDirectory, }, { ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, - Handler: gui.quit, + Handler: gui.handleQuit, }, { ViewName: "", Key: gocui.KeyEsc, Modifier: gocui.ModNone, - Handler: gui.quit, + Handler: gui.handleQuit, }, { ViewName: "", Key: gocui.KeyPgup, |