dotfiles/.vimrc.keymap

53 lines
1.2 KiB
Plaintext
Raw Normal View History

2019-02-22 15:50:11 +00:00
" key mappings
let mapleader = ","
2019-02-24 10:59:51 +00:00
noremap <Leader>s :update<CR>
2019-02-22 15:50:11 +00:00
nmap <leader>p :set paste!<CR>
nmap <leader>h :set hlsearch!<CR>
nmap <leader>t :wa <bar> :Make test<CR>
" navigate buffers by ctrl-b
nmap <C-b> :bprevious<CR>
2019-02-22 16:08:40 +00:00
nmap <C-B> :bnext<CR>
2019-02-22 15:50:11 +00:00
nnoremap ; :
" no cheating !
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" for damaged keyboards
map <F1> <Esc>
imap <F1> <Esc>
" special chars
nmap <leader>l :set list!<CR>
" search
nnoremap <leader>v :FzfFiles<cr>
nnoremap <leader>u :FzfTags<cr>
nnoremap <leader>j :call fzf#vim#tags("'".expand('<cword>'))<cr>
nnoremap <leader>/ :Find
2019-02-22 16:08:40 +00:00
nnoremap <leader>' :execute "Find " . expand("<cword>")<cr>
" tree
map <leader>n :NERDTreeToggle<CR>
2019-02-23 09:15:44 +00:00
" completion
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
imap <c-space> <Plug>(asyncomplete_force_refresh)
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"