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