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
A satisfactory workaround could be a way for vim dynamically detect the error and then change the store path for a local aside the current file.
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.