sponsor Vim development Vim logo Vim Book Ad

basic Tip #1387: Standard editing shotcuts

 tip karma   Rating -6/18, Viewed by 2211 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   November 14, 2006 14:34      complexity:   basic
author:   Lrkwz      as of Vim:   5.7

Having replaced notepad with gvim, these are my preferred editing shortcuts:

" Copy to 'clipboard registry'
vmap <C-C> "*y

" Search selected text
vmap / y/<C-R>"<CR>

" Select all text
nmap <C-A> 1G^vG$

 rate this tip  Life Changing Helpful Unfulfilling 

<< Make Vim completion popup menu work just like in an IDE | Vim and ocaml interpreter >>

Additional Notes

a.carah@gmail.com, November 15, 2006 2:29
   vmap / y/<C-R>"<CR>
would face problems with special symbols.

Another mapping I saw elsewhere may help with that
vmap  // y/<C-R>=substitute(escape(@", '\\/.*$^~[]'), "\n", "\\\\n", "g")<CR>
dsm26@stanford.edu, November 15, 2006 8:09
Have you seen vim70/mswin.vim, it comes with Vim 7.0 (and prior versions).  It sets up a bunch of behavior that makes Vim work nice with Windows.  Just source it in your vimrc.  It's worth reading through for some ideas if you don't want to use the entire thing.
Anonymous, November 15, 2006 10:10
" Search selected text
"vmap / y/<C-R>"<CR>
" :help #, :help *

" Select all text
"nmap <C-A> 1G^vG$
nmap <C-A> ggVG
lx@ua.fm, November 16, 2006 0:59
AFAIK, '*' and '#' only work with keyword under/after cursor, not with selected text...
Anonymous, November 21, 2006 8:04
'*' and '#' can easily be configured to grab the current visual selection.

Read through http://www.vim.org/tips/tip.php?tip_id=1

It's very convenient.
Anonymous, January 31, 2007 14:48
vimtip #340 : Visual Select And Search
vimtip #1038: Search for selected text
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to vim@vim.org after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge.net Logo