dotfiles/.config/nvim/lua/func/sessions.lua
Ben Vincent 14159884fa multiple updates
vim/nvim functions/keys
shell aliases
waybar config
password-store submodule
2024-03-09 11:47:06 +11:00

23 lines
764 B
Lua

vim.cmd([[
command! SaveSession call SaveSession()
function! SaveSession()
let session_file = g:session_dir . GetRepositoryName() . '_' . GetCurrentGitBranch() . '.vim'
execute 'mksession! ' . session_file
echo "Session saved to " . session_file
endfunction
command! LoadSession call LoadSession()
function! LoadSession()
let session_file = g:session_dir . GetRepositoryName() . '_' . GetCurrentGitBranch() . '.vim'
if filereadable(session_file)
execute 'source ' . session_file
echo "Session loaded from " . session_file
else
echo "No session found for the current Git branch in the repository"
endif
endfunction
nnoremap <silent> <Leader>ss :SaveSession<CR>
nnoremap <silent> <Leader>sl :LoadSession<CR>
]])