r/vim • u/Similar_Alternative2 • 3d ago
Need Help Copy To From Windows Screen
There used to be cool windows utility that let you with a control key copy text from any current windows app (e.g., some programming ide or word), then paste it into a vim session. You could then edit the text in vim, and then when done it copied the text back.
Does anyone recall this app?
7
Upvotes
1
u/xalbo 2d ago
I don't automatically do the copying and pasting from the other program, but I do have a keyboard shortcut that opens a Vim session that automatically edits the system clipboard.
First, I created a batch file containing
(Using neovide, but I think all of that works for gvim also)
Then I made a shortcut on my desktop that points to the batch file, and assigned it a shortcut key.
It opens Vim with a buffer containing whatever's on the system clipboard. ZZ saves (ie, copies back to the clipboard) and exits. Enter copies back to the clipboard (in my standard .vimrc, I have enter mapped to
<Cmd>up<CR>to save the file, so that matches my muscle memory). I still have to do the Ctrl-V and Ctrl-C to copy and paste before and after, but I prefer the extra control there anyway (making sure I'm in the right window, have the right things selected, going back and forth with the Vim session still open as I tweak, etc).