How do I use Copy and Paste with Vim?

You should first check the output of the “:version” command and make sure that +xterm-clipboard is present. When running Vim in an xterm, you can either let Vim control the mouse or let xterm control the mouse. This is configured by the ‘mouse’ option. If the ‘mouse’ option is not set (or set to the default value), then Vim will not control the mouse. You cannot move the Vim text cursor using the mouse. When you select some text using the mouse, xterm will copy it to the X11 cut buffer. When you press both the mouse buttons, xterm will paste the text from the cut buffer. If the ‘mouse’ option is set to ‘a’ or some other value, then Vim controls the mouse. The mode (normal or insert or visual, etc) in which Vim controls the mouse is configured by the ‘mouse’ option. You can move the Vim text cursor using the mouse. When you select some text, the ‘clipboard’ option setting is used to determine whether to transfer the selected text to the clipboard or not. The default setting is to transfer the selected text to the clipboard. If you want to use the xterm selection mechanism in this mode, then you can press the <Shift> key. If you press <Shift> key when selecting text using the mouse, then Vim doesn’t control the mouse and xterm controls the mouse. In the GUI mode, Copy and Paste should just work, depending on the ‘mouse’ setting.

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind