blob: c5dfaed45d04a24ab915621ed6976b070af9864b (
plain) (
blame)
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
|
" dotfiles -- .vim/vimrc_files/keymaps.vim
" author: johannst
" set leader key
let mapleader=","
"remap esc button
imap jj <Esc>
" prevent quit accidentlty
map :q :close
map :wq :w
noremap :qq :q
noremap <leader>d :bd<CR>
" re-adjust indentation
map <fi> mzgg=G`z
"let ArrowDisableMessage = "Arrow Keys disabled! Better learn hjkl ;)"
" Disable arrow keys -- train jklh
" nnoremap <Left> :echo ArrowDisableMessage<CR>
" nnoremap <Right> :echo ArrowDisableMessage<CR>
" nnoremap <Up> :echo ArrowDisableMessage<CR>
" nnoremap <Down> :echo ArrowDisableMessage<CR>
"
" vnoremap <Left> :<c-u>echo ArrowDisableMessage<CR>
" vnoremap <Right> :<c-u>echo ArrowDisableMessage<CR>
" vnoremap <Up> :<c-u>echo ArrowDisableMessage<CR>
" vnoremap <Down> :<c-u>echo ArrowDisableMessage<CR>
"
" inoremap <Left> <c-o>:echo ArrowDisableMessage<CR>
" inoremap <Right> <c-o>:echo ArrowDisableMessage<CR>
" inoremap <Up> <c-o>:echo ArrowDisableMessage<CR>
" inoremap <Down> <c-o>:echo ArrowDisableMessage<CR>
" ctrl-hjkl move in insert mode
inoremap <c-h> <Left>
inoremap <c-j> <Down>
inoremap <c-k> <Up>
inoremap <c-l> <Right>
" ctrl-jk movement in command window
cnoremap <c-h> <Left>
cnoremap <c-j> <Down>
cnoremap <c-k> <Up>
cnoremap <c-l> <Right>
" navigate between different splits
map <c-Down> <c-w>j
map <c-Up> <c-w>k
map <c-Right> <c-w>l
map <c-Left> <c-w>h
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" navigate between different buffers
nnoremap <S-Left> :bprevious<CR>
nnoremap <S-Right> :bnext<CR>
nnoremap <S-h> :bprevious<CR>
nnoremap <S-l> :bnext<CR>
" ctrl-ae jump to line start/end
nnoremap <c-a> 0
nnoremap <c-e> $
inoremap <c-a> <c-o>0
inoremap <c-e> <c-o>$
vnoremap <c-a> 0
vnoremap <c-e> $
" Shortcut to toggle relative numbering mode
nnoremap <c-n> :call ToggleRelativeNumber()<CR>
" Open BufferExplorer
nnoremap <C-b> :call BufExplorer()<CR>
" invoke grep and print output into current buffer
nnoremap <C-g> :read !grep -nI
" substituce selection
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
|