-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmappings.vim
More file actions
79 lines (63 loc) · 1.84 KB
/
mappings.vim
File metadata and controls
79 lines (63 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
" Mappings ----------------------------
" Use ; for commands
nnoremap ; :
" Go to beginning of line
nnoremap H ^
" Go to end of line
nnoremap L $
" Go to beginning of line
vnoremap H ^
" Go to end of line
vnoremap L $
inoremap jj <Esc> " Map jj to ESC
inoremap kk <Esc> " Map kk to ESC
nnoremap Y y$ " act like D and C, i.e. to yank until EOL
nnoremap Q gq " dont use Ex mode, use Q for formatting
nnoremap ! :!
" Disable arrow keys in normal mode
nnoremap <Left> <NOP>
nnoremap <Right> <NOP>
nnoremap <Up> <NOP>
nnoremap <Down> <NOP>
" Resize splits using Ctrl + arrow keys
nnoremap <C-Up> <C-W>-
nnoremap <C-Down> <C-W>+
nnoremap <C-Left> 5<C-W><
nnoremap <C-Right> 5<C-W>>
" Improve window movement
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Keep visual mode after indenting
xnoremap < <gv
xnoremap > >gv
" Comment a line/block
nmap <leader>c gcc
xmap <leader>c gc
" Appends an edit command with the path of the currently edited file filled in
nnoremap <leader>e :e <C-R>=expand('%:p:h') . '/'<CR>
" Clear search highlight hitting space twice
nnoremap <silent> <space><space> :noh<CR>
nnoremap <leader>w :w<CR> " Save
nnoremap <leader>q :q<CR> " Quit
nnoremap <leader>v :vsp<CR> " New vertical window
nnoremap <leader>s :sp<CR> " New horizontal window
if exists(':Files')
nnoremap <silent> <C-p> :Files<CR>
endif
if exists(':BufSurfBack')
nnoremap <silent> <Tab> :BufSurfBack<CR> " Previous buffer
nnoremap <silent> <S-Tab> :BufSurfForward<CR> " Next buffer
else
nnoremap <silent> <Tab> :bprevious<CR>
nnoremap <silent> <S-Tab> :bnext<CR>
endif
nnoremap <C-c> :bnext\|bdelete #<CR>
if exists(':NERDTreeToggle')
nnoremap <leader>0 :NERDTreeToggle<CR>
else
nnoremap <leader>0 :Lexplore<CR>
endif
" recursively open/close current fold
nnoremap <leader>t zA