[zsh] Added a session restore to vim when used without arguments

This commit is contained in:
Afonso Franco 2024-06-08 18:10:53 +01:00
parent bf838b7d7c
commit da06c4398e
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54

View file

@ -2,7 +2,18 @@
alias ls="eza --icons -l --sort type" 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 lg="lazygit"
alias calcurse-caldav='CALCURSE_CALDAV_PASSWORD=$(keyring get caldav afonso) calcurse-caldav' alias calcurse-caldav='CALCURSE_CALDAV_PASSWORD=$(keyring get caldav afonso) calcurse-caldav'