From 64f779a7f645dda8f5f6e0b807250abec9eaa768 Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Mon, 24 Aug 2020 20:50:10 +0530 Subject: deoplete to coc --- dunst/.config/dunst/dunstrc | 2 +- nvim/.config/nvim/init.vim | 160 ++++++++++++++++++++++++++++---- spectrwm/.config/spectrwm/spectrwm.conf | 5 +- 3 files changed, 146 insertions(+), 21 deletions(-) diff --git a/dunst/.config/dunst/dunstrc b/dunst/.config/dunst/dunstrc index 178e4ec..a6941fe 100644 --- a/dunst/.config/dunst/dunstrc +++ b/dunst/.config/dunst/dunstrc @@ -19,7 +19,7 @@ horizontal_padding = 14 # The frame color and width of the notification - frame_color = "#5b5b5b" + frame_color = "#2f2f2f" frame_width = 5 line_height = 0 diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 32bf76c..fc61186 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -1,8 +1,6 @@ " vimplug call plug#begin() -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -Plug 'Shougo/deoplete-clangx' -Plug 'deoplete-plugins/deoplete-jedi' +Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'Shougo/deol.nvim' Plug 'ap/vim-css-color' Plug 'tpope/vim-eunuch' @@ -38,22 +36,44 @@ colorscheme pencil "hi Normal ctermbg=16 guibg=#000000 "hi LineNr ctermbg=16 guibg=#000000 +let mapleader=" " + +" Alias write and quit to Q +nnoremap q :wq +nnoremap w :w + +" Save file as sudo when no sudo permissions +cmap w!! w !sudo tee > /dev/null % + " vim-bujo nmap BujoAddnormal imap BujoAddinsert nmap BujoChecknormal imap BujoCheckinsert -" deoplete -let g:deoplete#enable_at_startup = 1 +" nerdtree +let g:NERDTreeWinPos = "right" +map :NERDTreeToggle +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" system clipboard +set clipboard+=unnamedplus + +" Fix indenting visual block +vmap < >gv " git gutter settings -let g:gitgutter_override_sign_column_highlight = 0 -let g:gitgutter_sign_added = '+' -let g:gitgutter_sign_modified = '±' -let g:gitgutter_sign_removed = '-' -let g:gitgutter_sign_removed_first_line = '^' -let g:gitgutter_sign_modified_removed = '#' +highlight GitGutterAdd guifg=#009900 ctermfg=Green +highlight GitGutterChange guifg=#bbbb00 ctermfg=Yellow +highlight GitGutterDelete guifg=#ff2222 ctermfg=Red +nmap ) (GitGutterNextHunk) +nmap ( (GitGutterPrevHunk) +let g:gitgutter_enabled = 1 +let g:gitgutter_map_keys = 0 +let g:gitgutter_highlight_linenrs = 1 " vim-markdown let g:vim_markdown_no_default_key_mappings=1 @@ -62,13 +82,6 @@ let g:vim_markdown_yaml_frontmatter=1 let g:vim_markdown_folding_disabled=1 let g:vim_markdown_conceal=0 -" nerdtree -let g:NERDTreeWinPos = "right" -map :NERDTreeToggle -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - " insert centered autocmd InsertEnter * norm zz @@ -129,3 +142,114 @@ set statusline+=%#PrimaryBlock# set statusline+=\ %Y\ set statusline+=%#SecondaryBlock# set statusline+=\ %P\ + +" ------COC SETTINGS------ +" prettier command for coc +command! -nargs=0 Prettier :CocCommand prettier.formatFile +let g:coc_global_extensions = [ + \ 'coc-snippets', + \ 'coc-pairs', + \ 'coc-prettier', + \ 'coc-tsserver', + \ 'coc-html', + \ 'coc-css', + \ 'coc-json', + \ 'coc-clangd', + \ 'coc-python', + \ 'coc-vimtex' + \ ] + +" From Coc Readme +set updatetime=300 + +" Some servers have issues with backup files, see #649 +set nobackup +set nowritebackup + +" don't give |ins-completion-menu| messages. +set shortmess+=c + +" always show signcolumns +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +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 + +" Use to trigger completion. +inoremap coc#refresh() + +" Use to confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +inoremap pumvisible() ? "\" : "\u\" +" Or use `complete_info` if your vim support it, like: +" inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" + +" Use `[g` and `]g` to navigate diagnostics +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Remap for rename current word +nmap (coc-rename) + +" Remap for format selected region +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) +" Fix autofix problem of current line +nmap qf (coc-fix-current) + +" Create mappings for function text object, requires document symbols feature of languageserver. +xmap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap if (coc-funcobj-i) +omap af (coc-funcobj-a) + +" Use `:Format` to format current buffer +command! -nargs=0 Format :call CocAction('format') + +" Use `:Fold` to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" use `:OR` for organize import of current buffer +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Add status line support, for integration with other plugin, checkout `:h coc-status` +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} diff --git a/spectrwm/.config/spectrwm/spectrwm.conf b/spectrwm/.config/spectrwm/spectrwm.conf index 204bab1..716b762 100644 --- a/spectrwm/.config/spectrwm/spectrwm.conf +++ b/spectrwm/.config/spectrwm/spectrwm.conf @@ -71,11 +71,12 @@ autorun = ws[1]:xsetroot -cursor_name left_ptr autorun = ws[1]:xss-lock -- slock autorun = ws[1]:xset b off autorun = ws[1]:xset s 300 +autorun = ws[1]:xset r rate 300 50 autorun = ws[1]:~/.fehbg autorun = ws[1]:~/.local/bin/bat_check.sh -autorun = ws[1]:picom autorun = ws[1]:urxvtd autorun = ws[1]:dunst +autorun = ws[1]:picom # Customize workspace layout at start # layout = ws[1]:4:0:0:0:vertical @@ -158,7 +159,7 @@ program[screenshot_wind] = ~/.local/bin/screenshot window # optional # quirk[Gimp:gimp] = FLOAT + ANYWHERE quirk[Gimp:gimp] = WS[5] quirk[Chromium:chromium] = WS[2] -quirk[Steam:Steam] = WS[6] +quirk[Steam:Steam] = WS[6] + FLOAT # quirk[XTerm:xterm] = XTERM_FONTADJ # quirk[xine:Xine Window] = FLOAT + ANYWHERE # quirk[Xitk:Xitk Combo] = FLOAT + ANYWHERE -- cgit v1.2.3