-
Notifications
You must be signed in to change notification settings - Fork 30
/
convenience
62 lines (50 loc) · 1.58 KB
/
convenience
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
" Convience - configs & mappings to smooth out rough edges and make vim feel like home
" Move between wrapped lines, rather than jumping over wrapped segments
nmap j gj
nmap k gk
" Use C-Space to Esc out of any mode
nnoremap <C-Space> <Esc>:noh<cr>
vnoremap <C-Space> <Esc>gV
onoremap <C-Space> <Esc>
cnoremap <C-Space> <C-c>
inoremap <C-Space> <Esc>
" Terminal sees <C-@> as <C-space>
nnoremap <C-@> <Esc>:noh<cr>
vnoremap <C-@> <Esc>gV
onoremap <C-@> <Esc>
cnoremap <C-@> <C-c>
inoremap <C-@> <Esc>
nnoremap <leader>cc :ClearEmAll<cr>
command! ClearEmAll call s:ClearEmAll()
function! s:ClearEmAll()
nohlsearch
cclose
pclose
lclose
" call coc#util#float_hide()
call popup_clear()
endfunction
" Quick sourcing of the current file, allowing for quick vimrc testing
nnoremap <leader>sop :source %<cr>
nnoremap <leader>df :Files ~/code/dotfiles<cr>
nnoremap <leader>; :
nmap <leader>bi :PlugInstall<cr>
" Q for Ex mode is useless. This will run the macro in q register
nnoremap Q @q
" Swap 0 and ^. I tend to want to jump to the first non-whitespace character
" so make that the easier one to do.
nnoremap 0 ^
nnoremap ^ 0
augroup vimrcEx
autocmd!
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" Switch between the last two files
nnoremap <leader><leader> <c-^>
" vim:ft=vim