From 1679d1e03ca979c896938bdcb37cc0f28048ceb3 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 29 Oct 2020 17:17:46 +0300 Subject: steal some nifty things from lukesmith --- .config/nvim/init.vim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to '.config/nvim') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 40824b0..6ce39e4 100755 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -56,6 +56,8 @@ Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " undo tree visualizer Plug 'mbbill/undotree' +" preview colours in source code +Plug 'ap/vim-css-color' " }}} heresy " @@ -164,8 +166,18 @@ autocmd FileType markdown,tex setlocal spell autocmd FileType rust let b:dispatch = 'cargo run' +" these files are formatted not with textwidth but into sentences autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences +" runs a script that cleans out tex build files whenever I close out of a .tex file. +autocmd VimLeave *.tex !texclear % + +" enable Goyo by default for mutt writing +autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80 +autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo +autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x! +autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q! + " TODO: this will get supported on nvim 0.5.0 " TODO: this too https://www.reddit.com/r/neovim/comments/gxcbui/in_built_lsp_is_amazing/ " augroup highlight_yank @@ -307,6 +319,15 @@ let g:moonflyUndercurls = 0 "{{{ Mappings +" Save file as sudo on files that require root permission +cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! + +" Replace ex mode with gq +map Q gq + +" Replace all is aliased to S. +nnoremap S :%s//g + " use esc in :term as well tnoremap @@ -408,6 +429,9 @@ nmap (YoinkPostPasteSwapForward) nnoremap cd :cd %:p:h:pwd inoremap fn =expand("%:t:r") nnoremap fn :put! =expand('%:t:r') + +" press \g and start writing prose +map g :Goyo "}}} "{{{Tagbar -- cgit v1.2.3-70-g09d2