Browse Source

add: save session on VimLeave with retrospect plugin

master
Tovi Jaeschke-Rogers 8 months ago
parent
commit
24f0e1fbf3
1 changed files with 29 additions and 11 deletions
  1. +29
    -11
      .config/nvim/lua/tovi/core/autocmd.lua

+ 29
- 11
.config/nvim/lua/tovi/core/autocmd.lua View File

@ -1,7 +1,7 @@
local aucmd_dict = {
FileType = {
-- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files
{
-- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files
pattern = "dart,vue,javascript,typescript,json",
callback = function()
vim.opt_local.tabstop = 2
@ -12,47 +12,65 @@ local aucmd_dict = {
},
BufWritePre = {
-- Remove trailing whitespace on save
{
-- Remove trailing whitespace on save
command = [[%s/\s\+$//e]],
},
-- Run goimports on save
{
-- Run goimports on save
pattern = "*.go",
command = 'silent! lua require(\'go.format\').goimport()'
callback = function()
require('go.format').goimport()
end,
},
},
BufRead = {
-- Return cursor to where it was previously when re-opening a file
{
-- Return cursor to where it was previously when re-opening a file
command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
},
-- Set syntax for Dockerfiles
{
-- Set syntax for Dockerfiles
pattern = { '*.docker' },
callback = function()
vim.opt_local.syntax = 'dockerfile'
end
}
},
{
pattern = { '*.blade.php' },
callback = function()
vim.opt_local.syntax = 'html'
end
},
},
BufNewFile = {
-- Set syntax for Dockerfiles
{
-- Set syntax for Dockerfiles
pattern = { '*.docker' },
callback = function()
vim.opt_local.syntax = 'dockerfile'
end
}
},
{
pattern = { '*.blade.php' },
callback = function()
vim.opt_local.syntax = 'html'
end
},
},
VimLeave = {
-- Save session on exit
{
command = [[mksession! ~/.cache/nvim/session/shutdown_session.vim]]
-- Save session on exit
callback = function()
require('retrospect').SaveSession()
end,
},
},
}


Loading…
Cancel
Save