Personal sane Vim defaults
I have found many "sane" default configs on the net and this is my favorite
personal list. This is how my .vimrc
file looks like.
Updated version is available on GitHub.
" General sane defaults.
syntax enable
colorscheme sorbet
nnoremap q: <nop>
set nocompatible
set relativenumber
set nohlsearch
set smartcase
set ignorecase
set incsearch
set autoindent
set nowrap
set nobackup
set noswapfile
set autoread
set wildmenu
set encoding=utf8
set backspace=2
set scrolloff=4
set spelllang=en_us
" Status Line enhancements.
set laststatus=2
set statusline=%f%m%=%y\ %{strlen(&fenc)?&fenc:'none'}\ %l:%c\ %L\ %P
hi StatusLine cterm=NONE ctermbg=black ctermfg=brown
hi StatusLineNC cterm=NONE ctermbg=black ctermfg=darkgray
" Commenting blocks of code.
augroup commenting_blocks_of_code
autocmd!
autocmd FileType c,cpp,go,scala let b:comment_leader = '// '
autocmd FileType sh,ruby,python let b:comment_leader = '# '
autocmd FileType conf,fstab let b:comment_leader = '# '
autocmd FileType lua let b:comment_leader = '-- '
autocmd FileType vim let b:comment_leader = '" '
augroup END
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
" Language specific indentation.
filetype plugin indent on
autocmd Filetype make,go,c,cpp setlocal noexpandtab tabstop=4 shiftwidth=4
autocmd Filetype html,js,css setlocal expandtab tabstop=2 shiftwidth=2
I keep it pretty vanilla so this is about everything I have in the file.
Other notes
- Cache busting in Hugo
- Make B/W SVG charts with matplotlib
- c Write and read structs to/from files in C
- plan9 Fix bootloader not being written in Plan9
- Convert all MKV files into other formats
- plan9 Mount Plan9 over network
- Add lazy loading of images in Jekyll posts
- Push to multiple origins at once in Git
- Uninstall Ollama from a Linux box
- Sane defaults for tmux with more visible statusbar
- Use option key as meta in Alacritty under macOS
- c Calling assembly functions from C
- Edsger W. Dijkstra Manuscripts ebook
- 10/GUI 10 Finger Multitouch User Interface
- plan9 Drawing Pixels in Plan9