From 3a168c72a0b4f7ec9d7e05ba73a2e1e24ca660eb Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 15 Dec 2020 17:14:19 +0100 Subject: [PATCH] vim: document used options --- roles/vim/files/vimrc | 143 +++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/roles/vim/files/vimrc b/roles/vim/files/vimrc index cd74ca3..858e4f4 100644 --- a/roles/vim/files/vimrc +++ b/roles/vim/files/vimrc @@ -7,78 +7,79 @@ if $LOCAL_CONFIG == "" | let $LOCAL_CONFIG="~/.local/etc" | endif let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" " Options {{{ - set autoindent - set autoread - let &background = $BACKGROUND ==# 'light' ? 'light' : 'dark' - set backspace=indent,eol,start - set nobackup - set clipboard=unnamed - set colorcolumn=80 - set cursorline - set diffopt=filler,vertical - set encoding=utf8 - set expandtab - set fileformats=unix,mac,dos - set foldenable - set foldlevelstart=100 - set foldmethod=syntax - set foldnestmax=10 - let &formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[-*]\|\[[ x]\]\|([ x])\)\s*' - set formatoptions-=t - set formatoptions+=jn - set hidden - set history=1000 - set hlsearch - set incsearch - set nojoinspaces - set laststatus=2 - set lazyredraw - set list - set modelines=0 - set number - set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME - set scrolloff=5 - set shiftwidth=4 - set shortmess+=I - set showmatch - set noshowmode - set sidescrolloff=5 - set nrformats-=octal - set smartindent - set smarttab - set splitbelow - set splitright - set noswapfile - set tabstop=4 - set textwidth=79 - set timeoutlen=1000 - set ttimeoutlen=100 - set ttyfast - " +--Disable hlsearch while loading viminfo - " | +--Remember marks for last 500 files - " | | +--Remember up to 10000 lines in each register - " | | | +--Remember up to 1MB in each register - " | | | | +--Remember last 1000 search patterns - " | | | | | +---Remember last 1000 commands - " | | | | | | - " v v v v v v - set viminfo=h,'500,<10000,s1000,/1000,:1000 - set viminfofile=$XDG_CACHE_HOME/vim/viminfo - set virtualedit=block - set wildignore=*.o,*.obj,*.pyc,*.exe,*.so,*.dll - set wildmenu - set wrap - set writebackup +set autoindent " take indent for new line from previous line +set autoread " autom. read file when changed outside of Vim +let &background = $BACKGROUND ==# 'light' ? 'light' : 'dark' +set backspace=indent,eol,start " sane backspace behavior +set nobackup " don't keep backup file after overwriting a file +set clipboard=unnamed " synchronize with system clipboard +set colorcolumn=80 " highlight column 80 +set cursorline " highlight the line of the cursor +set diffopt=filler,vertical " make side-by-side diffs better +set encoding=utf8 " use UTF-8 by default +set expandtab " use spaces whe is inserted +set fileformats=unix,mac,dos " prioritize unix format +set foldenable " enable folding +set foldlevelstart=100 " start with all folds open +set foldmethod=syntax " fold based on syntax by default +set foldnestmax=10 " limit nested folds to 10 levels +set formatlistpat="^\s*\(\d\+[\]:.)}\t ]\|[-*]\|\[[ x]\]\|([ x])\)\s*" +set formatoptions-=t " don't auto-wrap on 'textwidth' +set formatoptions+=c " do auto-wrap comments on 'textwidth' +set formatoptions+=j " remove comment leader when joining lings +set formatoptions+=n " recognize and indent lists automatically +set hidden " hide abandoned buffers +set history=1000 " how many ":" commands to remember +set hlsearch " highlight search results +set incsearch " use incremental search +set nojoinspaces " use one space after a period whe joining lines +set laststatus=2 " always show a status line +set lazyredraw " don't redraw screen when executing macros +set list " show invisible characters +set listchars="tab:>~,extends:>,precedes:<,trail:-" " invisible chars +set modelines=0 " never use modelines +set number " show line numbers +set nrformats-=octal " number formats for CTRL-A & CTRL-X commands +set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME " so vim-plug can work +set scrolloff=5 " minimum number of lines above and below cursor +set shiftwidth=4 " number of spaces to use for (auto)indent step +set shortmess+=I " don't show the intro message when starting Vim +set showbreak="-> " " prefix for wrapped lines +set showmatch " briefly jump to matching bracket if insert one +set noshowmode " don't show mode (using airline instead) +set sidescrolloff=5 " min. number of columns to left and right of cursor +set smartindent " use smart autoindenting +set smarttab " use 'shiftwidth' when inserting +set splitbelow " new window from split is below the current one +set splitright " new window is put right of the current one +set noswapfile " don't use swap files +set tabstop=4 " tabs are 4 spaces +set textwidth=79 " maximum width for text being inserted +set timeout timeoutlen=1000 ttimeoutlen=100 " timeout on mappings & key codes +set ttyfast " indicate a fast terminal for smoother redrawing + " +--Disable hlsearch while loading viminfo + " | +--Remember marks for last 500 files + " | | +--Remember up to 10000 lines in each register + " | | | +--Remember up to 1MB in each register + " | | | | +--Remember last 1000 search patterns + " | | | | | +---Remember last 1000 commands + " | | | | | | + " v v v v v v +set viminfo=h,'500,<10000,s1000,/1000,:1000 +set viminfofile=$XDG_CACHE_HOME/vim/viminfo +set virtualedit=block " position the cursor anywhere in Visual Block mode +set wildignore=*.o,*.obj,*.pyc,*.exe,*.so,*.dll +set wildmenu " use the menu for commandline completion +set wrap " wrap long lines +set writebackup " make a backup before overwriting a file - if has('multi_byte') && &encoding ==# 'utf-8' - set foldtext=VimrcFoldText() - set fillchars=vert:┃,fold:· - let &listchars = 'tab:▷ ,extends:»,precedes:«,trail:·' - let &showbreak = ' ⤷ ' - else - let &listchars = 'tab:>~,extends:>,precedes:<,trail:-' - let &showbreak = '-> ' - endif +" Overrides when UTF-8 is available +if has('multi_byte') && &encoding ==# 'utf-8' +set foldtext=VimrcFoldText() +set fillchars=vert:┃,fold:· +set showbreak=" ⤷ " " prefix for wrapped lines +set listchars="tab:▷ ,extends:»,precedes:«,trail:·" " invisible chars +endif " }}} " Plugins {{{