From da06c4398ee8758588baa153cafbe967271204ce Mon Sep 17 00:00:00 2001 From: afonso Date: Sat, 8 Jun 2024 18:10:53 +0100 Subject: [PATCH] [zsh] Added a session restore to vim when used without arguments --- .config/zsh/replacements.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.config/zsh/replacements.zsh b/.config/zsh/replacements.zsh index b85d648..808cf08 100644 --- a/.config/zsh/replacements.zsh +++ b/.config/zsh/replacements.zsh @@ -2,7 +2,18 @@ alias ls="eza --icons -l --sort type" -alias vim="nvim --listen /tmp/nvim.pipe" +function vim { + if [[ -z "$@" ]]; then + if [[ -f "./.session.vim" ]]; then + nvim -S .session.vim --listen /tmp/nvim.pipe -c 'lua vim.g.savesession = true' + else + nvim --listen /tmp/nvim.pipe -c 'lua vim.g.savesession = true' + fi + else + nvim --listen /tmp/nvim.pipe "$@" + fi +} + alias lg="lazygit" alias calcurse-caldav='CALCURSE_CALDAV_PASSWORD=$(keyring get caldav afonso) calcurse-caldav'