" .vimrc - vim configuration " based on: https://stackoverflow.com/questions/1218390 " https://trofi.github.io/posts/277-from-mcedit-to-vim.html " appearance set showmode " show current mode (insert/append/etc.) in status bar set showcmd " show typed command in status bar set number " show line numbers set ruler " show cursor position in status bar set background=dark " dark background (for tmux) " from: https://unix.stackexchange.com/a/363374 "set laststatus=2 " always show the status bar at the bottom "set showtabline=2 " show the tab bar even only one file is open "set cul " highlight current line " window splitting set splitbelow " new horizontal splits are on the bottom set splitright " new vertical splits are on the right " indenting / wrapping set smartindent " smart auto indenting set copyindent " copy indentation style of prior line set shiftwidth=4 " 4 spaces for auto indents set tabstop=4 " 4 spaces per tab set expandtab " turn tabs into spaces set tw=72 " set text width (for hardwrapping) to 70 columns " disable history set viminfo= let g:netrw_dirhistmax=0 " enhanced searching " https://www.twilio.com/blog/5-quality-of-life-vim-tricks-for-your-vimrc set hlsearch " highlight search terms set incsearch " highlight search terms as you type them set showmatch " highlight matching parentheses set ignorecase " case insensitive searching set smartcase " case sensitive if uppercase characters are provided nnoremap :noh " highlight trailing white space in red " requires vim-runtime on Debian " https://stackoverflow.com/questions/356126 highlight ExtraWhitespace ctermbg=red guibg=red match ExtraWhitespace /\s\+$/ " highlight non-ascii characters in red " may require vim-runtime on Debian " https://stackoverflow.com/questions/16987362/ highlight nonascii guibg=Red ctermbg=1 term=standout au BufReadPost * syntax match nonascii "[^\u0000-\u007F]" " enable builtin spellchecking " https://vimtricks.com/p/vim-spell-check/ " https://www.linux.com/training-tutorials/using-spell-checking-vim/ " https://unix.stackexchange.com/questions/12889 " https://vi.stackexchange.com/questions/15578 let s:spellingState=0 function! ToggleSpelling() if s:spellingState set nospell else set spell spelllang=en_us endif let s:spellingState = !s:spellingState endfunction nnoremap :call ToggleSpelling() " remove trailing whitespace " https://vimtricks.com/p/vim-remove-trailing-whitespace/ " https://github.com/Omar12/dotfiles/blob/master/.vimrc function! StripWhitespace() let save_cursor = getpos(".") let old_query = getreg('/') :%s/\s\+$//e call setpos('.', save_cursor) call setreg('/', old_query) endfunction nnoremap ss :call StripWhitespace()