Last active
March 15, 2019 00:42
-
-
Save DnOberon/e7aa7b9dcf01d19958e4f445c01fb05d to your computer and use it in GitHub Desktop.
Minimal .vimrc for ssh sessions. Works out of the box with vim 8 and/or vim 7 - used on AWS default ec2 AMI. Built for use on remote servers, or for doing code interviews.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" basic syntax highlighting and completion | |
syntax on | |
filetype plugin on | |
set omnifunc=syntaxcomplete#Complete | |
" quality of life changes | |
"set nu | |
set smarttab | |
set autoindent | |
set nobackup | |
set noswapfile | |
set shiftwidth=4 | |
set tabstop=4 | |
set completeopt-=preview | |
set shortmess+=c | |
" autoclose brackets etc | |
inoremap " ""<left> | |
inoremap ' ''<left> | |
inoremap ( ()<left> | |
inoremap [ []<left> | |
inoremap { {}<left> | |
inoremap {<CR> {<CR>}<ESC>O | |
inoremap {;<CR> {<CR>};<ESC>O | |
" since I'm using this for go programming, and I like gofmt, reload on change | |
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif | |
autocmd FileChangedShellPost * | |
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None | |
" second part of the reload game, we run gofmt on save - quick and dirty | |
nnoremap <c-z> :!gofmt -w % <CR><CR> :e <CR> | |
map ;; :w<cr> <c-z> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment