Configured LanguageClient and much more stuff
This commit is contained in:
parent
51169599fd
commit
a52a3add47
19 changed files with 271 additions and 1052 deletions
30
.gitmodules
vendored
30
.gitmodules
vendored
|
@ -10,9 +10,6 @@
|
|||
[submodule "pack/plugins/opt/onedark.vim"]
|
||||
path = pack/plugins/opt/onedark.vim
|
||||
url = https://github.com/joshdick/onedark.vim
|
||||
[submodule "pack/plugins/start/tsuquyomi"]
|
||||
path = pack/plugins/start/tsuquyomi
|
||||
url = https://github.com/Quramy/tsuquyomi.git
|
||||
[submodule "pack/plugins/start/typescript-vim"]
|
||||
path = pack/plugins/start/typescript-vim
|
||||
url = https://github.com/leafgarland/typescript-vim.git
|
||||
|
@ -25,33 +22,36 @@
|
|||
[submodule "pack/plugins/start/i3config.vim"]
|
||||
path = pack/plugins/start/i3config.vim
|
||||
url = https://github.com/mboughaba/i3config.vim.git
|
||||
[submodule "pack/plugins/start/vim-go"]
|
||||
path = pack/plugins/start/vim-go
|
||||
url = https://github.com/fatih/vim-go.git
|
||||
[submodule "pack/plugins/start/suda.vim"]
|
||||
path = pack/plugins/start/suda.vim
|
||||
url = https://github.com/lambdalisue/suda.vim
|
||||
[submodule "pack/plugins/start/vim-dirvish"]
|
||||
path = pack/plugins/start/vim-dirvish
|
||||
url = https://github.com/justinmk/vim-dirvish
|
||||
[submodule "pack/plugins/start/ensime-vim"]
|
||||
path = pack/plugins/start/ensime-vim
|
||||
url = https://github.com/ensime/ensime-vim
|
||||
[submodule "pack/plugins/start/vim-fugitive"]
|
||||
path = pack/plugins/start/vim-fugitive
|
||||
url = https://github.com/tpope/vim-fugitive
|
||||
[submodule "pack/plugins/start/gitignore.vim"]
|
||||
path = pack/plugins/start/gitignore.vim
|
||||
url = https://github.com/vim-scripts/gitignore.vim
|
||||
[submodule "pack/plugins/start/sbt-vim"]
|
||||
path = pack/plugins/start/sbt-vim
|
||||
url = https://github.com/ktvoelker/sbt-vim
|
||||
[submodule "pack/plugins/start/syntastic"]
|
||||
path = pack/plugins/start/syntastic
|
||||
url = https://github.com/vim-syntastic/syntastic
|
||||
[submodule "pack/plugins/start/ListToggle"]
|
||||
path = pack/plugins/start/ListToggle
|
||||
url = https://github.com/Valloric/ListToggle
|
||||
[submodule "pack/plugins/start/unimpaired"]
|
||||
path = pack/plugins/start/unimpaired
|
||||
url = https://tpope.io/vim/unimpaired.git
|
||||
[submodule "pack/plugins/start/nvim-yarp"]
|
||||
path = pack/plugins/start/nvim-yarp
|
||||
url = https://github.com/roxma/nvim-yarp
|
||||
[submodule "pack/plugins/start/ncm2"]
|
||||
path = pack/plugins/start/ncm2
|
||||
url = https://github.com/ncm2/ncm2
|
||||
[submodule "pack/plugins/start/LanguageClient-neovim"]
|
||||
path = pack/plugins/start/LanguageClient-neovim
|
||||
url = https://github.com/autozimu/LanguageClient-neovim
|
||||
[submodule "pack/plugins/start/fzf.vim"]
|
||||
path = pack/plugins/start/fzf.vim
|
||||
url = https://github.com/junegunn/fzf.vim
|
||||
[submodule "pack/plugins/start/syntastic"]
|
||||
path = pack/plugins/start/syntastic
|
||||
url = https://github.com/vim-syntastic/syntastic
|
||||
|
|
1
doc/LanguageClient.txt
Symbolic link
1
doc/LanguageClient.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../autostart/LanguageClient-neovim/doc/LanguageClient.txt
|
|
@ -1 +0,0 @@
|
|||
../autostart/ensime-vim/doc/ensime.txt
|
1
doc/ncm2.txt
Symbolic link
1
doc/ncm2.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../autostart/ncm2/doc/ncm2.txt
|
|
@ -1 +0,0 @@
|
|||
../autostart/syntastic/doc/syntastic-checkers.txt
|
|
@ -1 +1 @@
|
|||
../autostart/syntastic/doc/syntastic.txt
|
||||
/home/claudio/.config/nvim/autostart/syntastic/doc/syntastic.txt
|
|
@ -1 +0,0 @@
|
|||
../autostart/tsuquyomi/doc/tsuquyomi.txt
|
|
@ -1 +0,0 @@
|
|||
../autostart/vim-go/doc/vim-go.txt
|
152
init.vim
152
init.vim
|
@ -1,4 +1,90 @@
|
|||
" vim: set et sw=2 ts=2 tw=80 :
|
||||
"
|
||||
" Use "," as leader
|
||||
let mapleader = ","
|
||||
let maplocalleader = " "
|
||||
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{SyntasticStatuslineFlag()}
|
||||
set statusline+=%*
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
" LanguageClient-neovim
|
||||
let g:LanguageClient_serverCommands = {
|
||||
\ 'scala': ['metals-vim'],
|
||||
\ 'sbt': ['metals-vim'],
|
||||
\ 'python': ['pyls'],
|
||||
\ 'c': ['ccls'],
|
||||
\ 'go': ['go-langserver'],
|
||||
\ 'bash': ['bash-language-server']
|
||||
\ }
|
||||
|
||||
let g:LanguageClient_useVirtualText = 0
|
||||
|
||||
function! LC_maps()
|
||||
if has_key(g:LanguageClient_serverCommands, &filetype)
|
||||
nnoremap <buffer> <silent> <localleader>d
|
||||
\ :call LanguageClient#textDocument_definition()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>t
|
||||
\ :call LanguageClient#textDocument_typeDefinition()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>s
|
||||
\ :call LanguageClient#textDocument_documentSymbol()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>u
|
||||
\ :call LanguageClient#textDocument_references()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>r
|
||||
\ :call LanguageClient#textDocument_rename()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>i
|
||||
\ :call LanguageClient#textDocument_implementation()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>f
|
||||
\ :call LanguageClient#textDocument_formatting()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>h
|
||||
\ :call LanguageClient#textDocument_documentHighlight()<CR>
|
||||
nnoremap <buffer> <silent> <localleader>H
|
||||
\ :call LanguageClient#textDocument_clearDocumentHighlight()<CR>
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd FileType * call LC_maps()
|
||||
|
||||
" NCM2
|
||||
|
||||
" enable ncm2 for all buffers
|
||||
autocmd BufEnter * call ncm2#enable_for_buffer()
|
||||
|
||||
" IMPORTANT: :help Ncm2PopupOpen for more information
|
||||
set completeopt=noinsert,menuone,noselect
|
||||
|
||||
" suppress the annoying 'match x of y', 'The only match' and 'Pattern not
|
||||
" found' messages
|
||||
set shortmess+=c
|
||||
|
||||
" CTRL-C doesn't trigger the InsertLeave autocmd . map to <ESC> instead.
|
||||
inoremap <c-c> <ESC>
|
||||
|
||||
" Use <TAB> to select the popup menu:
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
|
||||
" wrap existing omnifunc
|
||||
" Note that omnifunc does not run in background and may probably block the
|
||||
" editor. If you don't want to be blocked by omnifunc too often, you could
|
||||
" add 180ms delay before the omni wrapper:
|
||||
" 'on_complete': ['ncm2#on_complete#delay', 180,
|
||||
" \ 'ncm2#on_complete#omni', 'csscomplete#CompleteCSS'],
|
||||
au User Ncm2Plugin call ncm2#register_source({
|
||||
\ 'name' : 'css',
|
||||
\ 'priority': 9,
|
||||
\ 'subscope_enable': 1,
|
||||
\ 'scope': ['css','scss'],
|
||||
\ 'mark': 'css',
|
||||
\ 'word_pattern': '[\w\-]+',
|
||||
\ 'complete_pattern': ':\s*',
|
||||
\ 'on_complete': ['ncm2#on_complete#omni', 'csscomplete#CompleteCSS'],
|
||||
\ })
|
||||
|
||||
" FILE MANAGER
|
||||
|
||||
|
@ -10,17 +96,6 @@ command! -nargs=? -complete=dir Vexplore leftabove vsplit | silent Dirvish <args
|
|||
|
||||
let g:dirvish_mode = ':sort ,^.*[\/],'
|
||||
|
||||
" SYNTASTIC
|
||||
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{SyntasticStatuslineFlag()}
|
||||
set statusline+=%*
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
" SETTINGS
|
||||
|
||||
if !has('nvim')
|
||||
|
@ -90,29 +165,6 @@ inoremap <S-tab> <C-d>
|
|||
tnoremap <Esc> <C-\><C-n>
|
||||
tnoremap <C-Esc> <Esc>
|
||||
|
||||
" activate autocompletion using `key` when under a 'keyword' char
|
||||
" (a-zA-Z + relevant characters for current language), otherwise just send TAB
|
||||
function! AutocompleteIfKeyword()
|
||||
let curcol = col('.') - 1 " column position before the cursor
|
||||
if !curcol " if at the beginning of the line
|
||||
return "\<tab>" " insert TAB character
|
||||
elseif getline('.')[curcol - 1] =~ '\k' " if current character is a 'keyword'
|
||||
return g:autocomplete_key " activate autocompletion for current word
|
||||
else " if the current char is not a 'keyword'
|
||||
return "\<tab>" " insert TAB characher
|
||||
end
|
||||
endfunction
|
||||
|
||||
" autocomplete using `key` with tab if cursor is under a 'keyword' char.
|
||||
" for <C-r>= see: https://stackoverflow.com/questions/10862457
|
||||
inoremap <silent> <tab> <C-r>=AutocompleteIfKeyword()<CR>
|
||||
|
||||
" use standard vim autocomplete as fallback
|
||||
let g:autocomplete_key = "\<C-N>"
|
||||
|
||||
" autocomplete with Tsuquyomi on TypeScript files
|
||||
autocmd FileType typescript let g:autocomplete_key = "\<C-x>\<C-o>"
|
||||
|
||||
" Automatically save folds for each file
|
||||
augroup AutoSaveFolds
|
||||
autocmd!
|
||||
|
@ -123,21 +175,11 @@ augroup END
|
|||
" clear search pattern with F2
|
||||
noremap <F2> :let @/ = ""<CR>
|
||||
|
||||
" Use "," as leader
|
||||
let mapleader = ","
|
||||
let maplocalleader = " "
|
||||
|
||||
" Git grep with Leader g
|
||||
nnoremap <Leader>g :Grepper -tool git<CR>
|
||||
|
||||
" Switch between Windows with: Leader w
|
||||
nnoremap <Leader>w <C-w><C-w>
|
||||
|
||||
" show next buffer with: leader n
|
||||
nnoremap <leader>n :bn<CR>
|
||||
|
||||
" show previous buffer with: leader n
|
||||
nnoremap <leader>p :bp<CR>
|
||||
" Open fzf with all files in git with: Leader f
|
||||
nnoremap <Leader>f :GFiles<CR>
|
||||
|
||||
" Fix indentation with: Leader i
|
||||
nnoremap <Leader>i mzgg=G`z
|
||||
|
@ -146,8 +188,6 @@ nnoremap <Leader>i mzgg=G`z
|
|||
nnoremap <Leader>d :bp\|bd #<CR>
|
||||
|
||||
" move to next tab with: Leader t
|
||||
nnoremap <Leader>t :tabnext<CR>
|
||||
nnoremap <Leader>T :tabprevious<CR>
|
||||
tnoremap <C-e> <C-\><C-n>:tabnext<CR>
|
||||
|
||||
" clear trailing spaces in file
|
||||
|
@ -178,12 +218,6 @@ let g:lt_quickfix_list_toggle_map = '<leader>q'
|
|||
" Insert in the end of file with Leader c
|
||||
nnoremap <Leader>c GA
|
||||
|
||||
" Go files: launch go lint quickfix with: Leader q
|
||||
autocmd FileType go nnoremap <Leader>q :w<CR>:GoLint<CR>
|
||||
|
||||
" TypeScript files: launch TypeScript lint quickfix with: Leader q
|
||||
autocmd FileType typescript nnoremap <Leader>q :TsuQuickFix<CR>
|
||||
|
||||
" COLORSCHEME
|
||||
|
||||
" set colorscheme to onedark.im for nvim and airline
|
||||
|
@ -199,16 +233,6 @@ filetype plugin indent on
|
|||
" Set up :make to use fish for syntax checking.
|
||||
autocmd FileType fish compiler fish
|
||||
|
||||
" ensime-vim setup
|
||||
silent autocmd FileType scala,java
|
||||
nnoremap <buffer> <localleader>t :EnType<CR> |
|
||||
nnoremap <buffer> <localleader>d :EnDocBrowse<CR> |
|
||||
nnoremap <buffer> <localleader>b :EnDeclaration<CR> |
|
||||
nnoremap <buffer> <localleader>u :EnUsages<CR> |
|
||||
nnoremap <buffer> <localleader>r :EnRename<CR> |
|
||||
nnoremap <buffer> <localleader>i :EnAddImport<CR>
|
||||
autocmd BufWritePost *.scala silent :EnTypeCheck
|
||||
|
||||
if has("vms")
|
||||
set nobackup " do not keep a backup file, use versions instead
|
||||
else
|
||||
|
|
13
metals.sh
Executable file
13
metals.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
curl -L -o /tmp/coursier https://git.io/coursier
|
||||
chmod +x /tmp/coursier
|
||||
/tmp/coursier bootstrap \
|
||||
--java-opt -Xss4m \
|
||||
--java-opt -Xms100m \
|
||||
--java-opt -Dmetals.client=LanguageClient-neovim \
|
||||
org.scalameta:metals_2.12:0.7.0 \
|
||||
-r bintray:scalacenter/releases \
|
||||
-r sonatype:snapshots \
|
||||
-o ~/bin/metals-vim -f
|
||||
|
1
pack/plugins/start/LanguageClient-neovim
Submodule
1
pack/plugins/start/LanguageClient-neovim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8356cbe0939dcfe7010087cfba887bc2edaeebd4
|
|
@ -1 +0,0 @@
|
|||
Subproject commit caa734e84f002b25446c615706283a74edd4ecfe
|
1
pack/plugins/start/fzf.vim
Submodule
1
pack/plugins/start/fzf.vim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 91ed5f4b39b6e4a2ca50be1c8cec7e1148145fab
|
1
pack/plugins/start/ncm2
Submodule
1
pack/plugins/start/ncm2
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit e5a7976ad175251a96c537488d2d9557fafdcc8b
|
1
pack/plugins/start/nvim-yarp
Submodule
1
pack/plugins/start/nvim-yarp
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8fcb1af27772174df5446d49de29052cac47e46f
|
|
@ -1 +0,0 @@
|
|||
Subproject commit a034d2d950fbd2efd3178dd02683036da9e4b267
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 2a3dcbc9085975c3b1c49c382f6c87c69d199a44
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 7aa035a7d2eaa47c472c24f810225e949f3cd90d
|
Reference in a new issue