]> git.sthu.org Git - vimconf.git/blob - keymaps.vim
bc6f51d547110ee3010ff132ad78b7bc56ef0887
[vimconf.git] / keymaps.vim
1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2 " Global settings
3
4 if has('clipboard')
5 " Ordinary ctrl+{c,x,v} using system clipboard register +. We use autocmd to
6 " override plugin keymaps.
7 autocmd VimEnter * vnoremap <C-c> "+y
8 autocmd VimEnter * vnoremap <C-x> "+x
9 autocmd VimEnter * nnoremap <C-v> "+p
10 autocmd VimEnter * inoremap <C-v> <c-r>+
11 endif
12
13 nnoremap <C-p> :Denite file/rec<cr>
14 nnoremap <space>/ :Denite grep:.<cr>
15 nnoremap <space>s :Denite buffer<cr>
16
17 nnoremap <C-space> pumvisible() ? "\<c-n>" : "\<tab>"
18
19 nnoremap <F2> :NERDTreeToggle<cr>
20 nnoremap <F3> :TagbarToggle<cr>
21
22 nmap <s-PageDown> :bn<CR>
23 nmap <s-PageUp> :bp<CR>
24
25 map <a-c> <plug>NERDCommenterToggle
26
27 imap <C-k> <Plug>(neosnippet_expand_or_jump)
28 smap <C-k> <Plug>(neosnippet_expand_or_jump)
29 xmap <C-k> <Plug>(neosnippet_expand_target)
30
31 " Start interactive EasyAlign in visual mode (e.g. vipga)
32 vmap <Enter> <Plug>(EasyAlign)
33 " Start interactive EasyAlign for a motion/text object (e.g. gaip)
34 nmap ga <Plug>(EasyAlign)
35
36
37 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
38 " Some filetype-specific settings
39
40 au Filetype gnuplot map <buffer> <F5> :call OpenIn("gnuplot -persist") <CR>
41
42 " Performs a vertial split and a FSHere. For a header file the split is
43 " performed to the left, for an implementation file to the right.
44 function FSvsplit()
45 " We split to the right on header files
46 if match(expand('%:e'), 'h.*') >= 0
47 execute ':leftabove vsplit'
48 else
49 execute ':rightbelow vsplit'
50 endif
51
52 execute ':FSHere'
53 endfunction
54
55 au Filetype c,cpp,objc map <buffer> <F11> :call FSvsplit()<CR>
56 " Terminal-based vi report S-F11 as F23
57 au Filetype c,cpp,objc map <buffer> <S-F11> :FSHere<CR>
58 au Filetype c,cpp,objc map <buffer> <F23> :FSHere<CR>
59
60 au Filetype markdown map <buffer> <F5> :call RunMarkdown()<CR>
61 au Filetype asciidoc map <buffer> <F5> :call RunAsciidoc()<CR>
62
63 " See https://github.com/artur-shaik/vim-Javacomplete2
64 " <C-j>ji <leader>ji
65 au FileType java nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
66 au FileType java imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
67 " <C-j>ii <leader>jii
68 au FileType java nmap <F5> <Plug>(JavaComplete-Imports-Add)
69 au FileType java imap <F5> <Plug>(JavaComplete-Imports-Add)
70 " <C-j>I <leader>jI
71 au FileType java nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
72 au FileType java imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
73 " <C-j>R <leader>jR
74 au FileType java nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
75 au FileType java imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
76
77
78 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
79 " Some plugin-specific settings
80
81
82
83 if filereadable($HOME . '/.vim/keymaps-local.vim')
84 source ~/.vim/keymaps-local.vim
85 endif