-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvimrc-keymaps
96 lines (80 loc) · 2.54 KB
/
vimrc-keymaps
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"
" Fixing some horrible vim defaults
"
if arrowkeys == "off"
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
endif
nnoremap <silent> j gj
nnoremap <silent> k gk
" Remembering the line offset of a mark should be the norm
nnoremap ' `
nnoremap ` '
" Indent using tabs (while in visual mode)
vnoremap <silent> <tab> >gv
vnoremap <silent> <s-tab> <gv
vnoremap <silent> < <gv
vnoremap <silent> > >gv
" Search only in the selected block (visual mode)
vnoremap <silent> / <esc>/\%V
" Buffer horizontal traversal using C-j and C-k
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-k> <C-w>k
" Tabs uses c-l and c-h
map <silent> <C-h> <esc>:tabprevious<cr>
map <silent> <C-l> <esc>:tabnext<cr>
" Open new tab pushing ,t
nnoremap <silent> ,t <ESC>:tabnew<CR>
" Split helpers
map <silent> <leader>vw <C-w>v<C-w>l " Split vertically
map <silent> <leader>hw <C-w>s<C-w>l " Horizontally
map <silent> <leader>++ 100<C-w>+<Cr> " Increase buffer height
map <silent> <leader>== <C-w>=<Cr> " Recalculate buffers size
" Toggle line-numbering
nn <leader>n <esc>:set number! number?<cr>
" Nerd Tree
nmap <silent> <leader>o :NERDTreeToggle<cr>
nmap <silent> <leader>O :NERDTreeFind<cr>
" Omni autocomplete
inoremap <Nul> <C-x><C-o>
"
" Easy copy-paste from system clipboard
nnoremap <silent> ,p "+p
nnoremap <silent> ,P "+P
nnoremap <silent> ,y "+yy
" Smart home (go to real start of line)
nnoremap <silent> <Home> g^
if !has("gui_running")
" Save file by Ctrl+S
inoremap <silent> <C-S> <ESC>:w<CR>i
nnoremap <silent> <C-S> <ESC>:w<CR>i
vnoremap <silent> <C-S> <ESC>:w<CR>i
" Ctrl+Backspace, Ctrl+Delete word deletion
inoremap <silent> <C-Backspace> <ESC><right>dbi
inoremap <silent> <C-Delete> <ESC><right>dwi
" Tab navigation with Ctrl + Tabnum
ino <silent> <C-1> <ESC>:tabfirst<CR>
nno <silent> <C-1> <ESC>:tabfirst<CR>
ino <silent> <C-2> <ESC>2gt
nno <silent> <C-2> <ESC>2gt
ino <silent> <C-3> <ESC>3gt
nno <silent> <C-3> <ESC>3gt
ino <silent> <C-4> <ESC>4gt
nno <silent> <C-4> <ESC>4gt
ino <silent> <C-5> <ESC>5gt
nno <silent> <C-5> <ESC>5gt
ino <silent> <C-6> <ESC>6gt
nno <silent> <C-6> <ESC>6gt
ino <silent> <C-7> <ESC>7gt
nno <silent> <C-7> <ESC>7gt
ino <silent> <C-8> <ESC>8gt
nno <silent> <C-8> <ESC>8gt
ino <silent> <C-9> <ESC>:tablast<CR>
nno <silent> <C-9> <ESC>:tablast<CR>
endif