Wikia

Vim Tips Wiki

Mappings to facilitate the creation of text

Talk0
1,613pages on
this wiki
Revision as of 07:35, April 18, 2012 by 83.25.38.77 (Talk)

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>.
  • misiu, masz niedojebany mózg przez vima, że musisz tyle robić w trybie insert

Comments

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

Around Wikia's network

Random Wiki