dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 22d89eaf2302034d8fb24c27ddc0e8dbe9577a6f
parent 99b091dcb5429e475169f5de2dc0be6a96c247e5
Author: Janis Pagel <janis.pagel@ims.uni-stuttgart.de>
Date:   Sat, 18 Jan 2020 20:02:26 +0100

Tweak vim and vimrc

Diffstat:
Mvim/vimrc | 88+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 52 insertions(+), 36 deletions(-)

diff --git a/vim/vimrc b/vim/vimrc @@ -1,4 +1,4 @@ -" vim-plug section +" Plugins {{{ call plug#begin('~/.vim/plugged') Plug 'vimwiki/vimwiki' Plug 'mechatroner/rainbow_csv' @@ -9,41 +9,38 @@ Plug 'arcticicestudio/nord-vim' Plug 'tpope/vim-surround' Plug 'tpope/vim-repeat' call plug#end() - -set encoding=utf-8 " Encoding -set number " Display line numbers -set splitbelow splitright " Sensible splitting behavior - -" Enable syntax highlighting -let g:solarized_termcolors=256 " If using solarized color scheme -if has("syntax") - syntax on - colorscheme nord -endif - -" Enable plugins if has("autocmd") filetype plugin indent on endif + " }}} +" Basics {{{ +set encoding=utf-8 " Encoding +set number " Display line numbers +set splitbelow splitright " Sensible splitting behavior set nocompatible set nomodeline - +set cursorline " Enable autocompletion set wildmode=longest,list,full set wildmenu - -" reopening a file at same position -if has("autocmd") - au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif -endif - " Change leader key let mapleader = ',' " Set the time the leader key is active (in ms) set timeoutlen=2000 +" Show tabs +set listchars=tab:>- + " }}} + +" Syntax highlighting {{{ +let g:solarized_termcolors=256 " If using solarized color scheme +if has("syntax") + syntax on + colorscheme nord +endif +" }}} -" status line +" Statusline {{{ set laststatus=2 set statusline= "set statusline+=%7*\[%n] "buffernr @@ -55,36 +52,55 @@ set statusline+=%4*\ %{&ff}\ "FileFormat (dos/unix. set statusline+=%5*\ %{&spelllang}\ "Spellanguage set statusline+=%8*\ %=\ %l:%v\ "Rownr:Colnr set statusline+=%0*\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot. +" }}} -" Show tabs -set listchars=tab:>- - -" automatically deletes all trailing whitespace on save -autocmd BufWritePre * %s/\s\+$//e - - -" run programs silently +" run programs silently {{{ command! -nargs=* RunSilent \ | execute ':silent !'.'<args>' \ | execute ':redraw!' +" }}} -" markdown preview with pandoc +" markdown preview with pandoc {{{ nmap <Leader>pc :RunSilent pandoc -f markdown -o /tmp/vim-pandoc-out.pdf % && pkill -1 mupdf<CR> nmap <Leader>pp :RunSilent mupdf /tmp/vim-pandoc-out.pdf &<CR> +" }}} -" run make +" run make {{{ nmap <Leader>mk :RunSilent make<CR> +"}}} -" Create commands for activating customized write and code modes +" Normal, write and code modes {{{ command Normalmode set background=dark | colorscheme nord | Goyo! | set nolinebreak | set norelativenumber | set nospell command Writemode set background=light | colorscheme solarized | set linebreak | set spell | Goyo 80 command Codemode set background=dark | colorscheme obsidian | Goyo! | set nolinebreak | set nospell nmap <Leader>nm :Normalmode<CR> nmap <Leader>wm :Writemode<CR> nmap <Leader>cm :Codemode<CR> +" }}} -" Macro for inserting current date +" Insert current date {{{ nmap <Leader>d "=strftime("%Y-%m-%d")<CR>P +" }}} -" autocmds -autocmd BufRead,BufNewFile ~/.mutt/temp/mutt* :Goyo 80 | set linebreak | set spell +" autocmds {{{ +" reopening a file at same position +if has("autocmd") + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + autocmd BufRead,BufNewFile ~/.mutt/temp/mutt* :Goyo 80 | set linebreak | set spell + " automatically deletes all trailing whitespace on save + autocmd BufWritePre * %s/\s\+$//e +endif +" }}} + +" Open vimrc {{{ +nnoremap <Leader>ev :vsp ~/.vimrc<CR> +nnoremap <Leader>sv :source ~/.vimrc <bar> :doautocmd BufRead<CR> +" }}} + +" Folding {{{ +set foldenable +set foldlevelstart=10 +set foldnestmax=10 +set foldmethod=syntax +nnoremap <space> za +" }}}