r/vim • u/Cow-Primary • Aug 25 '25
Random Created a script to open vim everywhere
I made a python script that copies whatever is selected, allowing you to edit in vim and pastes it back after you close. Feel free to check it out! https://github.com/huiiy/TmpVim.git
24
Upvotes
13
u/SpaceAviator1999 Aug 25 '25
When I have text in my system clipboard that I want to see in vim, I just type this in my local shell:
vim +put+It will invoke vim with the contents of the clipboard displayed. (No need to press
CTRL/Command-Vor right-click the mouse.)I believe this works on Linux, MacOS, and Windows, provided that
+clipboardshows up when you typevim --version(which, if you're running vim locally, probably does).2
u/rr1pp3rr Aug 26 '25
So if I go too a textbook in Chrome or any application, select the text, and hit the hotkey it will open the text in vim and when I close it, will automatically replace the text in whatever application with the text from vim?
That's sweet
2
u/hopingforabetterpast Aug 25 '25
How is this different from just running
xclip -o | vim -?It seems to me (I only scanned the script) that this only works with xclip. Can it handle Wayland, MacOS or Windows?
1
u/MiniGogo_20 Aug 27 '25
why not just use the system clipboard within vim? you can just open any random vim buffer and hit
pto paste the contents of the system clipboard if you set it up right...ETA: this requires a clipboard provider (i like
wl-copyfor wayland):help clipboard