From 73fdb6ea1e4ccabb67aa312a8f7850aad1b29466 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 1 May 2019 16:12:28 +0300 Subject: Change completion framework --- .config/nvim/init.vim | 199 +++++++++++++++++++------------------------------- 1 file changed, 74 insertions(+), 125 deletions(-) (limited to '.config/nvim') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index ee6007c..24fe7ba 100755 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,8 +1,8 @@ "{{{ Plugs call plug#begin('~/.local/share/nvim/plugged') -"A code-completion engine for Vim -Plug 'Valloric/YouCompleteMe' +"completion +Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } "syntax checking Plug 'w0rp/ale' "manages tag files @@ -25,7 +25,7 @@ Plug 'majutsushi/tagbar' "status/tabline Plug 'bling/vim-airline' -" color theme. +" color themes Plug 'arcticicestudio/nord-vim' Plug 'aonemd/kuroi.vim' @@ -40,8 +40,6 @@ Plug 'lervag/vimtex' Plug 'nathanaelkane/vim-indent-guides' "text alignment Plug 'godlygeek/tabular' -"access cheat.sh sheets -Plug 'dbeniamine/cheat.sh-vim' "color code highlight Plug 'chrisbra/Colorizer' "move selections up and down @@ -49,7 +47,7 @@ Plug 'matze/vim-move' "folding ledger files Plug 'ledger/vim-ledger' -"reporen files at your last edit position +"reopen files at your last edit position Plug 'farmergreg/vim-lastplace' "toggle, display and navigate marks Plug 'kshenoy/vim-signature' @@ -91,9 +89,6 @@ call plug#end() " required "}}} "{{{Auto Commands -" Automatically cd into the directory that the file is in -autocmd BufEnter * silent! lcd %:p:h - " Remove any trailing whitespace that is in the file autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif @@ -106,7 +101,15 @@ autocmd VimResized * :wincmd = "}}} "{{{Misc Settings -let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' + +" Use deoplete. +let g:deoplete#enable_at_startup = 1 + +" interact with system clipboard +set clipboard=unnamed,unnamedplus + +" required for yoink/cutlass/subversive interaction +let g:yoinkIncludeDeleteOperations = 1 " Tab stuff set autoindent @@ -114,14 +117,17 @@ set expandtab " Use appropriate number of spaces to insert a set shiftwidth=4 set softtabstop=4 set tabstop=8 + " Use english for spellchecking, but don't spellcheck by default set spell spelllang=en_us set nospell + " Cool tab completion stuff set wildmode=list:longest,full set wildignore=*.o,*.obj,*.class +set nojoinspaces + set scrolloff=4 " Keep n lines above/below cursor -set mouse=c set number " line numbers set foldmethod=marker " folding stuffs set title " set terminal title @@ -129,20 +135,30 @@ set showmatch " jump to the matching bracket briefly, REMOVE AFTER TESTING set linebreak " wrap using 'breakat' character set splitbelow " new split panes will split to below and right set splitright +set cursorline + " persistent undo set undodir=~/.vim/undodir set undofile + " lower case searches ignore case, upper case searches do not set ignorecase set smartcase + " https://stackoverflow.com/a/3445040/ " switch case labels set cinoptions=l1 + +" https://www.reddit.com/r/vim/comments/7bj837/favorite_console_tools_to_use_with_vim/ +if executable('rg') + set grepprg=rg\ --vimgrep\ --no-heading +endif + " }}} "{{{Look and Feel + set termguicolors -"highlight NormalNC guibg='Black' let g:nord_underline = 1 let g:nord_italic = 1 @@ -150,75 +166,40 @@ let g:nord_italic_comments = 1 let g:nord_cursor_line_number_background = 1 colorscheme nord -" }}} -"{{{ Functions - -"{{{ Open URL in browser - -function! Browser () - let line = getline (".") - let line = matchstr (line, "http[^ ]*") - exec "!firefox ".line -endfunction - -"}}} - -"{{{Theme Rotating -let themeindex=0 -function! RotateColorTheme() - let y = -1 - while y == -1 - let colorstring = "#nord#kuroi#" - let x = match( colorstring, "#", g:themeindex ) - let y = match( colorstring, "#", x + 1 ) - let g:themeindex = x + 1 - if y == -1 - let g:themeindex = 0 - else - let themestring = strpart(colorstring, x + 1, y - x - 1) - return ":colorscheme ".themestring - endif - endwhile -endfunction " }}} -"}}} - "{{{ Mappings -" Open Url on this line with the browser \w -map w :call Browser () + " Open the TagBar Plugin nnoremap :TagbarToggle " Open NERDTree nnoremap :NERDTreeToggle -" Next Tab -nnoremap :tabnext -" Previous Tab -nnoremap :tabprevious " New Tab nnoremap :tabnew -" Rotate Color Scheme -nnoremap :execute RotateColorTheme() " FixIt from YCM map :YcmCompleter FixIt " Edit vimrc \ev nnoremap ev :tabnew:e ~/.config/nvim/init.vim + " Up and down are more logical with g.. nnoremap k gk nnoremap j gj inoremap gka inoremap gja + " This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great! inoremap jj nnoremap JJJJ + " quicker window movement nnoremap j nnoremap k nnoremap h nnoremap l + " Disable highlight when is pressed -nnoremap :noh +nnoremap :noh " Space will toggle folds! nnoremap za " Search mappings: These will make it so that going to the next one in a @@ -226,6 +207,44 @@ nnoremap za map N Nzz map n nzz +" checkmarks on vimwiki +nnoremap c VimwikiToggleListItem + +""""""""""""""""""""""""""" +" yanks/registers/clips " +""""""""""""""""""""""""""" +" separate cut and delete +nnoremap x d +xnoremap x d +nnoremap xx dd +nnoremap X D + +" use the special yoink paste +nmap p (YoinkPaste_p) +nmap P (YoinkPaste_P) + +" substitute from yank +nnoremap ys (SubversiveSubstitute) +nnoremap yss (SubversiveSubstituteLine) +nnoremap yS (SubversiveSubstituteToEndOfLine) + +" substitute over range +nnoremap s (SubversiveSubstituteRange) +xnoremap s (SubversiveSubstituteRange) +nnoremap ss (SubversiveSubstituteWordRange) + +" subvert over range +nnoremap s (SubversiveSubvertRange) +xnoremap s (SubversiveSubvertRange) +nnoremap ss (SubversiveSubvertWordRange) + +" iterate over yank list +nnoremap (YoinkPostPasteSwapBack) +nnoremap (YoinkPostPasteSwapForward) + +" change into pwd of current directory +nnoremap cd :cd %:p:h:pwd + "}}} "{{{Tagbar @@ -251,56 +270,19 @@ let g:ale_sign_error = '✗' let g:ale_sign_warning = '⚑' "}}} -"{{{ YouCompleteMe -let g:ycm_always_populate_location_list = 1 -let g:ycm_error_symbol = '✗' -let g:ycm_warning_symbol = '⚑' - -map g :YcmCompleter GoToDefinition - -let g:ycm_filetype_blacklist = { - \ 'tagbar': 1, - \ 'qf': 1, - \ 'notes': 1, - \ 'markdown': 1, - \ 'unite': 1, - \ 'text': 1, - \ 'startify': 1, - \ 'vimwiki': 1, - \ 'pandoc': 1, - \ 'infolog': 1, - \ 'mail': 1 - \} - -let g:ycm_filetype_specific_completion_to_disable = { - \ 'gitcommit': 1, - \ 'vim': 1 - \} - -"}}} - "{{{ Ledger -let g:ledger_extra_options = '--pedantic --explicit --check-payees' -au FileType ledger noremap { ?^\d -au FileType ledger noremap } /^\d +" let g:ledger_extra_options = '--pedantic --explicit --check-payees' let g:ledger_maxwidth = 48 let g:ledger_fillstring = ' ~' "}}} -"{{{ UltiSnips/YouCompleteMe +"{{{ UltiSnips set runtimepath+=~/.vim/my-snippets/ let g:UltiSnipsEditSplit="vertical" let g:UltiSnipsSnippetsDir=$HOME.'/.vim/my-snippets/UltiSnips' -" these navigate ycm -let g:ycm_key_list_select_completion = ['', ''] -let g:ycm_key_list_previous_completion = ['', ''] - " ctrl + l expands the snippet, c + j/k navigates placeholders let g:UltiSnipsExpandTrigger = "" -let g:UltiSnipsJumpForwardTrigger = "" -let g:UltiSnipsJumpBackwardTrigger = "" -let g:UltiSnipsListSnippets = "" "}}} "{{{ vim-startify @@ -334,39 +316,6 @@ let g:vimwiki_list = [{'path': '/home/yigit/Dropbox/personal_wiki', \ 'css_name': 'tufte.css', \ 'auto_export': 1}] let g:vimwiki_global_ext = 0 -map c VimwikiToggleListItem -"}}} - -"{{{ yanks/registers and clips - -set clipboard=unnamed,unnamedplus - -" s for substitute -nmap ys (SubversiveSubstitute) -nmap yss (SubversiveSubstituteLine) -nmap yS (SubversiveSubstituteToEndOfLine) - -nmap s (SubversiveSubstituteRange) -xmap s (SubversiveSubstituteRange) -nmap ss (SubversiveSubstituteWordRange) - -nmap s (SubversiveSubvertRange) -xmap s (SubversiveSubvertRange) -nmap ss (SubversiveSubvertWordRange) - -nmap (YoinkPostPasteSwapBack) -nmap (YoinkPostPasteSwapForward) - -let g:yoinkIncludeDeleteOperations = 1 - -nmap p (YoinkPaste_p) -nmap P (YoinkPaste_P) - -nnoremap x d -xnoremap x d - -nnoremap xx dd -nnoremap X D "}}} " {{{ vimtex -- cgit v1.2.3-70-g09d2