Skip to content

Instantly share code, notes, and snippets.

@fincd-aws
Forked from finchd/.vimrc
Last active June 10, 2022 22:01
Show Gist options
  • Save fincd-aws/3656e2673bcfb8d2ae04c21e53b5720f to your computer and use it in GitHub Desktop.
Save fincd-aws/3656e2673bcfb8d2ae04c21e53b5720f to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible
" because we don't need vi compatibility, and want our backspace key to work
" install vim-plug first https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
" below are some vim plugin for demonstration purpose
Plug 'joshdick/onedark.vim'
Plug 'iCyMind/NeoSolarized'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-syntastic/syntastic'
Plug 'ynkdir/vim-vimlparser'
Plug 'syngan/vim-vimlint'
call plug#end()
" https://jdhao.github.io/2018/11/15/neovim_configuration_windows/
" remember to call :plugInstall when editting the above
" I actually like slate more than the 2 colorschemes above
colorscheme slate
" line numbers
set number
" let backspace delete left of insert mode start-point
set bs=2
" tabs!
" `:set list` makes tab characters visible
" fix a file with `:retab!`
set expandtab shiftwidth=2 smarttab softtabstop=0 tabstop=8
" Makefile must be \t not spaces
autocmd FileType Makefile setlocal noexpandtab
" The lesson about Vim UI: buffers/windows/tabs
" from https://dev.to/iggredible/using-buffers-windows-and-tabs-efficiently-in-vim-56jc#buffers
" and https://vi.stackexchange.com/questions/8345/a-built-in-way-to-make-vim-open-a-new-buffer-with-file
" default is that you only get one window, with X buffers for the X files
" in `vim file1 file2` etc
" AND default is that you must save a buffer before switching.
"
" :q / :quit closes a window. :split :vsplit :new make windows
" each window can display any buffer, inc the same one as another window
"
" :enew make a new buffer
" :edit :e open a file in a new buffer
" :ls :buffers :files lists buffers
" :buffer / :b takes the filename or a number of a buffer to switch to
" :bnext :bprev :buffer# cycles this window thorugh buffer list
" jump positions with Ctrl-O (OH, not zero), Ctrl-i
" swap between most-recent 2 buffers Ctrl-^
" :bd to close a buffer
" :bw also closes and overwrites!! it is not (:b + :w)
"
" How the buffer was made does matter, :n moves to the next argument (:args)
" :n file2 " replaces the argument list, but adds to the buffer list
" from https://stackoverflow.com/questions/39264364/vim-difference-between-n-and-bn
"
" tabs are groups of 1+ windows - think layout/template
" :tabnew :tabclose
" :tabnext :tabprevious :tablast :tabfirst
" `vim -p file1 file2` new tab per file
"set hidden " when on, you can swap unsaved buffers
" do I need to specify, I think this is on already
filetype plugin on
" assuming vim-airline and vim-airline-themes
let g:airline_theme='simple'
" syntastic recommended settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" end syntastic recommended settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment