"{{{ Plugs call plug#begin('~/.local/share/nvim/plugged') " latex " had to move vimtex to top to avoid a difficult error Plug 'lervag/vimtex' " completion Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'lionawurscht/deoplete-biblatex' Plug 'deoplete-plugins/deoplete-jedi' Plug 'racer-rust/vim-racer' " ledger Plug 'ledger/vim-ledger' " language packs Plug 'sheerun/vim-polyglot' " syntax checking Plug 'dense-analysis/ale' " manages tag files Plug 'ludovicchabant/vim-gutentags' " run tests (todo: write tests) Plug 'janko/vim-test' " type in file send to repl Plug 'jpalardy/vim-slime' " snippets to expand Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " autopair plugin Plug 'tmsvg/pear-tree' " Fuzzy finder with post-update hook Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " tree explorer, i don't use this as much but don't like netrw either Plug 'scrooloose/nerdtree' " displays tags ordered by scope Plug 'majutsushi/tagbar' " status/tabline Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " color theme of $CURRENT_YEAR Plug 'bluz71/vim-moonfly-colors' " Personal wiki Plug 'vimwiki/vimwiki' " centers the writing Plug 'junegunn/goyo.vim' " highlights the current paragraph Plug 'junegunn/limelight.vim' " text alignment \w :Tab Plug 'godlygeek/tabular' " move selections up and down with alt+[j,k] Plug 'matze/vim-move' " surround text objects; sa, sr and sd Plug 'machakann/vim-sandwich' " provide additional text objects Plug 'wellle/targets.vim' " indentation level text object, ia, ii Plug 'michaeljsmith/vim-indent-object' " visual feedback for substitute holy shit this is amazing Plug 'markonm/traces.vim' " see the contents of registers on "/ Plug 'junegunn/vim-peekaboo' " use k to highlight multiple words Plug 'lfv89/vim-interestingwords' " swap delimited items using g>, g< Plug 'machakann/vim-swap' " reopen files at your last edit position Plug 'farmergreg/vim-lastplace' " git diff in the sign column Plug 'airblade/vim-gitgutter' " Conflict merger Plug 'christoomey/vim-conflicted' " 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' " 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' " asynchronous build and test dispatcher Plug 'tpope/vim-dispatch' " fancy start screen Plug 'mhinz/vim-startify' Plug 'ryanoasis/vim-devicons' " asks to be placed last, sure call plug#end() " required "}}} "{{{Auto Commands " 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 = " Set spell for prose autocmd FileType markdown,tex setlocal spell autocmd FileType rust let b:dispatch = 'cargo run' "}}} " Functions {{{ function! CreatePaper(citekey) exe "e! " . fnameescape("~/Nextcloud/personal_wiki/papers/" . a:citekey . ".wiki") let l:timestap="Report Created at: " . strftime("%c") let l:text="= Came From =\n\n= Takeaways =\n\n= Might Go To =\n\n" put! =l:timestap put =l:text endfunction " }}} Function " "{{{Misc Settings " 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 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_gb set nospell " Cool tab completion stuff set wildmode=list:longest,full set wildignore=*.o,*.obj,*.class,*.aux,*.lof,*.log,*.lot,*.fls,*.toc,*.fmt,*.fot,*.cb,*.cb2,.*.lb,.dvi,*.xdv,*.bbl,*.bcf,*.blg,*-blx.aux,*-blx.bib,*.run.xml,*.fdb_latexmk,*.synctex,*.synctex(busy),*.synctex.gz,*.synctex.gz(busy),*.pdfsync let g:NERDTreeRespectWildIgnore = 1 set nojoinspaces set scrolloff=4 " Keep n lines above/below cursor set number " line numbers set foldmethod=marker " folding stuffs set title " set terminal title set linebreak " wrap using 'breakat' character set splitbelow " new split panes will split to below and right set splitright set cursorline " highlight the current line set relativenumber " current line actual number, rest are relative set showmatch " jump to the matching bracket briefly set hidden " move freely between buffers set thesaurus+=~/.local/share/thesaurus.txt " 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\ --smart-case endif set diffopt=algorithm:patience " }}} "{{{Look and Feel set termguicolors colorscheme moonfly let g:moonflyUndercurls = 0 " }}} "{{{ Mappings " call CreatePaper on word below cursor nnoremap cp :call CreatePaper(expand('')) " If you like "Y" to work from the cursor to the end of line (which is more " logical, but not Vi-compatible) map Y y$ " Open the TagBar Plugin nnoremap :TagbarToggle " Open NERDTree nnoremap :NERDTreeToggle " Fix whole buffer via ALE nmap (ale_fix) " these "Ctrl mappings" work well when Caps Lock is mapped to Ctrl nmap t :TestNearest nmap t :TestFile nmap t :TestSuite nmap t :TestLast nmap t :TestVisit " New Tab nnoremap :tabnew " Edit vimrc \ev nnoremap ev :tabnew:e ~/.config/nvim/init.vim " jump to buffer nnoremap b :ls:b " Up and down are more logical with g.. nnoremap k gk nnoremap j gj inoremap gka inoremap gja " quicker window movement nnoremap j nnoremap k nnoremap h nnoremap l " Disable highlight when is pressed nnoremap :noh " Space used to toggle folds, now it's x (because x is d) nnoremap "_x " checkmarks on vimwiki nmap v VimwikiToggleListItem " add/increase header level nmap a VimwikiAddHeaderLevel " sneak using grave, s is for sandwich nmap ` Sneak_s nmap ` Sneak_S nnoremap ' ` " 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 nmap ys (SubversiveSubstitute) nmap yss (SubversiveSubstituteLine) nmap yS (SubversiveSubstituteToEndOfLine) " substitute over range nmap s (SubversiveSubstituteRange) xmap s (SubversiveSubstituteRange) nmap ss (SubversiveSubstituteWordRange) " subvert over range nmap s (SubversiveSubvertRange) xmap s (SubversiveSubvertRange) nmap ss (SubversiveSubvertWordRange) " iterate over yank list nmap (YoinkPostPasteSwapBack) nmap (YoinkPostPasteSwapForward) " change into pwd of current directory nnoremap cd :cd %:p:h:pwd inoremap fn =expand("%:t:r") nnoremap fn :put! =expand('%:t:r') "}}} "{{{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#tabline#enabled = 1 let g:airline_mode_map = {} let g:airline_mode_map['ic'] = 'INSERT' if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_left_sep = '' let g:airline_left_alt_sep = '' let g:airline_right_sep = '' let g:airline_right_alt_sep = '' "}}} "{{{ NERDTree let g:NERDTreeWinSize=25 "}}} "{{{ Ale let g:ale_sign_error = '✗' let g:ale_sign_warning = '⚑' let g:ale_lint_on_text_changed = 'insert' let g:ale_lint_on_enter = 0 let g:ale_pattern_options = {'\.wiki$': {'ale_enabled': 0}} "}}} "{{{ Ledger let g:ledger_maxwidth = 48 let g:ledger_fillstring = ' ~' "}}} "{{{ UltiSnips set runtimepath+=~/.vim/my-snippets/ let g:UltiSnipsEditSplit = "vertical" let g:UltiSnipsSnippetsDir = $HOME.'/.vim/my-snippets/UltiSnips' " ctrl + l expands the snippet, c + j/k navigates placeholders let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsEnableSnipMate = "1" "}}} "{{{ 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/Nextcloud/personal_wiki', \ 'path_html': '/home/yigit/Nextcloud/personal_wiki_html', \ 'css_name': 'tufte.css', \ 'template_path': '/home/yigit/Nextcloud/personal_wiki/', \ 'template_default': 'default_template', \ 'template_ext': '.html', \ 'auto_export': 1, \ 'auto_tags': 1}] let g:vimwiki_global_ext = 0 "}}} " {{{ vimtex let g:vimtex_view_method='zathura' let g:tex_flavor='latex' let g:vimtex_quickfix_mode=0 let g:polyglot_disabled=['latex', 'tex', 'ledger'] " }}} " {{{ Gutentags let g:gutentags_add_default_project_roots = 0 let g:gutentags_project_root = ['Makefile', '.git'] let g:gutentags_generate_on_new = 1 let g:gutentags_generate_on_missing = 1 let g:gutentags_generate_on_write = 1 let g:gutentags_generate_on_empty_buffer = 0 " }}} " vim-slime {{{ let g:slime_target = "tmux" let g:slime_paste_file = "$HOME/.slime_paste" let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": "{last}"} let g:slime_no_mappings = 1 nmap SlimeParagraphSend " }}} Slime