From e0d15d1c1843e45999adea70787961f38f886677 Mon Sep 17 00:00:00 2001 From: Jidbo Date: Sun, 31 Jan 2021 13:48:16 +0100 Subject: [PATCH 1/4] fix linenumbers --- nvim/functions.vim | 7 ------- nvim/options.vim | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/nvim/functions.vim b/nvim/functions.vim index 376f962..ae5b381 100644 --- a/nvim/functions.vim +++ b/nvim/functions.vim @@ -3,13 +3,6 @@ " auto reload .vimrc on write autocmd BufWritePost init.vim source % -" toggle hybrid number mode -:augroup numbertoggle -: autocmd! -: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber -: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber -:augroup END - " Delete buffer while keeping window layout (don't close buffer's windows). " Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165 if v:version < 700 || exists('loaded_bclose') || &cp diff --git a/nvim/options.vim b/nvim/options.vim index 6f6b16e..10e39d9 100644 --- a/nvim/options.vim +++ b/nvim/options.vim @@ -11,7 +11,7 @@ set background=dark hi MatchParen guibg=NONE guifg=red gui=bold " random settings -set number +set rnu set clipboard=unnamed set mouse=nvi " set smarttab @@ -27,7 +27,6 @@ set history=250 set noshowmode " tabs and line wrap -set tabstop=4 set wrapmargin=8 set softtabstop=0 noexpandtab set shiftwidth=4 From 57be8104a996de6a773800a396ac61ca2dbaaced Mon Sep 17 00:00:00 2001 From: Jidbo Date: Wed, 17 Feb 2021 21:24:18 +0100 Subject: [PATCH 2/4] switch default do hybrid line numbers --- nvim/options.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/options.vim b/nvim/options.vim index 10e39d9..b5ad365 100644 --- a/nvim/options.vim +++ b/nvim/options.vim @@ -11,6 +11,7 @@ set background=dark hi MatchParen guibg=NONE guifg=red gui=bold " random settings +set number set rnu set clipboard=unnamed set mouse=nvi From 6969c537c9397a90b2b616588dd21eb9f93206f0 Mon Sep 17 00:00:00 2001 From: Jidbo Date: Wed, 17 Feb 2021 21:25:09 +0100 Subject: [PATCH 3/4] add nvim language server config This also removes ale and other auto completion setups. Note: the neovim nightly build is now required, since the current release does not support the language server protocol yet. --- nvim/pluginoptions.vim | 53 +++++++++++++++++------------------------- nvim/plugins.vim | 11 +++++---- 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/nvim/pluginoptions.vim b/nvim/pluginoptions.vim index 6a4bdb7..99d03d9 100644 --- a/nvim/pluginoptions.vim +++ b/nvim/pluginoptions.vim @@ -41,6 +41,7 @@ augroup END nmap :Buffers nmap f :GFiles +nmap l :Lines let g:fzf_buffers_jump = 1 " VIMWIKI SETUP @@ -81,6 +82,12 @@ lua require'colorizer'.setup() let g:tmuxcomplete#trigger = '' +" neo formatter +nnoremap p :Neoformat + +" vim fugitive +nnoremap gg :G + " GOYO " ========================= @@ -101,40 +108,22 @@ let g:goyo_linenr = 0 " AUTOCOMPLETION " ========================= +lua require'lspconfig'.tsserver.setup{ on_attach=require'completion'.on_attach } +lua require'lspconfig'.intelephense.setup{ on_attach=require'completion'.on_attach } +lua require'lspconfig'.vuels.setup{ on_attach=require'completion'.on_attach } +lua require'lspconfig'.pyls.setup{ on_attach=require'completion'.on_attach, plugins = {pycodestyle = {maxLineLength=120}} } -if executable('pyls') - au User lsp_setup call lsp#register_server({ - \ 'name': 'pyls', - \ 'cmd': {server_info->['pyls']}, - \ 'whitelist': ['python'], - \ }) -endif +imap (completion_trigger) +set completeopt=menuone,noinsert,noselect +set shortmess+=c -function! s:on_lsp_buffer_enabled() abort - setlocal omnifunc=lsp#complete - setlocal signcolumn=yes - nmap gd (lsp-definition) - nmap (lsp-rename) - " refer to doc to add more commands -endfunction - -augroup lsp_install - au! - " call s:on_lsp_buffer_enabled only for languages that has the server registered. - autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() -augroup END - -" ULTISNIPS SETUP -" ========================= - -" Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. -let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" -let g:UltiSnipsSnippetDirectories=[$HOME."/.vim/snipps"] - -" If you want :UltiSnipsEdit to split your window. -let g:UltiSnipsEditSplit="vertical" +nnoremap gd lua vim.lsp.buf.definition() +nnoremap gh lua vim.lsp.buf.hover() +nnoremap gH lua vim.lsp.buf.code_action() +nnoremap gD lua vim.lsp.buf.implementation() +nnoremap gs lua vim.lsp.buf.signature_help() +nnoremap gr lua vim.lsp.buf.references() +nnoremap gR lua vim.lsp.buf.rename() " EMMET SETUP " ========================= diff --git a/nvim/plugins.vim b/nvim/plugins.vim index 7858a8b..a7c24eb 100644 --- a/nvim/plugins.vim +++ b/nvim/plugins.vim @@ -12,9 +12,6 @@ Plug 'tpope/vim-commentary' " brackets management Plug 'tpope/vim-surround' -" Snippets -Plug 'SirVer/ultisnips' - " Lanugage tool Plug 'dpelle/vim-LanguageTool' @@ -67,8 +64,12 @@ Plug 'vim-airline/vim-airline' " LANGUAGES " =================== -" Linting -Plug 'dense-analysis/ale' +" nvim language server +Plug 'neovim/nvim-lspconfig' +Plug 'nvim-lua/completion-nvim' + +" Autoformatter +Plug 'sbdchd/neoformat' " disable latex before loading let g:polyglot_disabled = ["latex"] From c52bb8ac167b30c4ed215ecb40251e42adefb970 Mon Sep 17 00:00:00 2001 From: Jidbo Date: Wed, 17 Feb 2021 21:27:20 +0100 Subject: [PATCH 4/4] add prompt color option to examples --- shell/localcommands.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/localcommands.example b/shell/localcommands.example index dca1e02..9ae7837 100644 --- a/shell/localcommands.example +++ b/shell/localcommands.example @@ -1 +1,4 @@ alias vi="vim" + +# set prompt color +PROMPT_COLOR="blue"