diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json deleted file mode 100644 index c1f7539..0000000 --- a/.config/nvim/coc-settings.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "languageserver": { - "ccls": { - "command": "ccls", - "filetypes": [ - "c", - "cpp", - "objc", - "objcpp" - ], - "rootPatterns": [ - ".ccls", - "compile_commands.json", - ".vim/", - ".git/", - ".hg/" - ], - "initializationOptions": { - "cache": { - "diretory": "/tmp/ccls" - } - } - }, - "golang": { - "command": "gopls", - "rootPatterns": [ - "go.mod", - ".vim/", - ".git/", - ".hg/" - ], - "filetypes": [ - "go" - ] - }, - "haskell": { - "command": "haskell-language-server-wrapper", - "args": [ - "--lsp" - ], - "rootPatterns": [ - "*.cabal", - "stack.yaml", - "cabal.project", - "package.yaml", - "hie.yaml" - ], - "filetypes": [ - "hs", - "lhs", - "haskell", - "lhaskell" - ], - "initializationOptions": { - "haskell": { - } - } - }, - "hdlChecker": { - "command": "hdl_checker", - "args": [ - "--lsp" - ], - "filetypes": [ - "vhdl", - "verilog", - "systemverilog" - ] - }, - "nim": { - "command": "nimlsp", - "filetypes": [ - "nim" - ], - "trace.server": "verbose" - } - } -} diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 5602b99..6a25066 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -15,22 +15,21 @@ Plug 'donRaphaco/neotex' , {'for': 'tex'} " asynchronous pdf rendering for pdf Plug 'fatih/vim-go' , {'for': 'go'} " better support for golang Plug 'itchyny/lightline.vim' " fancy statusline Plug 'junegunn/fzf.vim' " quickly jump files using fzf -Plug 'lervag/vimtex' , {'for' : 'tex'} " tex library for autocompletion Plug 'luochen1990/rainbow' " colorized matching brackets Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'} " show tags Plug 'mattesgroeger/vim-bookmarks' " Set Bookmarks -Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} " autocompletion +Plug 'neovim/nvim-lspconfig' " Language server client +Plug 'nvim-lua/completion-nvim' " Automatically open the omni completion window while typing Plug 'qpkorr/vim-renamer' " bulk renamer Plug 'raimondi/delimitmate' " automatic closing of brackets Plug 'rrethy/vim-hexokinase' , {'do': 'make hexokinase'} " color Preview Plug 'ryanoasis/vim-devicons' " enable icons for vim Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} " filetree Plug 'sirver/ultisnips' " snippets -Plug 'tomasiser/vim-code-dark' " adding colorscheme +Plug 'tiyn/vim-tccs' " custom colorscheme Plug 'tpope/vim-fugitive' " git wrapper Plug 'tpope/vim-surround' " help for quotes/parantheses Plug 'uiiaoo/java-syntax.vim' , {'for': 'java'} " better syntax highlight for java than default -Plug 'whonore/coqtail' , {'for': 'v'} " coq interactive proof Plug 'zah/nim.vim' , {'for': 'nim'} " Highlighting for nim call plug#end() @@ -54,8 +53,7 @@ let g:neotex_enabled = 2 let g:go_def_mapping_enabled = 0 " itchyny/lightline.vim -let g:lightline = { 'colorscheme': 'codedark'} -set noshowmode +let g:lightline = { 'colorscheme': 'tccs'} " junegunn/fzf.vim let $FZF_DEFAULT_COMMAND = 'find . ~ -type f' @@ -103,71 +101,55 @@ nmap mm BookmarkToggle nmap ma BookmarkAnnotate nmap ms BookmarkShowAll nmap mn BookmarkNext -nmap mb BookmarkPrev +nmap mp BookmarkPrev nmap mc BookmarkClear highlight BookmarkSign ctermbg=NONE ctermfg=160 highlight BookmarkLine ctermbg=194 ctermfg=NONE let g:bookmark_sign = 'B' let g:bookmark_highlight_lines = 1 -" neoclide/coc.nvim -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -let g:coc_global_extensions = [ - \ 'coc-java', - \ 'coc-markdownlint', - \ 'coc-pyright', - \ 'coc-sh', - \ 'coc-tsserver', - \ 'coc-vimtex', - \ ] - -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -inoremap pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - elseif (coc#rpc#ready()) - call CocActionAsync('doHover') - else - execute '!' . &keywordprg . " " . expand('') - endif -endfunction - -autocmd CursorHold * silent call CocActionAsync('highlight') - -nmap (coc-rename) - -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end +" neovim/nvim-lspconfig +lua << EOF +local nvim_lsp = require('lspconfig') + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(client, bufnr) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + + -- Mappings. + local opts = { noremap=true, silent=true } + + -- See `:help vim.lsp.*` for documentation on any of the below functions + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'gy', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.rename()', opts) + +end + +-- Use a loop to conveniently call 'setup' on multiple servers and +-- map buffer local keybindings when the language server attaches +local servers = { "pyright", "java_language_server", "bashls", "tsserver", "texlab", "ccls", "gopls", "hls", "nimls" } +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + on_attach=on_attach, + flags = { + debounce_text_changes = 150 + } + } +end +EOF +autocmd BufEnter * lua require'completion'.on_attach() + +" nvim-lua/completion-nvim +let g:completion_matching_strategy_list = [ 'exact', 'substring', 'fuzzy', 'all' ] +let g:completion_matching_smart_case = 1 +let g:completion_enable_snippet = 'UltiSnips' " rrethy/vim-hexokinase let g:Hexokinase_refreshEvents = ['InsertLeave'] @@ -202,23 +184,15 @@ nnoremap gr :Gread nnoremap gu :diffget //2 nnoremap gs :G -" whonore/coqtail -function g:CoqtailHighlight() - hi def CoqtailChecked guifg=#44FF44 - hi def CoqtailSent guifg=#777777 -endfunction - """ end plugin section set go=a +set noshowmode " enable mouse for all modes set mouse=a set clipboard+=unnamedplus -" enable command completion -set wildmode=longest,list,full - " setting Tab-length set expandtab set softtabstop=4 @@ -239,6 +213,14 @@ filetype plugin on " enable syntax highlighting syntax on +" enable specify completion options +set shortmess+=c +set completeopt=menuone,noinsert,noselect +inoremap pumvisible() ? '' : '' +inoremap pumvisible() ? '' : '' +inoremap pumvisible() ? '' : '' +inoremap pumvisible() ? '' : '' + " enable true colors set termguicolors @@ -259,9 +241,6 @@ set hidden set nobackup set nowritebackup -" dont pass messages to ins-completion-menu -set shortmess+=c - " always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. if has("patch-8.1.1564") @@ -362,9 +341,9 @@ autocmd BufEnter,FileType tex set colorcolumn=80 autocmd BufEnter,FileType nim set colorcolumn=80 autocmd BufEnter,FileType python set colorcolumn=80 -" colorscheme +"" colorscheme set background=dark -colorscheme codedark +colorscheme tccs highlight colorcolumn guibg=#772222 " python