let mapleader = " " set modeline set wrap set autoindent set noexpandtab set tabstop=2 set shiftwidth=2 set termguicolors set shortmess=I set splitbelow splitright set noshowmode set ignorecase set smartcase set timeoutlen=500 set updatetime=100 set mouse=a set cino=N-s,E-s,l1,g-1,j1 set linebreak " set wrap but don't wrap inside words set viminfo+='1000,n~/.local/nvim/viminfo set guifont=JetBrainsMono\ Nerd\ Font:h9:#e-subpixelantialias:#h-slight set linespace=5 let g:sneak#label = 1 let g:which_key_map = {} let g:airline_powerline_fonts = 1 let g:minimap_highlight='Visual' let g:python3_host_prog='/usr/bin/python3' let g:vimtex_quickfix_open_on_warning = 0 let g:vimtex_imaps_enabled = 0 hi! link CocFloating SneakScope if exists("g:neovide") nmap :lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1 nmap :lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1 nmap :lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1 nmap :lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1 nmap :lua vim.g.neovide_scale_factor = 1 let g:neovide_scroll_animation_length = 0.2 let g:neovide_cursor_animation_length = 0.06 let g:neovide_cursor_trail_size = 0.0 let g:neovide_padding_top=16 let g:neovide_padding_left=16 let g:neovide_padding_right=16 let g:neovide_padding_bottom=16 endif if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) echo "Downloading junegunn/vim-plug to manage plugins..." silent !mkdir -p ~/.config/nvim/autoload/ silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim autocmd VimEnter * PlugInstall endif " plugged call plug#begin('~/.config/nvim/plugged') " quality of life Plug 'jiangmiao/auto-pairs' Plug 'tpope/vim-surround' Plug 'itchyny/lightline.vim' Plug 'itchyny/vim-gitbranch' Plug 'terryma/vim-multiple-cursors' Plug 'AndrewRadev/tagalong.vim' Plug 'terrortylor/nvim-comment' Plug 'liuchengxu/vim-which-key' Plug 'justinmk/vim-sneak' Plug 'mbbill/undotree' " Plug 'jbgutierrez/vim-better-comments' Plug 'junegunn/goyo.vim' Plug 'othree/eregex.vim' Plug 'psliwka/vim-smoothie' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' Plug 'wellle/targets.vim' Plug 'dstein64/vim-startuptime' Plug 'vim-scripts/DoxygenToolkit.vim' Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' } Plug 'dkarter/bullets.vim' Plug 'editorconfig/editorconfig-vim' " language plugins Plug 'lervag/vimtex' " Plug 'pangloss/vim-javascript' Plug 'hail2u/vim-css3-syntax' Plug 'octol/vim-cpp-enhanced-highlight' Plug 'vim-python/python-syntax' Plug 'dart-lang/dart-vim-plugin' Plug 'bartlomiejdanek/vim-dart' Plug 'natebosch/dartlang-snippets' Plug 'HerringtonDarkholme/yats.vim' Plug 'cespare/vim-toml' Plug 'tikhomirov/vim-glsl' " Plug 'gabrielelana/vim-markdown' Plug 'vim-scripts/syntaxm4.vim' Plug 'elkowar/yuck.vim' Plug 'eraserhd/parinfer-rust', {'do': 'cargo build --release'} Plug 'kaarmu/typst.vim' Plug 'aklt/plantuml-syntax' " 'vim=ide' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'ryanoasis/vim-devicons' "Icons for filetypes Plug 'puremourning/vimspector' Plug 'samoshkin/vim-mergetool' " themes Plug 'arzg/vim-colors-xcode' Plug 'sainnhe/sonokai' Plug 'bluz71/vim-nightfly-guicolors' Plug 'Mcmartelle/vim-monokai-bold' Plug 'ntk148v/vim-horizon' Plug 'NLKNguyen/papercolor-theme' Plug 'scheakur/vim-scheakur' Plug 'mkarmona/materialbox' Plug 'morhetz/gruvbox' Plug '~/.config/nvim/local/bliss' Plug '~/.config/nvim/local/polarlight.vim' Plug '~/.config/nvim/local/autonyaa.vim' Plug 'lonkaars/blubber' Plug 'romgrk/github-light.vim' Plug 'vv9k/vim-github-dark' " tryout themes Plug 'https://github.com/mcchrish/zenbones.nvim' Plug 'https://github.com/Mangeshrex/uwu.vim' Plug 'https://github.com/metalelf0/jellybeans-nvim' Plug 'https://github.com/lifepillar/vim-wwdc17-theme' Plug 'https://github.com/jdsimcoe/abstract.vim' Plug 'https://github.com/ts-26a/vim-darkspace' Plug 'https://github.com/iandwelker/rose-pine-vim' call plug#end() " keybinds tnoremap nnoremap tt :tabnew nmap o nmap qf (coc-fix-current) nnoremap :m +1 nnoremap :m -2 imap imap imap imap command WordQuotesToLatex \ :%s/‘/`/ge | \ :%s/’/'/ge | \ :%s/“/``/ge | \ :%s/”/''/ge command WordQuotesToAscii \ :%s/‘/'/ge | \ :%s/’/'/ge | \ :%s/“/"/ge | \ :%s/”/"/ge " leader keybindings nnoremap :WhichKey '' map vo VimspectorContinue map vq VimspectorStop map vr VimspectorRestart map vp VimspectorPause map vb VimspectorToggleBreakpoint map vc VimspectorToggleConditionalBreakpoint map vf VimspectorAddFunctionBreakpoint map vn VimspectorStepOver map vi VimspectorStepInto map vu VimspectorStepOut let g:which_key_map.v = { \ 'name': '+vimspector', \ 'o': 'continue', \ 'q': 'stop', \ 'r': 'restart', \ 'p': 'pause', \ 'b': 'toggle breakpoint', \ 'c': 'toggle conditional breakpoint', \ 'f': 'add function breakpoint', \ 'n': 'step over', \ 'i': 'step into', \ 'u': 'step out' \ } map p "+p map y "+y let g:which_key_map.p = 'x11 paste' let g:which_key_map.y = 'x11 yank' map w :w let g:which_key_map.w = 'write' map dv :VimtexView map dc :VimtexCompile map de :VimtexErrors map dt :VimtexTocToggle let g:which_key_map.d = { \ 'name': '+document', \ 'v': 'view', \ 'c': 'compile', \ 'e': 'errors', \ 't': 'table of contents' \ } map ts :sp term://zshi map tv :vsp term://zshi map tt :tabnew term://zshi let g:which_key_map.t = { \ 'name': '+term', \ 's': 'split', \ 'v': 'vsplit', \ 't': 'tab' \ } map .v :tabnew ~/.config/nvim/init.vim let g:which_key_map['.'] = { \ 'name': '+config', \ 'v': 'vim', \ } map u :UndotreeToggle let g:which_key_map.u = 'toggle undo tree' " cmd maps cnoreabbrev W w cnoreabbrev sudow w !sudo tee % " hexokinase let g:Hexokinase_optInPatterns = [ \ 'full_hex', \ 'triple_hex', \ 'rgb', \ 'rgba', \ 'hsl', \ 'hsla' \ ] " colorscheme thingers if filereadable(expand('~/.local/share/mode/light')) colorscheme github-light else colorscheme ghdark endif " change default vim-sneak colors to be more readable hi! SneakLabel gui=reverse hi! SneakLabelMask gui=reverse " fix terminal color hi! link TermCursor Cursor hi! link TermCursorNC Cursor " fix which key color hi! link WhichKeyFloating NormalFloat source $HOME/.config/nvim/lightline.vim let g:lightline = { \ 'colorscheme': 'auto', \ 'mode_map': { \ 'n' : 'norm', \ 'i' : 'ins', \ 'R' : 'rep', \ 'v' : 'vis', \ 'V' : 'v-l', \ "\": 'v-b', \ 'c' : 'cmd', \ 's' : 'sel', \ 'S' : 's-l', \ "\": 's-b', \ 't': 'term' \ }, \ 'active': { \ 'left': [ \ [ 'mode', 'paste' ], \ [ 'readonly', 'filename', 'modified'] \ ], \ 'right': [ \ [ 'lineinfo' ] \ ] \ }, \ 'inactive': { \ 'left': [ \ [ 'readonly', 'filename', 'modified'] \ ], \ 'right': [ ] \ }, \ } let g:lightline.tabline = { \ 'left': [ [ 'tabs' ] ], \ 'right': [ ] } hi! SignColumn guibg=NONE ctermbg=NONE hi GitGutterAdd guibg=NONE hi GitGutterChange guibg=NONE hi GitGutterDelete guibg=NONE hi GitGutterAddIntraLine guibg=NONE hi GitGutterAddInvisible guibg=NONE hi GitGutterChangeDelete guibg=NONE hi GitGutterChangeInvisible guibg=NONE hi GitGutterDeleteIntraLine guibg=NONE hi GitGutterDeleteInvisible guibg=NONE hi CocErrorSign guibg=NONE hi CocGitAddedSign guibg=NONE hi CocGitChangeRemovedSign guibg=NONE hi CocGitChangedSign guibg=NONE hi CocGitRemovedSign guibg=NONE hi CocGitTopRemovedSign guibg=NONE hi CocHintSign guibg=NONE hi CocInfoSign guibg=NONE hi CocWarningSign guibg=NONE " fix disappearing CocFadeOut hi! link Conceal Comment " vimtex config let g:tex_flavor = 'latex' let g:vimtex_compiler_latexmk = { \ 'backend' : 'nvim', \ 'background' : 1, \ 'build_dir' : '', \ 'callback' : 1, \ 'continuous' : 1, \ 'executable' : 'latexmk', \ 'engine' : 'xelatex', \ 'hooks' : [], \ 'options' : [ \ '-xelatex', \ '-file-line-error', \ '-synctex=1', \ '-interaction=nonstopmode', \ ], \} " TeX quotes autocmd FileType tex let b:surround_{char2nr("q")} = "`\r'" autocmd FileType tex let b:surround_{char2nr('Q')} = "``\r''" autocmd FileType tex let b:AutoPairs = AutoPairsDefine({'(':')', '[':']', '{':'}', "``":"''", "`":"'", '$':'$', '"':'"'}) " AutoPairs for plantuml autocmd FileType plantuml let b:AutoPairs = {'(':')', '[':']', '{':'}', '`':'`'} " coc.vim completion and stuff function! CheckBackspace() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction inoremap \ coc#pum#visible() ? coc#pum#next(1) : \ CheckBackspace() ? "\" : \ coc#refresh() inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction if has("patch-8.1.1564") set signcolumn=number else set signcolumn=yes endif inoremap coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\" " coc code navigation map cd (coc-definition) map cy (coc-type-definition) map ci (coc-implementation) map cr (coc-references) map cn (coc-rename) let g:which_key_map.c = { \ 'name': '+coc', \ 'd': 'definition', \ 'y': 'type definition', \ 'i': 'implementation', \ 'r': 'references', \ 'n': 'rename' \ } " use for trigger completion inoremap coc#refresh() " auto-comment uit " autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " which key register dict call which_key#register('', "g:which_key_map") " no line numbers in terminal augroup TerminalStuff " Clear old autocommands au! autocmd TermOpen * setlocal nonumber norelativenumber autocmd TermOpen * set signcolumn=no augroup END " python-syntax " let g:python_highlight_all = 1 let g:python_recommended_style = 0 " autocmd FileType python setlocal noexpandtab au BufRead,BufNewFile *.py set expandtab function! SynStack() if !exists("*synstack") return endif echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') endfunc " markdown let g:markdown_enable_spell_checking = 0 au FileType markdown set expandtab " binary files augroup Binary au! au BufReadPre *.bin let &bin=1 au BufReadPost *.bin if &bin | %!xxd au BufReadPost *.bin set ft=xxd | endif au BufWritePre *.bin if &bin | %!xxd -r au BufWritePre *.bin endif au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin set nomod | endif au BufWritePost *.bin set noeol augroup END " sneak let g:sneak#use_ic_scs = 0 " fcitx5 autocmd InsertEnter * call system("fcitx5-temp-restore &") autocmd InsertLeave * call system("fcitx5-temp-off &")