update, neovim use build-in lsp

This commit is contained in:
Smirnov Alexander 2021-05-29 12:22:38 +03:00
parent 8aa92b589f
commit fcb370ba0b
8 changed files with 152 additions and 156 deletions

View file

@ -1,12 +0,0 @@
{
"javascript.suggestionActions.enabled": false,
"html.filetypes": ["ejs", "jst"],
"languageserver": {
"golang": {
"filetypes": ["go"],
"command": "gopls",
"rootPatterns": ["go.mod"],
"disableWorkspaceFolders": true
}
}
}

View file

@ -1,9 +0,0 @@
ino <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
ino <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
map <leader>s <Plug>(coc-rename)
let g:coc_global_config = "$HOME/.config/nvim/coc-settings.json"
let g:coc_global_extensions = [
\ "coc-tsserver",
\ "coc-html"
\ ]

View file

@ -1,25 +1,31 @@
call plug#begin('~/.vim/plugged')
Plug 'Smirnov-O/nten.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'sheerun/vim-polyglot'
Plug 'neoclide/coc.nvim'
Plug 'axvr/zepl.vim'
" Completion && LSP
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-compe'
Plug 'jiangmiao/auto-pairs'
" Status line
Plug 'hoob3rt/lualine.nvim'
" Theme
Plug 'Smirnov-O/nten.vim'
call plug#end()
"== General
colo nten-light " Color scheme
set nu rnu cul " Line numbers & cursor highlight
set lbr wrap " Line wrap
set mouse=a mousehide " Mouse
set ruler laststatus=0 " Status line
set history=500 " Set history size
set autoread " Auto read file on change
set hidden " Change buffet without warning
set visualbell t_vb= " Disable sounds
set pumheight=8 " Maximum items in pop up
set modeline " Enable modeline
set nobk noswf noudf " Swap files
set is ic scs " Search
colo codedark " Color scheme
set termguicolors " GUI colors
set nu rnu cul " Line numbers & cursor highlight
set nolbr nowrap " Line wrap
set mouse=a mh " Mouse
set history=500 " Set history size
set autoread " Auto read file on change
set hidden " Change buffet without warning
set visualbell t_vb= " Disable sounds
set pumheight=8 " Maximum items in pop up
set modeline " Enable modeline
set nobk noswf noudf " Swap files
set is ic scs " Search
let mapleader=";" " Set leader key
set spr " Split
set scrolloff=3
set enc=utf-8 fenc=utf-8 " Encoding
set list listchars=tab:\|·,trail:~,space
@ -28,6 +34,34 @@ set list listchars=tab:\|·,trail:~,space:·
set ts=4 sw=4 sts=4
set sta et ai
"== Status line
lua require'lualine'.setup({options = {
\ theme = "codedark"
\ }})
"== Completion(LSP)
ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>"
ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>"
ino <expr> <CR> compe#confirm('<CR>')
nno sr :lua vim.lsp.buf.rename()<cr>
nno sh :lua vim.lsp.buf.hover()<cr>
nno si :lua vim.lsp.buf.definition()<cr>
nno sa :lua vim.lsp.buf.code_action()<cr>
lua << EOF
require'lspconfig'.tsserver.setup{}
require'lspconfig'.gopls.setup{}
require'compe'.setup{
enabled = true,
autocomplete = true,
source = {
path = true,
buffer = true,
nvim_lsp = true,
}
}
EOF
"== Netrw file tree
let g:netrw_liststyle = 3
let g:netrw_banner = 0
@ -36,37 +70,31 @@ let g:netrw_dirhistmax = 0
"== Custom setting for another files
au FileType python,elm setl sw=4 ts=4
au FileType javascript,javascriptreact,json,yaml setl sw=2 ts=2
au FileType go setl noet sw=4 ts=4
"== Custom commands
com! -nargs=1 REpl :cal zepl#start("<args>")|winc L|se nonu nornu
com! Prettier :sil !prettier -w %
com! Term :vs|winc L|se nonu nornu|term
com! Term :vs|winc L|se nonu nornu|start|term
com! GoFmt :sil !gofmt -w %
com! Black :sil !black %
"== Mapping
let mapleader=";"
nn <C-s> :w<cr>
nn <C-s> :w<cr>
nn <space> :noh<cr>
tno <esc> <c-\><c-n>
tno <esc> <c-\><c-n>
nn <leader>t :Term<cr>
nn <leader>r :REpl<space>
nn <leader>e :Ex<cr>
nn <leader>j :bn<cr>
nn <leader>k :bp<cr>
nn <leader>w :bd<cr>
nn <leader>; :FZF<cr>
nn <C-h> :wincmd h<cr>
nn <C-j> :wincmd j<cr>
nn <C-k> :wincmd k<cr>
nn <C-l> :wincmd l<cr>
nn cpp :ReplSend<cr>
vn cpp :ReplSend<cr>
nn spv :vs<cr>
nn sph :sp<cr>
"== LSP(coc)
so $HOME/.config/nvim/coc.vim
nn spk :winc K<cr>
nn spl :winc L<cr>