vimrc key remappings. jk as esc and navigate by row, not line
David Blume

David Blume commited on 2018-05-12 13:12:33
Showing 1 changed files, with 14 additions and 4 deletions.

... ...
@@ -1,4 +1,4 @@
1
-" Version 2018-04-29.1 - Turn off vim-airline whitespace warnings by filetype
1
+" Version 2018-05-12.1 - jk and remove comments on same line as remaps
2 2
 set nocompatible    " Use Vim defaults, forget compatibility with vi.
3 3
 set bs=2            " allow backspacing over everything in insert mode
4 4
 set wildmenu        " Allows command-line completion with tab
... ...
@@ -23,7 +23,17 @@ endif
23 23
 nnoremap / /\v
24 24
 vnoremap / /\v
25 25
 
26
-" nnoremap <cr> :noh<cr><cr>     " clear search highlights
26
+" Make j and k move to the next row, not file line
27
+nnoremap j gj
28
+nnoremap k gk
29
+
30
+" From Steve Losh: http://learnvimscriptthehardway.stevelosh.com/chapters/10.html
31
+" Map jk to ESC in insert mode
32
+inoremap jk <esc>
33
+" inoremap kj <esc>
34
+
35
+" clear search highlights
36
+nnoremap <cr> :noh<cr><cr>
27 37
 
28 38
 " Commented out because I want tags searches to always be case sensitive.
29 39
 " Override with \c anywhere in your search.
... ...
@@ -117,8 +127,8 @@ nmap <leader>bd :Bdelete<cr>              " install vim-bbye
117 127
 vnoremap <leader>s :sort<cr>
118 128
 
119 129
 "easier moving of code blocks
120
-vnoremap < <gv  " better indentation
121
-vnoremap > >gv  " better indentation
130
+vnoremap < <gv
131
+vnoremap > >gv
122 132
 
123 133
 " If too many file system events are getting triggered.
124 134
 set nobackup       " ~ files
125 135