One of the nicer features in MacVim is that it is possible to use the usual OS commands for copying and pasting text (namely command+C and command+V) in it.
This is especially nice in situations when you’ve worked in another editor just a minute before and your brain isn’t ready yet to advise your fingers on how to type the real thing.
However, there’s one thing my brain needs to do quite a little thinking on: It’s the text selecting mode. In non-vi editors, I’d use Shift+Arrow for this and trying this in MacVim doesn’t work. But on the other hand it does not look to me that Shift+Arrow is being used for anything else either. Is it possible to remap the keys in order to make this possible?
(Ideally, the editor would still be in insertion mode after having selected the text; that would spare some additional key strokes.)
If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.
Press v to begin character-based visual selection, or V to select whole lines, or Ctrl-v or Ctrl-q to select a block.
Press 1 to highlight the current visually selected text, or the current word (if nothing is selected). Highlight group hl1 is used. Press 2 for highlight hl2 , 3 for highlight hl3 , etc. Press 0 to remove all highlights from the current visually selected text, or the current word.
You can use a movement command or up, down, right, and left arrow keys. Press y to copy, or d to cut the selection. Move the cursor to the location where you want to paste the contents. Press P to paste the contents before the cursor, or p to paste it after the cursor.
From the manual:
Text editors on Mac OS X lets the user hold down shift+movement key to extend the selection. Also, pressing a printable key whilst selecting replaces the current selection with that character. MacVim can emulate this kind of behaviour (by providing key bindings and by setting 'keymodel' and 'selectmode' to non-default values) although it is not enabled by default. To make MacVim behave more like TextEdit and less like Vim, add the following lines to your "~/.vimrc" (not .gvimrc) file:
if has("gui_macvim") let macvim_hig_shift_movement = 1 endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With