call plug#begin('~/.local/share/nvim/plugged') " UI Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'xuyuanp/nerdtree-git-plugin' Plug 'nathanaelkane/vim-indent-guides' " Plug 'Yggdroot/indentLine' Plug 'jistr/vim-nerdtree-tabs' Plug 'luochen1990/rainbow' Plug 'RRethy/vim-illuminate' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'edkolev/tmuxline.vim' " Plug 'lilydjwg/colorizer' Plug 'mhinz/vim-startify' " Plug 'camspiers/animate.vim' " Plug 'camspiers/lens.vim' " Plug 'kien/tabman.vim' " LaTeX Plug 'lervag/vimtex' Plug 'KeitaNakamura/tex-conceal.vim', {'for': 'tex'} " Python Plug 'python-mode/python-mode', { 'branch': 'develop' } " Plug 'ivanov/vim-ipython' " Js & Co. Plug 'pangloss/vim-javascript' Plug 'posva/vim-vue' " Plug 'heavenshell/vim-jsdoc' Plug 'leafgarland/typescript-vim' Plug 'mattn/emmet-vim' Plug 'leafOfTree/vim-svelte-plugin' " Plug 'chrisbra/colorizer' " Plug 'mxw/vim-jsx' " C++ " Plug 'octol/vim-cpp-enhanced-highlight' " Plug 'zchee/deoplete-clang' " Misc file formats Plug 'elzr/vim-json' Plug 'plasticboy/vim-markdown' Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " Plug 'adimit/prolog.vim' Plug 'jidn/vim-dbml' " Plug 'udalov/kotlin-vim' " Plug 'suan/vim-instant-markdown', {'for': 'markdown'} "npm -g install instant-markdown-d Plug 'euclio/vim-markdown-composer' " Plug 'chrisbra/csv.vim' Plug 'aklt/plantuml-syntax' " Plug 'tyru/open-browser.vim' Plug 'weirongxu/plantuml-previewer.vim' " Plug 'rvesse/vim-sparql' " Plug 'tikhomirov/vim-glsl' " Plug 'digitaltoad/vim-jade' " Plug 'tpope/vim-jdaddy' "Git Plug 'tpope/vim-fugitive' Plug 'junegunn/gv.vim' Plug 'airblade/vim-gitgutter' Plug 'jreybert/vimagit' " Plug 'drn/blamer.nvim', {'branch': 'silence-file-length-fatal-messages'} "Snippets stuff Plug 'honza/vim-snippets' Plug 'sirver/ultisnips' " General powerful plugins Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'w0rp/ale' " Plug 'shougo/deoplete.nvim' Plug 'janko-m/vim-test' " Plug 'metakirby5/codi.vim' " Plug 'axvr/zepl.vim' " Plug 'valloric/youcompleteme' " Plug 'scrooloose/syntastic' " Coding & navigation Plug 'valloric/matchtagalways' Plug 'alvan/vim-closetag' Plug 'tpope/vim-surround' Plug 'junegunn/vim-easy-align' Plug 'tpope/vim-commentary' Plug 'justinmk/vim-sneak' Plug 'christoomey/vim-sort-motion' Plug 'AndrewRadev/splitjoin.vim' " Plug 'AndrewRadev/sideways.vim' Plug 'unblevable/quick-scope' " Plug 'terryma/vim-multiple-cursors' " Plug 'scrooloose/nerdcommenter' " Plug 'chrisbra/nrrwrgn' Plug 'jiangmiao/auto-pairs' " Plug 'raimondi/delimitmate' " Plug 'cohama/lexima.vim' " Plug 'dhruvasagar/vim-table-mode' Plug 'bronson/vim-trailing-whitespace' Plug 'dkprice/vim-easygrep' Plug 'easymotion/vim-easymotion' " Plug 'liuchengxu/vista.vim' Plug 'pechorin/any-jump.vim' Plug 'vim-scripts/restore_view.vim' Plug 'tpope/vim-repeat' Plug 'kkoomen/vim-doge' " Plug 'kshenoy/vim-signature' " Plug 'ericbn/vim-relativize' " Plug 'majutsushi/tagbar' " Plug 'yuttie/comfortable-motion.vim' " Plug 'derekwyatt/vim-fswitch' " Different extensions Plug 'kana/vim-submode' Plug 'skywind3000/asynctasks.vim' Plug 'skywind3000/asyncrun.vim' Plug 'chrisbra/unicode.vim' " Undo tree implementation Plug 'sjl/gundo.vim' " Plug 'mbbill/undotree' " Plug 'simnalamburt/vim-mundo' " Custom text objects Plug 'kana/vim-textobj-user' Plug 'kana/vim-textobj-indent' Plug 'kana/vim-textobj-line' " Plug 'kana/vim-textobj-entire' " Themes Plug 'drewtempelmeyer/palenight.vim' Plug 'https://gitlab.com/protesilaos/tempus-themes-vim.git' " Plug 'crusoexia/vim-monokai' " Plug 'lifepillar/vim-solarized8' " Plug 'haishanh/night-owl.vim' " Plug 'arcticicestudio/nord-vim' " fuzzy file stuff Plug 'liuchengxu/vim-clap' " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } " Plug 'ctrlpvim/ctrlp.vim' " Misc Plug 'wakatime/vim-wakatime' Plug 'ActivityWatch/aw-watcher-vim' Plug 'vimwiki/vimwiki' " Plug 'tpope/vim-rhubarb' " Plug 'mtth/scratch.vim' " Has to be plugged the last Plug 'ryanoasis/vim-devicons' Plug 'tiagofumo/vim-nerdtree-syntax-highlight' call plug#end() " General settings {{{ set runtimepath+=~/.config/nvim/my-snippets/ let $FZF_DEFAULT_COMMAND='fd --type f --exclude .git' set hidden set nobackup set nowritebackup set shortmess+=c set exrc set secure set number set relativenumber set linebreak set nojoinspaces set hlsearch set cursorline set mouse=a set splitbelow set splitright set inccommand=split set switchbuf=vsplit set redrawtime=500 " Indent set tabstop=4 set shiftwidth=4 set smarttab set expandtab set autoindent " Folding set foldmethod=syntax set foldlevelstart=20 " }}} " Mappings {{{ nnoremap :NERDTreeToggle nnoremap "+p " nnoremap :Files nnoremap :Clap files nnoremap ca :Clap grep nnoremap aa :Clap grep nnoremap cl :Clap blines nnoremap cc :Clap filer nnoremap ch :Clap history nnoremap cj :Clap jumps " nnoremap s :%s/\<\>/ tnoremap tnoremap :call chansend(b:terminal_job_id, "\Esc>")i nnoremap q :lclose :pclose :cclose :noh noremap - ddkP noremap _ ddp nnoremap H ^ nnoremap L $ nnoremap $ " Toggle conceal nnoremap hc :let &cole=(&cole == 2) ? 0 : 2 echo 'conceallevel ' . &cole " lens.vim nnoremap hl :call lens#toggle() " colorizer nnoremap ho :ColorToggle " Delete line into _ nnoremap d "_d vnoremap d "_d " lol " nnoremap ; : nnoremap u :GundoToggle " noremap :call comfortable_motion#flick(40) " noremap :call comfortable_motion#flick(-40) " nnoremap :TagbarToggle nnoremap :Vista!! " vim-test nnoremap tl :TestLast nnoremap tf :TestFile nnoremap ts :TestSuit nnoremap tn :TestNearest nnoremap tv :TestVisit " Tabs nnoremap gn :tabnew nnoremap gN :tabclose " nnoremap t1 1gt " nnoremap t2 2gt " nnoremap t3 3gt " nnoremap t4 4gt " nnoremap t5 5gt " nnoremap t6 6gt " nnoremap t7 7gt " nnoremap t8 8gt " nnoremap t9 9gt " ALE nnoremap af :ALEFix nnoremap ad :ALEGoToDefinition nnoremap asd :ALEGoToDefinitionInVSplit nnoremap assd :ALEGoToDefinitionInSplit nnoremap atd :ALEGoToDefinitionInTab nnoremap ar :ALEFindReferences nnoremap ah :ALEHover nnoremap ac :ALERename " coc " nnoremap ad (coc-definition) " nnoremap ai (coc-implementation) " nnoremap ar (coc-references) " nnoremap ac (coc-rename) " Async tasks nnoremap wl :AsyncTaskList nnoremap wr :AsyncTask nnoremap wa :CocList tasks " Replace nnoremap r :%s/\<\>/ " Sideways nnoremap gh :SidewaysLeft nnoremap gl :SidewaysRight nnoremap g :SidewaysLeft nnoremap g :SidewaysRight omap aa SidewaysArgumentTextobjA xmap aa SidewaysArgumentTextobjA omap ia SidewaysArgumentTextobjI xmap ia SidewaysArgumentTextobjI " REPL " nnoremap r :Repl " EasyAlign xmap ga (EasyAlign) nmap ga (EasyAlign) " quick-scope let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] " vim-sneak let g:sneak#s_next = 1 " Close vim-clap with Esc autocmd FileType clap_input inoremap :call clap#handler#exit() " vimwiki " nnoremap wah :VimwikiAll2HTML " nnoremap wl :VimwikiTabnewLink nmap thestupidkeybinding1 VimwikiNextLink let g:vimwiki_key_mappings = \ { \ 'table_mappings': 0, \ } " FSwitch " noremap + :FSAbove " Snippets let g:UltiSnipsUsePythonVersion = 3 let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" " Multiple cursors let g:multi_cursor_start_word_key = '' " Scratch let g:scratch_no_mappings = 1 "}}} " Windows management mode {{{ " Submode settings let g:submode_always_show_submode = 1 let g:submode_timeout = 0 let g:submode_keyseqs_to_leave = [] " Enter and leave the mode call submode#enter_with('Windows', 'n', '', 's', ':call WindowsModeEnter()') call submode#map('Windows', 'n', 'x', '', ':call WindowsModeLeave()') function! WindowsModeEnter() if g:lens#disabled == 0 let g:lens#disabled = 1 endif endfunction function! WindowsModeLeave() let g:lens#disabled = 0 call lens#run() endfunction " Switch to the left. If the window is left-most, swith to the right-most window " of the previous tab function! SwitchLeft() let l:win = winnr() execute 'wincmd h' if l:win == winnr() normal gT execute winnr('$') . 'wincmd w' endif endfunction " The same for the left function! SwitchRight() let l:win = winnr() execute 'wincmd l' if l:win == winnr() normal gt execute 1 . 'wincmd w' endif endfunction " Switching call submode#map('Windows', 'n', '', 'j', 'j') call submode#map('Windows', 'n', '', 'k', 'k') call submode#map('Windows', 'n', '', 'h', ':call SwitchLeft()') call submode#map('Windows', 'n', '', 'l', ':call SwitchRight()') call submode#map('Windows', 'n', '', '', 'j') call submode#map('Windows', 'n', '', '', 'k') call submode#map('Windows', 'n', '', '', ':call SwitchLeft()') call submode#map('Windows', 'n', '', '', ':call SwitchRight()') " Closing call submode#map('Windows', 'n', '', 'q', 'c') call submode#map('Windows', 'n', '', 'Q', ':q!') " Moving windows call submode#map('Windows', 'n', '', '', 'J') call submode#map('Windows', 'n', '', '', 'K') call submode#map('Windows', 'n', '', '', 'H') call submode#map('Windows', 'n', '', '', 'L') call submode#map('Windows', 'n', '', '', 'J') call submode#map('Windows', 'n', '', '', 'K') call submode#map('Windows', 'n', '', '', 'H') call submode#map('Windows', 'n', '', '', 'L') call submode#map('Windows', 'n', '', 't', 'T') " New splits call submode#map('Windows', 'n', '', 'v', 'v') call submode#map('Windows', 'n', '', 's', 's') " Mappings for normal mode nnoremap j nnoremap k nnoremap :call SwitchLeft() nnoremap :call SwitchRight() nnoremap j nnoremap k nnoremap :call SwitchLeft() nnoremap :call SwitchRight() " }}} " Misc plugins settings {{{ " NERDTree let NERDTreeIgnore = ['\.pyc$', '^__pycache__$'] let NERDTreeMinimalUI = 1 let NERDTreeDirArrows = 1 let NERDTreeMouseMode = 2 " csv let g:csv_arrange_align = 'l*' " git autocmd BufWritePost * GitGutter let g:magit_default_fold_level = 0 " let g:blamer_enabled = 1 " let g:blamer_delay = 1000 " let g:blamer_prefix = ' > ' " splitjoin let g:splitjoin_align = 1 let g:splitjoin_python_brackets_on_separate_lines = 1 " asyncrun let g:asyncrun_open = 6 let g:asyncrun_rootmarks = ['.nvimrc', '.git'] let g:asynctasks_term_pos = 'tab' " vimwiki let g:vimwiki_list = [{'path': '~/MEGAsync/Sync/vimwiki/', 'path_html': '~/MEGAsync/Sync/vimwiki-html/', 'ext': '.wiki'}] let g:vimwiki_global_ext = 0 " }}} " Filetype-specific settings {{{ " web-dev {{{ augroup filetype_pug autocmd! autocmd Filetype pug setlocal foldmethod=indent autocmd Filetype pug setlocal foldlevel=20 augroup END augroup filetype_vue autocmd! autocmd Filetype vue command! -register JsDoc call jsdoc#insert() autocmd Filetype vue setlocal conceallevel=2 augroup END autocmd Filetype javascript setlocal conceallevel=2 autocmd Filetype typescript execute ':CloseTagDisableBuffer' let g:mta_filetypes = { 'html' : 1, 'xhtml' : 1, 'xml' : 1, 'jinja' : 1, 'xsd': 1, 'vue': 1 } let g:closetag_filenames = '*.html,*.xhtml,*.vue,*.svelte' let g:closetag_filetypes = 'html,xhtml,vue,xml,xsd,svelte' let g:colorizer_auto_filetype='css,html,python,javascript,vue' let g:jsdoc_allow_input_prompt = 1 let g:jsdoc_enable_es6 = 1 let g:jsdoc_input_description = 1 let g:vue_pre_processors = [] let g:vim_svelte_plugin_use_sass = 1 let g:javascript_plugin_jsdoc = 1 " let g:javascript_conceal_function = "ƒ" " let g:javascript_conceal_null = "ø" " let g:javascript_conceal_this = "#" " let g:javascript_conceal_return = "⮜" " let g:javascript_conceal_undefined = "¿" " let g:javascript_conceal_NaN = "ℕ" " let g:javascript_conceal_prototype = "¶" " let g:javascript_conceal_static = "•" " let g:javascript_conceal_super = "Ω" " let g:javascript_conceal_arrow_function = "⮞" " let g:javascript_conceal_noarg_arrow_function = "🞅" " let g:javascript_conceal_underscore_arrow_function = "🞅" " }}} " LaTeX {{{ let g:tex_flavor='latex' let g:vimtex_fold_enabled = 1 let g:vimtex_view_method='zathura' let g:vimtex_quickfix_mode=0 let g:tex_conceal='abdmgs' let g:ale_tex_chktex_options='-I --nowarn 32' " let g:syntastic_tex_lacheck_quiet_messages = { 'regex': ['\Vpossible unwanted space at', '\VUse ` to begin'] } augroup filetype_tex autocmd! autocmd Filetype tex setlocal foldlevel=0 autocmd Filetype tex \ let b:AutoPairs = {"(": ")", '[': ']', '{': '}', '$': '$', '\left(': '\right)', \ '\left[': 'right]', "''": '``', "``": "''", '"': '"', 'sympy': 'sympy', '<<': '>>'} autocmd Filetype tex setlocal conceallevel=2 augroup END " }}} " Python {{{ autocmd Filetype python \ setlocal foldmethod=indent " let g:python_host_prog='/usr/bin/python' " let g:python3_host_prog='/usr/bin/python3' let g:pymode_python = 'python3' let g:pymode_lint = 0 let g:pymode_rope = 0 let g:pymode_rope_completion = 0 let g:pymode_rope_autoimport = 0 let g:pymode_doc = 1 " }}} " GO {{{ let g:go_fmt_autosave = 0 let g:go_imports_autosave = 0 let g:go_mod_fmt_autosave = 0 augroup filetype_go autocmd! autocmd FileType go set noexpandtab augroup END " }}} " REPL {{{ augroup zepl autocmd! autocmd FileType python let b:repl_config = { 'cmd': 'ipython --colors=Linux' } autocmd FileType javascript let b:repl_config = { 'cmd': 'node' } augroup END " }}} " Misc file commands {{{ augroup filetype_vim autocmd! autocmd Filetype vim setlocal foldmethod=marker autocmd Filetype vim setlocal foldlevel=0 augroup END augroup filetype_sparql let g:rainbow_active = 0 augroup END au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl au BufNewFile,BufRead *.pl setf prolog au BufNewFile,BufRead *.sparql setf sparql au TermEnter * IndentGuidesDisable au TermLeave * IndentGuidesEnable let g:vim_markdown_conceal = 2 let g:instant_markdown_autostart = 0 let g:instant_markdown_mathjax = 1 let g:instant_markdown_open_to_the_world = 1 let g:instant_markdown_allow_external_content = 1 let g:markdown_composer_autostart = 0 " }}} " }}} " Syntax check & autocomplete {{{ " coc {{{ inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\u\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap coc#refresh() function! s:cocActionsOpenFromSelected(type) abort execute 'CocCommand actions.open ' . a:type endfunction xmap p :execute 'CocCommand actions.open ' . visualmode() nmap p :set operatorfunc=cocActionsOpenFromSelectedg@ nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction autocmd CursorHold * silent call CocActionAsync('highlight') let g:coc_global_extensions = \ [ \ 'coc-actions', \ 'coc-calc', \ 'coc-css', \ 'coc-json', \ 'coc-marketplace', \ 'coc-python', \ 'coc-tasks', \ 'coc-tsserver', \ 'coc-ultisnips', \ 'coc-vetur', \ 'coc-vimtex' \ ] " }}} " Syntastic {{{ " set statusline+=%#warningmsg# " set statusline+=%{SyntasticStatuslineFlag()} " set statusline+=%* " " let g:syntastic_ignore_files = ['\.py$', '\.tex$'] " let g:syntastic_always_populate_loc_list = 1 " let g:syntastic_auto_loc_list = 1 " let g:syntastic_check_on_open = 1 " let g:syntastic_check_on_wq = 0 " }}} " ALE {{{ let g:ale_open_list = 'on_save' let g:ale_list_window_size = 7 let g:ale_close_preview_on_insert = 1 let g:ale_lint_on_text_changed = 'never' let g:ale_lint_on_enter = 0 let g:ale_lint_on_insert_leave = 0 let g:ale_completion_enabled = 0 let g:ale_linter_aliases = {'svelte': ['css', 'javascript']} let g:ale_linters = {'python': ['prospector'], 'tex': ['chktex'], 'cpp': ['clang'], 'vue': ['eslint'], 'typescript': ['tsserver', 'tslint'], 'svelte': ['eslint']} let g:ale_fixers = { \ 'python': ['yapf', 'isort', 'remove_trailing_lines', 'trim_whitespace'], \ 'tex': ['latexindent', 'textlint', 'remove_trailing_lines', 'trim_whitespace'], \ 'js': ['prettier', 'eslint'], \ 'javascript': ['prettier', 'eslint'], \ 'typescript': ['prettier', 'tslint'], \ 'jsx': ['prettier', 'eslint'], \ 'vue': ['prettier', 'eslint'], \ 'cpp': ['clang-format', 'remove_trailing_lines', 'trim_whitespace'], \ 'json': ['prettier'], \ 'svelte': ['eslint'], \ 'go': ['gofmt'] \} let g:airline#extensions#ale#enabled = 1 " }}} " Deoplete {{{ " call deoplete#custom#var('omni', 'input_patterns', { " \ 'tex': g:vimtex#re#deoplete " \}) " " let g:deoplete#enable_at_startup = 1 " call deoplete#custom#source('ale', 'rank', 999) " " inoremap " \ pumvisible() ? "\" : " \ check_back_space() ? "\" : " \ deoplete#mappings#manual_complete() " function! s:check_back_space() abort " let col = col('.') - 1 " return !col || getline('.')[col - 1] =~ '\s' " endfunction " " let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-6.0/lib/libclang.so.1' " let g:deoplete#sources#clang#clang_header = '/usr/lib/llvm-6.0/lib/clang/6.0.0/include' " }}} " Auto-pairs let g:AutoPairsFlyMode = 0 let g:AutoPairsShortcutBackInsert = '' " }}} " My scripts {{{ " Subterminal {{{ function! GetSubTerminalName() let current_tabpage = tabpagenr() return current_tabpage . '_terminal' endfunction function! SubTerminal() let subterminal_name = GetSubTerminalName() let terminal_num = bufnr(subterminal_name) if terminal_num == -1 execute ':new ' . subterminal_name execute ':resize 10' if isdirectory("venv") execute ':terminal' else execute ':terminal' endif normal i else execute ':bwipeout! ' . terminal_num execute ':bwipeout! ' . (terminal_num + 1) endif endfunction function! WipeSubTerminalBuffer() let subterminal_name = GetSubTerminalName() let terminal_num = bufnr(subterminal_name) if terminal_num != -1 execute ':bwipeout! ' . terminal_num endif endfunction autocmd BufWipeout term://* call WipeSubTerminalBuffer() nnoremap ` :call SubTerminal() " }}} " Terminal in tab {{{ function! OpenTerminalInTab() execute ':tabnew' execute ':terminal' normal i endfunction nnoremap ~ :call OpenTerminalInTab() " }}} " Diff with saved {{{ function! s:DiffWithSaved() let filetype=&ft diffthis vnew | r # | normal! 1Gdd diffthis exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype endfunction com! DiffSaved call s:DiffWithSaved() " }}} " Git diff stats {{{ function! Gstats() execute '!git diff --stat' endfunction command! Gstats call Gstats() " }}} " Uptime {{{ let s:start_time = localtime() function! UptimeSeconds() let l:current_time = localtime() let l:uptime = l:current_time - s:start_time return l:uptime endfunction function! s:AddLeadingZero(i) if a:i == 0 return "00" elseif a:i < 10 return "0" . a:i else return "" . a:i endif endfu function! Uptime(...) let l:show_seconds = get(a:, 1, 0) let l:uptime = UptimeSeconds() let l:m_s = (l:uptime) % 60 let l:m_m = (l:uptime/ 60) % 60 let l:m_h = (l:uptime/ (60 * 60)) % 24 let l:m_d = (l:uptime/ (60 * 60 * 24)) let l:msg = "" if (l:m_d > 0) let l:msg = l:msg . l:m_d . "d " endif let l:msg = l:msg . s:AddLeadingZero(l:m_h) . ":" . \ s:AddLeadingZero(l:m_m) if l:show_seconds == 1 let l:msg = l:msg . ":" . s:AddLeadingZero(l:m_s) endif return l:msg endfunction command! Uptime echo Uptime(1) " }}} " {{{ Delete Hidden buffers function! DeleteHiddenBuffers() let tpbl=[] let closed = 0 let terminals = 0 call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))') for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1') if getbufvar(buf, '&mod') == 0 if matchstr(bufname(buf), '^term:\/\/.*$') == '' silent execute 'bwipeout' buf let closed += 1 else silent execute 'bwipeout!' buf let closed += 1 let terminals += 1 endif endif endfor echo "Closed " .closed. " hidden buffers (" . terminals . " terminals)" endfunction command! DeleteHiddenBuffers call DeleteHiddenBuffers() " }}} " {{{ Fugitive conflict resolution function! GitVMergeSplit() execute 'Gdiffsplit!' wincmd k wincmd H let s:leftMergeBuffer = bufnr('%') wincmd l wincmd j wincmd L let s:rightMergeBuffer = bufnr('%') wincmd h endfunction function! GitMergeGetLeft() execute ":diffget" . s:leftMergeBuffer endfunction function! GitMergeGetRight() execute ":diffget" . s:rightMergeBuffer endfunction command! Gdiffmerge call GitVMergeSplit() nnoremap gdh :call GitMergeGetLeft() nnoremap gdl :call GitMergeGetRight() nnoremap gd :call GitMergeGetLeft() nnoremap gd :call GitMergeGetRight() " }}} " {{{ Folding function! SetFoldLevel() range execute ":set foldlevel=" . v:count echo("set foldlevel=" . v:count) endfunction function! OnSpace() if foldlevel('.') if foldclosed('.') != -1 return 'zO' else return 'za' endif else return "\" endif endfunction nnoremap ff :call SetFoldLevel() nnoremap @=(OnSpace()) " }}} " {{{ Better Home function! Home() let l:before = getpos('.') normal ^ let l:after = getpos('.') if l:before[2] == l:after[2] call cursor(l:after[0], 1) endif endfunction nnoremap :call Home() " }}} " {{{ Deoplete and multiple cursors " function! Multiple_cursors_before() " if deoplete#is_enabled() " call deoplete#disable() " let g:deoplete_is_enable_before_multi_cursors = 1 " else " let g:deoplete_is_enable_before_multi_cursors = 0 " endif " endfunc " function! Multiple_cursors_after() " if g:deoplete_is_enable_before_multi_cursors " call deoplete#enable() " endif " endfunction " }}} " {{{ Switch to project root let g:markers = split('.git') " TODO nvimrc function! CdToRepoRoot() abort for marker in g:markers let root = finddir(marker, expand('%:p:h') . ';') if !empty(root) let root = fnamemodify(root, ':h') execute 'cd ' . root echo 'cd ' . root . ' (found ' . marker . ')' return endif endfor echoerr 'No repo root found.' endfunction nnoremap cr :call CdToRepoRoot() " }}} " Put current time command! Timestamp :put =strftime('%d-%m-%y %H:%M:%S') " }}} " UI settings {{{ set background=dark " let g:solarized_visibility='high' " tmux cursor if exists('+termguicolors') set termguicolors endif "set guifont=DroidSansMono\ Nerd\ Font\ 11 augroup qs_colors autocmd! autocmd ColorScheme * highlight QuickScopePrimary guifg='#ff0000' gui=underline ctermfg=155 cterm=underline autocmd ColorScheme * highlight QuickScopeSecondary guifg='#ffff00' gui=underline ctermfg=81 cterm=underline augroup END set laststatus=2 colorscheme palenight highlight! TermCursorNC guibg=red "highlight Conceal guibg=Normal guifg=Normal hi Normal guibg=NONE ctermbg=NONE highlight! link Conceal Normal highlight! illuminatedWord cterm=underline gui=underline " Airline let g:airline_theme='palenight' let g:airline_powerline_fonts = 1 " let g:airline_extensions = [] let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#buffer_idx_mode = 1 let g:airline#extensions#tabline#formatter = 'unique_tail' let g:airline_section_b = '%{Uptime()}' let g:airline_highlighting_cache = 1 " vim-clap "let g:clap_search_box_border_symbols = {'curve': ["f", "g"], 'nil': ['', ''] } let g:clap_search_box_border_style = 'nul' let g:clap_layout = { 'relative': 'editor' } " Gundo let g:gundo_preview_height = 15 " tmux line let g:tmuxline_preset = { \'a' : '#S', \'b' : '#W', \'win' : '#I #W #[align=left]', \'cwin' : '#I #W', \'x' : '%-H:%M', \'y' : '%a, %b %d', \'z' : '#H'} " Indent guides let g:indent_guides_enable_on_vim_startup = 1 let g:indent_guides_exclude_filetypes = ['help', 'nerdtree', 'tagbar', 'startify', 'vim-plug', 'clap_input', 'codi'] let g:indent_guides_guide_size = 1 " let g:indentLine_fileTypeExclude = ['help', 'nerdtree', 'tagbar', 'startify', 'vim-plug', 'clap_input', 'codi'] " let g:indentLine_char = '┊' " Autoresize let g:lens#disabled = 1 let g:lens#disabled_filetypes = ['nerdtree', 'tagbar', 'clap_input', 'startify', 'diff', 'gundo'] let g:lens#width_resize_min = 10 let g:lens#height_resize_min = 10 let g:lens#width_resize_max = 90 " Highligh whitespace let g:extra_whitespace_ignored_filetypes = ['help', 'nerdtree', 'tagbar', 'startify', 'vim-plug', 'clap_input', 'GV', 'taskedit'] " Brackets let g:rainbow_active = 1 let g:rainbow_conf = { \ 'guifgs': ['red', 'yellow', 'lightgreen', 'lightblue'], \ 'separately': { 'nerdtree': 0, 'vimwiki': 0, 'sparql': 0 } \ } " Tagbar let g:tagbar_sort = 0 let g:tagbar_show_line_numbers = 1 let g:tagbar_width = 60 let g:tagbar_autofocus = 1 let g:vista_sidebar_width = 60 let g:startify_custom_header = [ \ ' ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――', \ ' _____ __ __ ____ ____ ', \ ' / ___/____ ______/ /_/ |/ (_)___ __ _______/ __ \____ ___ ', \ ' \__ \/ __ `/ ___/ __/ /|_/ / / __ \/ / / / ___/ / / / __ \/ _ \ ', \ ' ___/ / /_/ / / / /_/ / / / / / / / /_/ (__ ) /_/ / / / / __/ ', \ ' /____/\__, /_/ \__/_/ /_/_/_/ /_/\__,_/____/\____/_/ /_/\___/ ', \ ' /_/ ', \ ' ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――', \ ' Conquering the darkest places ', \ ] " }}}