Pasting to cliipboard, VimForum: DSL Tips and Tricks Topic: Pasting to cliipboard, Vim started by: jpeters Posted by jpeters on Nov. 26 2007,00:17
After fruitlessly searching for commands to yank to clipboard (instead of buffer), I discovered ":set nonumber" which removes line numbers so that I can highlight (which copies to clipboard) and paste without having to edit out all the numbers. ":set number" restores the line numbers. Perhaps there's a command I don't know which sends yanked lines to clipboard without highlighting?
Posted by ^thehatsrule^ on Nov. 26 2007,00:26
In vim's buffer? You can use "y" in command mode.
Posted by jpeters on Nov. 26 2007,00:43
That doesn't copy to the clipboard (i.e., for pasting into another editor, browser, etc.) Posted by curaga on Nov. 26 2007,16:48
Well the clipboard is an X function, so a console app can't interface with it at all..
Posted by ^thehatsrule^ on Nov. 26 2007,17:16
Not really clear on what you want...Is this just for X where you don't want to use the mouse? or is this from tty to tty? or tty to X? Do you not want to highlight at all (either with a mouse or keyboard) but yank by lines? or the whole contents of a file? There are some easier ways, depending on how your current setup is. In any case, you may be interested in screen and xsel, among others. Posted by mikshaw on Nov. 26 2007,18:04
I think the question posed is "Is there a better way?" Personally I often use the mouse to copy and paste from Vim to X apps, because I don't know of a better way. For example, it doesn't work when your text is not all in view...when scrolling the text is deselected, so I copy, paste, scroll, copy, paste. Posted by jpeters on Nov. 26 2007,19:15
If we had a gui version, we could add a scroll bar (set guioptions+=r) and copy more than text in view. It's rare that I have to this, however, and I'm happy that I found a way to turn the line numbers on and off. Posted by jpeters on Nov. 26 2007,21:11
I just compiled vim 7.1 with --enable-gui=gtk. In visual mode (type "v") you can highlight the entire file scrolling up with the arrow keys. This effectively copies to clipboard. Nice! < http://jpeters.net/apps/ > to run: /usr/local/bin/vim or /usr/local/bin/vimdiff (vimdiff -> vim) Posted by jpeters on Nov. 26 2007,23:49
even better.....with 7.1 you can enter visual mode (v) and go to a previously marked line (e.g., 'c). It's all highlighted and on the clipboard for pasting into another file (and without line numbers).edit: 7.1 also has standard cntrl-c, cntrl-v cut and paste functions to clipboard. edit: also has spellcheck. Posted by jpeters on Nov. 27 2007,09:11
...changed dsl to unc extension, and left in docs (F1 for help menu)< http://jpeters.net/apps/ > Edit: Added mydsl.menu |