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