add lsp keymaps

This commit is contained in:
Cyryl Płotnicki 2019-02-24 12:54:41 +00:00
parent ad38697845
commit f655bf4ddf
2 changed files with 18 additions and 13 deletions

View file

@ -1,6 +1,6 @@
" key mappings " key mappings
let mapleader = "," let mapleader = ","
noremap <Leader>s :update<CR> nmap <Leader>s :update<CR>
nmap <leader>p :set paste!<CR> nmap <leader>p :set paste!<CR>
nmap <leader>h :set hlsearch!<CR> nmap <leader>h :set hlsearch!<CR>
nmap <leader>t :wa <bar> :Make test<CR> nmap <leader>t :wa <bar> :Make test<CR>
@ -24,22 +24,20 @@ imap <F1> <Esc>
" special chars " special chars
nmap <leader>l :set list!<CR> nmap <leader>l :set list!<CR>
" search " search/navigate project structure
nnoremap <leader>v :FzfFiles<cr> nmap <leader>/ :LspWorkspaceSymbol<CR>
nnoremap <leader>u :FzfTags<cr> nmap <leader>r :LspReferences<CR>
nnoremap <leader>j :call fzf#vim#tags("'".expand('<cword>'))<cr> nmap <leader>d :LspDeclaration<CR>
nnoremap <leader>/ :Find nmap <leader>D :LspDefinition<CR>
nnoremap <leader>' :execute "Find " . expand("<cword>")<cr> nmap <leader><CR> :LspCodeAction<CR>
" tree " tree
map <leader>n :NERDTreeToggle<CR> map <leader>n :NERDTreeToggle<CR>
" completion " quickfix
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" nmap <leader>q <Plug>window:quickfix:toggle
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
imap <c-space> <Plug>(asyncomplete_force_refresh)
" completion
function! s:check_back_space() abort function! s:check_back_space() abort
let col = col('.') - 1 let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s' return !col || getline('.')[col - 1] =~ '\s'
@ -49,4 +47,9 @@ inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" : \ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" : \ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh() \ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
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)

View file

@ -9,6 +9,8 @@ call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'cespare/vim-toml' Plug 'cespare/vim-toml'
Plug 'Chiel92/vim-autoformat'
Plug 'drmingdrmer/vim-toggle-quickfix'
Plug 'godlygeek/tabular' Plug 'godlygeek/tabular'
Plug 'https://github.com/cyplo/vim-colors-solarized.git' Plug 'https://github.com/cyplo/vim-colors-solarized.git'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'