"{{{ Plugs call plug#begin('~/.local/share/nvim/plugged') "A code-completion engine for Vim Plug 'Valloric/YouCompleteMe' "syntax checking Plug 'w0rp/ale' "manages tag files Plug 'ludovicchabant/vim-gutentags' "snippet solution Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' "autopair plugin Plug 'tmsvg/pear-tree' "colored brackets Plug 'luochen1990/rainbow' " Plugin outside ~/.vim/plugged with post-update hook Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } "tree explorer Plug 'scrooloose/nerdtree' "displays tags ordered by scope Plug 'majutsushi/tagbar' "status/tabline Plug 'bling/vim-airline' " color theme. Plug 'arcticicestudio/nord-vim' Plug 'aonemd/kuroi.vim' "Personal wiki Plug 'vimwiki/vimwiki' "distraction-free writing Plug 'junegunn/goyo.vim' " latex Plug 'lervag/vimtex' "visual display of indent levels 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 Plug 'matze/vim-move' "folding ledger files Plug 'ledger/vim-ledger' "reporen files at your last edit position Plug 'farmergreg/vim-lastplace' "toggle, display and navigate marks Plug 'kshenoy/vim-signature' "git diff in the sign column Plug 'airblade/vim-gitgutter' "jump to location by 2 characters Plug 'justinmk/vim-sneak' "splits delete into cut and delete Plug 'svermeulen/vim-cutlass' "change text with yank Plug 'svermeulen/vim-subversive' "yank history Plug 'svermeulen/vim-yoink' "enable repeating supported plugin maps with '.' Plug 'tpope/vim-repeat' "quoting/parenthesizing made simple Plug 'tpope/vim-surround' "pairs of handy bracket mappings Plug 'tpope/vim-unimpaired' "git wrapper Plug 'tpope/vim-fugitive' "increment dates, times & more Plug 'tpope/vim-speeddating' "search, substitute and abbreviate Plug 'tpope/vim-abolish' "provides ga, show unicode stuff of char under cursor Plug 'tpope/vim-characterize' "comment helper Plug 'tpope/vim-commentary' "fancy start screen Plug 'mhinz/vim-startify' Plug 'ryanoasis/vim-devicons' " asks to be placed last, sure 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 " Close vim if the only window left open is NERDTree autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " Resize all windows proportionally when the terminal is resized " let terminal resize scale the internal windows autocmd VimResized * :wincmd = "}}} "{{{Misc Settings let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' " Tab stuff set autoindent 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 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 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 " 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 " }}} "{{{Look and Feel set termguicolors "highlight NormalNC guibg='Black' let g:nord_underline = 1 let g:nord_italic = 1 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 " Space will toggle folds! nnoremap za " Search mappings: These will make it so that going to the next one in a " search will center on the line it's found in. map N Nzz map n nzz "}}} "{{{Tagbar let g:tagbar_autofocus = 1 let g:tagbar_compact = 1 let g:tagbar_sort = 0 let g:tagbar_width = 25 "}}} "{{{ Airline let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#formatter = 'unique_tail' let g:airline#extensions#ycm#enabled = 1 "}}} "{{{ NERDTree let g:NERDTreeWinSize=25 "}}} "{{{ Ale 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_maxwidth = 48 let g:ledger_fillstring = ' ~' "}}} "{{{ UltiSnips/YouCompleteMe 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 function! StartifyEntryFormat() return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path' endfunction let entry_format = "' ['. index .']'. repeat(' ', (3 - strlen(index)))" if exists('*WebDevIconsGetFileTypeSymbol') " support for vim-devicons let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '. entry_path" else let entry_format .= '. entry_path' endif let g:ascii = [ \' | ', \'\ \ \ / -_) | _| _ \ ` \ -_)', \' \_/\_/\___|_|\__|\___/_|_|_|\___|', \ '', \] let g:startify_custom_header = \ 'map(g:ascii + startify#fortune#boxed(), "\" \".v:val")' "}}} "{{{ vimwiki let g:vimwiki_list = [{'path': '/home/yigit/Dropbox/personal_wiki', \ 'path_html': '~/Dropbox/personal_wiki_html', \ '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 let g:vimtex_view_method = 'zathura' " }}} " {{{ rainbow let g:rainbow_active = 0 " }}}