83 lines
2.6 KiB
Plaintext
83 lines
2.6 KiB
Plaintext
"--------------
|
|
" a minimal vimrc
|
|
"--------------
|
|
|
|
"load system defaults
|
|
"--------------------
|
|
if filereadable(expand('$VIMRUNTIME/defaults.vim'))
|
|
unlet! g:skip_defaults_vim
|
|
source $VIMRUNTIME/defaults.vim
|
|
endif
|
|
|
|
"regular settings
|
|
"----------------
|
|
" ui
|
|
set number " line numbers
|
|
set ruler " line # in the statusline
|
|
set wildmenu " vim command completion menu
|
|
set showcmd " show the current normal mode command
|
|
set showmatch " show matching symbols like (), {}
|
|
set hidden " allow unsaved buffers in background
|
|
|
|
" encoding/format
|
|
set encoding=utf-8 " utf-8 (basically) standard
|
|
set fileformats=unix,dos,mac " controls newline styles
|
|
|
|
" searching
|
|
set hlsearch " highlight all matches for a search
|
|
set incsearch " incremental search by character
|
|
set ignorecase " ignore alphabetical case of search
|
|
set smartcase " ignore unless there is a capital letter
|
|
|
|
" tab/space indent and whitespace
|
|
set tabstop=2 " tabstop is the num to use for a tab character
|
|
set softtabstop=2 " softtabstop makes up the difference between tab and space
|
|
set shiftwidth=2 " shiftwidth applies to indenting with < and >
|
|
set expandtab " use space characters to indent instead of tab characters
|
|
set autoindent " copies indent from current line
|
|
set smarttab " should not matter if ts, sts and sw are all the same
|
|
set backspace=indent,eol,start " lets you backspace over anything
|
|
|
|
" key timeout values
|
|
set esckeys " allow <ESC> to be registered instantly
|
|
set timeoutlen=1000 " keymap timeout value (1 second in ms)
|
|
set ttimeoutlen=20 " time out for keycodes (20ms)
|
|
|
|
" allow syntax and filetype plugins
|
|
syntax enable
|
|
filetype plugin indent on
|
|
runtime macros/matchit.vim
|
|
|
|
" keybinds
|
|
"----------
|
|
let mapleader = " "
|
|
nnoremap <leader>l :set list!<CR>
|
|
nnoremap <leader>t2 :set ts=2 sts=2 sw=2 expandtab<CR>
|
|
nnoremap <leader>t4 :set ts=4 sts=4 sw=4 expandtab<CR>
|
|
nnoremap <leader>t4t :set ts=4 sts=4 sw=4 noexpandtab<CR>
|
|
|
|
" autocmds
|
|
"---------
|
|
augroup general
|
|
autocmd!
|
|
"keep equal proportions when windows resized
|
|
autocmd VimResized * wincmd =
|
|
"save cursor position in a file
|
|
autocmd BufReadPost * if line("'\"") > 1 && line("'\"")
|
|
\ <= line("$") | exe "normal! g'\"" | endif
|
|
augroup END
|
|
|
|
augroup languages
|
|
autocmd!
|
|
autocmd BufNewFile,BufRead *.bash set syntax=sh
|
|
autocmd FileType python xnoremap <leader>r <esc>:'<,'>:w !python3<CR>
|
|
autocmd FileType go setlocal noexpandtab ts=4 sts=4 sw=4
|
|
autocmd FileType html :syntax sync fromstart
|
|
autocmd FileType html,javascript,css,json,yaml,sh
|
|
\ setlocal ts=2 sts=2 sw=2 expandtab
|
|
augroup END
|
|
|
|
if filereadable(expand("~/.local/.vimrc"))
|
|
source ~/.local/.vimrc
|
|
endif
|