vim-workspace icon indicating copy to clipboard operation
vim-workspace copied to clipboard

Extra empty undo action

Open bollian opened this issue 5 years ago • 2 comments

vim-workspace seems to be creating an extra, empty undo action.

Every time I make a change using insert mode and try to undo it, I find that I have to perform two undo actions. The first time I hit u, a message shows up on the bottom of my screen saying 0 changes; before #14; 1 seconds ago (obviously the #14 changes between invocations), and the edits I just made remain. Then I press u a second time, and the changes are undone. My expected behavior is that I should only have to press u once to remove the edit I just made.

Is this a bug, or is there some feature here that I'm just not aware of? I just installed this plugin because I'm very interested in the persistent undo feature, so please let me know if there's something I'm missing.

This only happens while I have a workspace active. I've also verified that the problem persists even when I disable persistent undo history with let g:workspace_persist_undo_history = 0. This problem doesn't occur when I make a change using d, x, or r, but it does occur when I enter insert mode using c.

I'm running neovim version 0.3.8.

bollian avatar Jan 14 '20 20:01 bollian

I have set let g:workspace_persist_undo_history = 0 to not use this plugin's persistent undo feature. Instead I have set undodir=~/.config/nvim/undodir//,.nvim/undo//,. to use (neo)vim's :help persistent-undo feature for all files. I use undotree for manipulating the history of my file.

Note that, you may wish to cleanup the undodir once in a while though as noted in this blog

@thaerkh - I was curious to know why the undodir logic was created in the plugin. Would it be possible for you to help me understand the rationale behind it?

wadkar avatar Feb 22 '20 15:02 wadkar

I had to also disable untrailspaces and untrailtabs to get rid of these empty undo actions completely.

janbuchar avatar Oct 08 '20 06:10 janbuchar