Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis

bnoordhuis/.vimrc

Created Jul 21, 2020
Embed
What would you like to do?
.vimrc
" vim > vi
set nocompatible
syntax on
filetype on
filetype plugin on
filetype indent on
" auto reload changes files (that don't have unsaved changes)
set autoread
" disable swap files
set nobackup
set noswapfile
set nowritebackup
" incremental search
set incsearch
set hlsearch
set showmatch
set matchtime=3
set wildmenu
set wildmode=longest:full
set wildignore=*.[oa],*.l[oa],*.so,*.pyc
set cmdheight=1
set nowrap
set hidden
set ruler
set number
set relativenumber
set cursorline
set nolazyredraw
set textwidth=80
set colorcolumn=+1
set laststatus=2
set scrolloff=5
set nofoldenable
set nomodeline
set pastetoggle=<F3>
" set cindent
set smarttab
set autoindent
set backspace=indent,eol,start
" TODO revisit this
set formatoptions=croql
set tags=tags;$HOME
noremap ; :
noremap <space> :
let mapleader=","
map <leader>w :w<cr>
map <leader>x :x<cr>
map <leader>q :qa!<cr>
map <leader>b :bprev<cr>
map <leader>f :bnext<cr>
map <leader>t :Tagbar<cr>
map <silent> // :nohlsearch<cr>
" auto reload .vimrc
autocmd bufwritepost .vimrc source ~/.vimrc
autocmd BufRead * set relativenumber
autocmd BufEnter Makefile set noexpandtab tabstop=8 shiftwidth=8
autocmd BufEnter COMMIT_EDITMSG set textwidth=72
autocmd Filetype * set expandtab tabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.py set expandtab tabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead $HOME/radiant/* set nowrap noexpandtab tabstop=8 shiftwidth=8
autocmd BufNewFile,BufRead $HOME/src/linux/* set nowrap noexpandtab tabstop=8 shiftwidth=8
autocmd BufNewFile,BufRead *.gyp,*.gypi set expandtab tabstop=2 shiftwidth=2 filetype=conf
autocmd BufRead,BufNewFile *.scad set filetype=openscad
autocmd BufRead,BufNewFile *.zig set shiftwidth=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment