"=========================================================================== " PLUGINS "=========================================================================== " " Plugins managed with vim-plug: https://github.com/junegunn/vim-plug " call plug#begin() Plug 'junegunn/goyo.vim' Plug 'junegunn/limelight.vim' Plug 'mattn/emmet-vim' "Dependency for vim-textobj-comment, allows for defining custom textobjects Plug 'kana/vim-textobj-user' " Incredibly useful plugin. Adds a comment textobj, enabling motions like 'dac'. It just works. Plug 'glts/vim-textobj-comment' "colors Plug 'mhartington/oceanic-next' Plug 'morhetz/gruvbox' Plug 'flazz/vim-colorschemes' Plug 'dylanaraps/wal.vim' Plug 'bling/vim-airline' "moar language support Plug 'sheerun/vim-polyglot' "these two must be in this order Plug 'godlygeek/tabular' Plug 'preservim/vim-markdown' "this plugin fixes an issue where setting hi MatchParen breaks markdown formatting Plug 'monkoose/matchparen.nvim' "opens files where we left off Plug 'farmergreg/vim-lastplace' call plug#end() "============================================================================= let g:NERDCreateDefaultMappings = 1 autocmd! BufNewFile,BufRead * colo gruvbox "display line numbers set number "set a proper color for text concealed by Limelight let g:limelight_conceal_ctermfg = '#83a598' let g:limelight_conceal_guifg = '#83a598' " Gives Vim access to a broader range of colours set termguicolors " " vim-colorschemes changes the directory where our colorschemes are stored to: " ~/.config/nvim/plugged/vim-colorschemes/colors/ " currently using a colorscheme generated from a wallpaper pack from Waneella https://www.waneella.com/ " generated using https://utubo.github.io/vim-6colors/ " Converts tabs to spaces set expandtab " Use two spaces instead of tabs set tabstop=2 " The same but for indents set shiftwidth=2 " Keep cursor in approximately the middle of the screen set scrolloff=12 " Disable mouse support set mouse= " Highlight the line the cursor is on "autocmd FileType markdown set cursorline " "============================================================================= " SOME FRANKLY PRETTY WEIRD EJS STUFF "============================================================================= " " Nik V suggestions (mostly) implemented and annotated with NV " https://stackoverflow.com/a/26398183 " " NOTE THAT SYNTAX FILE LOCATION IS DIFFERENT " we have vim-polyglot installed, so our ejs.vim syntax file goes in " ~/.config/nvim/plugged/vim-polyglot/syntax/ instead. " Also, I'm going to go on the record saying that shit still looks weird. IDK " y'all. " autocmd BufNewFile,BufRead *.ejs set filetype=ejs autocmd BufNewFile,BufRead *._ejs set filetype=ejs "NV "tell vim what a comment string looks like in ejs, not sure this quite works "correctly. "autocmd FileType ejs setlocal commentstring= "uhhhhh.... "autocmd BufNewFile,BufRead *.ejs set syntax=html " "============================================================================= " VIM-MARKDOWN SETTINGS "============================================================================= " " Treat all .md files as markdown autocmd BufNewFile,BufRead *.md set filetype=markdown " "let g:vim_markdown_conceal = 2 set conceallevel=2 let g:vim_markdown_folding_disabled = 1 let g:vim_markdown_conceal_code_blocks = 0 let g:vim_markdown_math = 1 let g:vim_markdown_toml_frontmatter = 1 let g:vim_markdown_frontmatter = 1 let g:vim_markdown_strikethrough = 1 let g:vim_markdown_autowrite = 1 let g:vim_markdown_edit_url_in = 'tab' let g:vim_markdown_follow_anchor = 1 "============================================================================= " GOYO SETTINGS "============================================================================= " " automatically open Goyo for markdown files autocmd FileType markdown Goyo " " remap ctrl+g to open Goyo nnoremap :Goyo " " Toggle various commands on entering/leaving Goyo function! s:goyo_enter() hi MatchParen cterm=underline ctermbg=NONE ctermfg=NONE hi MatchParen gui=underline guibg=NONE guifg=NONE Limelight endfunction autocmd! User GoyoEnter nested call goyo_enter() function! s:goyo_leave() hi MatchParen cterm=underline ctermbg=NONE ctermfg=NONE hi MatchParen gui=underline guibg=NONE guifg=NONE Limelight! endfunction autocmd! User GoyoLeave nested call goyo_leave() hi MatchParen cterm=underline ctermbg=NONE ctermfg=NONE hi MatchParen gui=underline guibg=NONE guifg=NONE "========================================================================= " PROPER QUIT "========================================================================= " Quit vim completely when :q is pressed, even from Goyo mode " function! g:Goyo_before() let b:quitting = 0 let b:quitting_bang = 0 " Thanks to mihaylr (https://github.com/junegunn/goyo.vim/issues/185#issuecomment-633260041) for the bit after the pipe on this line, and for the cursor() call. " Without this fix, the cursor position breaks when you use this quit script autocmd QuitPre let b:quitting = 1 | let b:line_pos = line('.') | let b:col_pos = col('.') cabbrev q! let b:quitting_bang = 1 q! endfunction function! g:Goyo_after() " Quit Vim if this is the only remaining buffer if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 call cursor(b:line_pos, b:col_pos) if b:quitting_bang qa! else qa endif endif endfunction let g:goyo_callbacks = [function('g:Goyo_before'), function('g:Goyo_after')] " "================================================================================ " "