Skip to content

Instantly share code, notes, and snippets.

@Anachron
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save Anachron/c7f984de395b8223b6bb to your computer and use it in GitHub Desktop.

Select an option

Save Anachron/c7f984de395b8223b6bb to your computer and use it in GitHub Desktop.
Tired of learning VIM on a non-US keyboard with complicated key-combinations that feel weird? Feel like key combinations should be intuitive and based on where the keys are? This file contains a lot of mappings for smart and fast movement. You'll find out there is a lot of thoughts inside the choosen combination.
" =======================
" Character movement
" =======================
" first character
noremap Q gg
" previous character
noremap a h
" next character
noremap d l
" last character
noremap E G$
" =======================
" Word movement
" =======================
" previous word
noremap q b
" next word
noremap e w
" =======================
" Line movement
" =======================
" first line
"noremap W gg
" 10 lines up
noremap <C-R> 10k
" previous line
noremap w k
" beginning of line
noremap A 0
" end of line
noremap D $
" next line
noremap s j
" 10 lines down
noremap <C-F> 10j
" last line
"noremap S G
" =======================
" Code movement
" =======================
" switch between brackets
noremap r %
" goto declaration (C-Space)
noremap <Nul> gd
" =======================
" Screen movement
" =======================
" move one page up
noremap W <C-B>
" move one page down
noremap S <C-F>
" goto screen top
noremap <C-J> H
" goto screen middle
noremap <C-K> M
" goto screen bottom
noremap <C-L> L
" =======================
" Paragraph & similiar movement
" =======================
" goto paragraph start or previous paragraph
noremap T {
" goto previous word matching selection
noremap t #
" goto next word matching selection
noremap z *
" goto paragraph end or next paragraph
noremap Z }
" =======================
" Buffer movement
" =======================
" previous buffer
noremap <silent> <Tab> :bp<Enter>
" next buffer
noremap <silent> <S-Tab> :bn<Enter>
" =======================
" Forbid arrow movement
" =======================
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
noremap <Enter> <NOP>
" =======================
" Cut, copy, paste
" =======================
" yank to beginning of line
noremap j y0
" paste before cursor
noremap J P
" yank word
noremap k yw
" yank line
noremap K yy
" yank to end of line
noremap l y$
" paste after cursor
noremap L p
" =======================
" Undo, redo
" =======================
" undo all
"noremap U :u1|u
" undo
"nmap u u
" redo
noremap i <C-R>
" repeat change
"noremap I .
" =======================
" Mode management
" =======================
" normal mode
" noremap <C-A>
" insert mode
nnoremap y <Esc>i
" visual mode
nnoremap x <Esc>v
" =======================
" Splitting window
" =======================
" horizontal splitting
"nnoremap <C-W> :vsplit<ENTER>
" vertical splitting
"nnoremap <C-S> <C-W><C-H>
" =======================
" Searching
" =======================
" open search
noremap <silent> <Space> /
" search backwards
noremap <silent> c N
" search forwards
noremap <silent> v n
" =======================
" Moving / Copying
" =======================
" Copy line up
noremap <C-B> yyP
" Move line up
noremap B ddkP
" Move word left
noremap b diwbp
" Duplicate word
noremap n ywPb
" Duplicate line
noremap N yyp
" Move word right
noremap m diwwp
" Move line down
noremap M ddp
" Copy line down
noremap <C-m> yyp
" =======================
" Deletion
" =======================
" delete previous line
noremap <C-A> kdd
" delete until line-start
noremap <C-Q> d0
" delete character on left
noremap <BS> x
" delete whole line
noremap <C-S> dd
" delete character on right
" noremap <Del>
" delete until line-end
noremap <C-E> D
" delete next line
noremap <C-D> jdd
" =======================
" Marks & Macros
" =======================
" Create mark
noremap O m
" Goto mark
noremap o '
" Delete mark
noremap <C-O> :delmarks
" Start/Finish macro recording
noremap P q
" Run macro
noremap p @
" Delete macro
" =======================
" File Handling
" =======================
" save file
noremap <C-Y> :w!<Enter>
" close file
noremap <C-X> :q<Enter>
" =======================
" Other tools
" =======================
" exec shell command
noremap $ :!
" exec and read shell command
noremap = :r !
" exec something else
"noremap <silent> | :his<Enter>
" =======================
" Unite
" =======================
" Open file finder
noremap <silent> F :Unite file<ENTER>
" Open buffer finder
noremap <silent> R :Unite buffer<ENTER>
@Anachron

Copy link
Copy Markdown
Author

This is for german keyboards, for English I suggest to switch Z with Y and other way around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment