Fandom

Vim Tips Wiki

Mappings to facilitate the creation of text

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 154 Printable Monobook Previous Next

created November 5, 2001 · complexity basic · author Suresh Govindachar · version 6.0


"
" Mappings to facilitate the creation of text
"
" Author: Suresh Govindachar
" 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.

"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>.

CommentsEdit

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

I gather the above comment is a disparaging remark suggesting that only a novice would use Vim as suggested by the tip. I totally agree. What are we going to do with this page? Someone found it useful, but by keeping it we are suggesting to readers that this kind of thing is worth studying. Adding a dodgy tag is not sufficient. I'll contemplate a radical plan like redirecting it to Tutorial. JohnBeckett 10:25, April 18, 2012 (UTC)

Also on Fandom

Random Wiki