sponsor Vim development Vim logo Vim Book Ad

basic Tip #154: Mappings to facilitate the creation of text

 tip karma   Rating 12/6, Viewed by 1869 

created:   November 5, 2001 12:38      complexity:   basic
author:   Suresh Govindachar      as of Vim:   6.0

"
" Mappings to facilitate the creation of text
"
" Author:  Suresh Govindachar [email protected]
" Date:     November 5, 2001
"
" While typing text to create a document, I often end up hitting
" <Esc>, issuing some commands (with or without ":") and getting back
" to typing by issuing a command such as "i", "O", "s" etc.
"
" I looked into using "set insertmode" to speed up such actions, but
" found that too confusing.
"
" I have come up with a set of mappings that have speeded up my process
" of creating documents.  I have saved these mappings in a file, named
" FullScreenVI.vim, in vim's plugin directory.
"
" Perhaps you will find these mappings helpful too.
"
" Please send me feedback.  
"

"To allow overriding the Alt key
set winaltkeys=no  
"To enable viewing messages from commands issued using the mappings presented here
set cmdheight=2    

"The fundamental mapping that makes full-screen editing possible
imap <A-o>  <C-o>
imap <A-;>  <C-o>:

"Basic motions
imap <A-h>  <Left>
imap <A-j>  <Down>
imap <A-k>  <Up>
imap <A-l>  <Right>
imap <A-f>  <PageDown>
imap <A-b>  <PageUp>
imap <A-^>  <Home>
imap <A-$>  <End>

"Numbers for repeats
imap <A-1>  <C-o>1
imap <A-2>  <C-o>2
imap <A-3>  <C-o>3
imap <A-4>  <C-o>4
imap <A-5>  <C-o>5
imap <A-6>  <C-o>6
imap <A-7>  <C-o>7
imap <A-8>  <C-o>8
imap <A-9>  <C-o>9

"Basic searches
imap <A-/>  <C-o>/
imap <A-*>  <C-o>*
imap <A-#>  <C-o>#
imap <A-n>  <C-o>n
imap <A-N>  <C-o>N

"Deleting
imap <A-x>  <C-o>x
imap <A-d>  <C-o>d
imap <A-D>  <C-o>D

"Yanking and putting
imap <A-y>  <C-o>y
imap <A-Y>  <C-o>Y
imap <A-p>  <C-o>p
imap <A-P>  <C-o>P

"Common prefixes:  marking, matching etc.
imap <A-~>  <C-o>~
imap <A-m>  <C-o>m
imap <A-`>  <C-o>`
imap <A-">  <C-o>"
imap <A-%>  <C-o>%
imap <A-h>  <C-o>:h
imap <A-s>  <C-o>:s

"Interacting with the 'outside'
imap <A-!>  <C-o>:!
imap <A-w>  <C-o>:w<CR>
imap <A-e>  <C-o>:e

"Other commands
imap <A-u>  <C-o>u
imap <A-.>  <C-o>.

 rate this tip  Life Changing Helpful Unfulfilling 

<<Making Parenthesis And Brackets Handling Easier | Decompile Java .class files automatically >>

Additional Notes

Anonymous, November 7, 2001 4:07
BUG:
In the section "Common prefixes:  marking, matching etc.":
          imap <A-h>  <C-o>:h  
conflicts with the "move to left" command;  the preceding
could be changed to:
          imap <A-H>  <C-o>:h

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 [email protected] after searching the archive. Help Bram help Uganda.
    stats
Sponsored by Web Concept Group Inc. SourceForge.net Logo