Reputation: 28080
I had rather a lot of text on my clipboard whenever I accidentally right clicked inside Putty (with Vim open), and Vim has initiated a paste operation which has been going for around ten minutes now.
I don't want to lose my unsaved work, is there a way to instruct Vim to stop pasting text?
Upvotes: 17
Views: 8246
Reputation: 41
I know this is really old but the top answer is not right and I was clearly having a similar issue to OP. (accidentally pasted like a million lines of json into vim)
Keep in mind this may not allow you to save your work (but you can probably salvage something from the .swp file)
All you need to do is open a new terminal window and enter pkill vim
into the command line.
Upvotes: 4
Reputation: 185831
Depending os your vim configuration, there's chances that you have a swap file (backup) in .nameOfTheOpenedFile.swp
(substitute nameOfTheOpenedFile with the name for your file).
To recover the file :
vim -r .nameOfTheOpenedFile.swp
Upvotes: 0
Reputation: 35218
If you're in normal mode, Ctrl-C aborts the current command in progress. Then press u to undo anything that changed before you stopped it.
Upvotes: 9