add persistent undo functionality to both neovim and vim

This commit is contained in:
2025-10-09 18:42:16 +02:00
parent 71ba1dce14
commit 1d8df9d310
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -70,6 +70,12 @@ vim.cmd [[
set errorformat^=[----]\ %f:%l:\ %m
]]
vim.o.undofile = true
vim.o.undodir = vim.fn.expand("~/.vim/neoundodir")
if vim.fn.isdirectory(vim.o.undodir) == 0 then
vim.fn.mkdir(vim.o.undodir, "p")
end
vim.keymap.set('n', ',cf', function()
local qf = vim.fn.getqflist()
for i, item in ipairs(qf) do
+7
View File
@@ -33,6 +33,13 @@ nnoremap H ^
nnoremap L $
set autoindent
set cursorline
set undofile
set undodir=~/.vim/undodir
if !isdirectory(expand('~/.vim/undodir'))
call mkdir(expand('~/.vim/undodir'), 'p')
endif
set undodir=~/.vim/undodir
set undofile
set errorformat^=[----]\ %f:%l:\ %m
set expandtab
set exrc