diff options
author | Juan J. Martinez <jjm@usebox.net> | 2021-12-06 14:15:59 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-05-29 22:57:30 +0100 |
commit | 98fa2f083062c4f85b0b2f2057b30e76e9b8e309 (patch) | |
tree | 8bd53941c7d03f9682812e4d151f02617b464ac3 | |
parent | 783154e2c1b45238f53527fc02d6ea5a670b7c7f (diff) | |
download | dotnvim-98fa2f083062c4f85b0b2f2057b30e76e9b8e309.tar.gz dotnvim-98fa2f083062c4f85b0b2f2057b30e76e9b8e309.zip |
Use CMP
-rw-r--r-- | cmp.vim | 36 | ||||
-rw-r--r-- | init.vim | 6 | ||||
-rw-r--r-- | metals.vim | 3 | ||||
-rw-r--r-- | vimrc | 30 |
4 files changed, 64 insertions, 11 deletions
@@ -0,0 +1,36 @@ +lua <<EOF + -- Setup nvim-cmp. + local cmp = require'cmp' + + cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + ['<CR>'] = 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 + @@ -7,6 +7,10 @@ source ~/.vimrc " " general source ~/.vim/lsc.vim -" + " scala and metals source ~/.vim/metals.vim + +" auto-complete +source ~/.vim/cmp.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 - @@ -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 <F29> :Autoformat<CR> 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 <leader>n :NERDTreeToggle<CR> let NERDTreeQuitOnOpen=1 -" make easier to use telescope +" Telescope +" nnoremap <leader>f <cmd>Telescope find_files<CR> nnoremap <leader>fb <cmd>Telescope buffers<CR> @@ -166,11 +177,13 @@ nnoremap <leader>fb <cmd>Telescope buffers<CR> 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 |