Skip to content

Instantly share code, notes, and snippets.

@tsuyoshicho
Created April 2, 2020 06:01
Show Gist options
  • Save tsuyoshicho/c925d66533305e60a84edc00afae7f94 to your computer and use it in GitHub Desktop.
Save tsuyoshicho/c925d66533305e60a84edc00afae7f94 to your computer and use it in GitHub Desktop.
" install vim-pulg
if has('vim_starting')
set rtp+=~/.vim/plugged/vim-plug
if !isdirectory(expand('~/.vim/plugged/vim-plug'))
echo 'install vim-plug...'
call mkdir(expand('~/.vim/plugged/vim-plug'), 'p')
call system('git clone https://github.com/junegunn/vim-plug.git ' . expand('~/.vim/plugged/vim-plug/autoload'))
end
endif
" setup
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-emoji.vim'
Plug 'prabirshrestha/asyncomplete-tags.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'mattn/vim-lsp-settings'
call plug#end()
" plugin setting - lsp
augroup LspMappings
au!
au FileType vim,python call s:lsp_common_mappings()
augroup END
function! s:lsp_common_mappings() abort
setlocal omnifunc=lsp#complete
nmap <buffer> K <Plug>(lsp-hover)
nmap <buffer> <silent> [g <Plug>(lsp-previous-diagnostic)
nmap <buffer> <silent> ]g <Plug>(lsp-next-diagnostic)
nmap <buffer> gd <Plug>(lsp-definition)
endfunction
inoremap <expr> <C-y> pumvisible() ? asyncomplete#close_popup() : "\<C-y>"
inoremap <expr> <C-e> pumvisible() ? asyncomplete#cancel_popup() : "\<C-e>"
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#emoji#get_source_options({
\ 'name': 'emoji',
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#emoji#completor'),
\ }))
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#tags#get_source_options({
\ 'name': 'tags',
\ 'whitelist': ['c','cpp'],
\ 'completor': function('asyncomplete#sources#tags#completor'),
\ 'config': {
\ 'max_file_size': 50000000,
\ },
\ }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment