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