Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim undofile does not work when file is too long

Tags:

linux

vim

I use a vim persistent undo setup as follows, which have worked all that way here.

set undofile
set undodir=~/.vim/undodir

However now I'm facing a problem when the undofile became too long, notice that an undofile has a name in the form of absolute path like %home%user%directory%...%directory%file that means if your file has a big name, is under a big path directory or both, the chances for reaching the linux file name max length will be higher. In my case, when try to save the open file it raises the error:

E828: Cannot open undo file for writing: /home/user/.vim/undodir/%home%user%workspace%%app%javascript%packs%domains%components%grid%column_cell_factory%inspection_cell_factory.jsx

How can I manage in order to keep my persistent undo working even for these situations?

UPDATE

This is not my real filename, I removed username and others personal information intentionally, at the end they are not relevant and don't contain any special char. The file length is 160, and the whole path with the folder it should be stored is 189 length.

like image 582
intmarinoreturn0 Avatar asked Sep 10 '25 03:09

intmarinoreturn0


1 Answers

I ran into the same problem, but luckily, there is a plugin to solve this problem:

https://github.com/pixelastic/vim-undodir-tree

like image 65
apollo Avatar answered Sep 12 '25 16:09

apollo