From 98fa2f083062c4f85b0b2f2057b30e76e9b8e309 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 6 Dec 2021 14:15:59 +0000 Subject: Use CMP --- cmp.vim | 36 ++++++++++++++++++++++++++++++++++++ init.vim | 6 +++++- metals.vim | 3 --- vimrc | 30 +++++++++++++++++++++++------- 4 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 cmp.vim diff --git a/cmp.vim b/cmp.vim new file mode 100644 index 0000000..e720e65 --- /dev/null +++ b/cmp.vim @@ -0,0 +1,36 @@ +lua <'] = cmp.mapping.confirm({ select = true }), + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + }) + }) + + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' } + } + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) +EOF + diff --git a/init.vim b/init.vim index 69eee22..480385f 100644 --- a/init.vim +++ b/init.vim @@ -7,6 +7,10 @@ source ~/.vimrc " " general source ~/.vim/lsc.vim -" + " scala and metals source ~/.vim/metals.vim + +" auto-complete +source ~/.vim/cmp.vim + diff --git a/metals.vim b/metals.vim index 69590d0..f741203 100644 --- a/metals.vim +++ b/metals.vim @@ -51,6 +51,3 @@ endif " autocmd FileType scala setlocal omnifunc=v:lua.vim.lsp.omnifunc -" Set completeopt to have a better completion experience -set completeopt=menuone,noinsert,noselect - diff --git a/vimrc b/vimrc index 3d198fc..6df528f 100644 --- a/vimrc +++ b/vimrc @@ -66,15 +66,23 @@ Plug 'neovimhaskell/haskell-vim' " nvim 0.5.0 or later if has('nvim-0.5') + " general lua Plug 'nvim-lua/popup.nvim' Plug 'nvim-lua/plenary.nvim' + " scala Plug 'scalameta/nvim-metals' Plug 'nvim-telescope/telescope.nvim' + " auto complete + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-vsnip' + Plug 'hrsh7th/vim-vsnip' end call plug#end() " crystaline conf +" " metals status function! MetalsStatus() abort @@ -116,7 +124,8 @@ let g:crystalline_theme = 'gruvbox' set laststatus=2 -"" vim-autoformat (C-F5) +" vim-autoformat (C-F5) +" noremap :Autoformat au BufWrite *.py,*.c,*.h,*.cpp,*.hs :Autoformat @@ -153,11 +162,13 @@ set updatetime=500 set autoread au BufEnter,CursorHold,CursorHoldI * silent! checktime -" make easier to open NERDTree +" NERDTree +" map n :NERDTreeToggle let NERDTreeQuitOnOpen=1 -" make easier to use telescope +" Telescope +" nnoremap f Telescope find_files nnoremap fb Telescope buffers @@ -166,11 +177,13 @@ nnoremap fb Telescope buffers let g:loaded_gentags#ctags = 1 " vimwiki +" let g:vimwiki_list = [{'path': '~/textfiles/', \ 'syntax': 'markdown', 'ext': '.md'}] let g:vimwiki_global_ext = 0 " vim-markdown +" let g:vim_markdown_folding_disabled = 1 let g:vim_markdown_frontmatter = 1 let g:vim_markdown_conceal_code_blocks = 0 @@ -179,6 +192,11 @@ autocmd FileType markdown setlocal conceallevel=2 " LSC conf " let g:lsc_auto_map = {'defaults': v:true, 'FindImplementations': ''} +let g:lsc_preview_split_direction = "below" + +" haskell syntax +" +let g:haskell_classic_highlighting = 1 " Required for operations modifying multiple buffers like rename. set hidden @@ -189,8 +207,6 @@ set shortmess+=c " for lsc erros set shortmess-=F -let g:lsc_preview_split_direction = "below" - " disable preview when doing auto-complete set completeopt-=preview @@ -198,6 +214,6 @@ set completeopt-=preview highlight link lscDiagnosticError GruvboxRedSign highlight link lscDiagnosticWarning GruvboxYellowSign -" haskell syntax -let g:haskell_classic_highlighting = 1 +" Set completeopt to have a better completion experience +set completeopt=menuone,noinsert,noselect -- cgit v1.2.3