Skip to content

Instantly share code, notes, and snippets.

@longlostnick
Last active December 20, 2021 23:19
Show Gist options
  • Save longlostnick/61710c327650809c86a7c4c78baaf85a to your computer and use it in GitHub Desktop.
Save longlostnick/61710c327650809c86a7c4c78baaf85a to your computer and use it in GitHub Desktop.
My barebones .vimrc
"-----------------------------------------------------------------------------
" General Stuff
"-----------------------------------------------------------------------------
set nohls
set incsearch
" set the search scan so that it ignores case when the search is all lower
" case but recognizes uppercase if it's specified
set ignorecase
set smartcase
" Turn off the angryness
set belloff=all
" Fix esc key delaying itself wtf?
set ttimeoutlen=0
" 'fuzzy' find files in current dir
set path+=**
set wildmenu
" don't scan all included files for autocomplete
set complete-=i
"-----------------------------------------------------------------------------
" Key mappings
"-----------------------------------------------------------------------------
let mapleader=","
" jj esc!
imap jj <esc>
" No more shift colon!
nmap <space> :
" Keep text selected after indentation. Favorite setting of all time :D
vnoremap < <gv
vnoremap > >gv
"-----------------------------------------------------------------------------
" Editor Formatting
"-----------------------------------------------------------------------------
" When the page starts to scroll, keep the cursor 5 lines from the top/bottom
set scrolloff=5
" Tabs and spaces
set expandtab
set tabstop=4
set shiftwidth=4
set shiftround
" Indentation
set autoindent
set smartindent
" Allow backspacing over indent, eol, and the start of an insert
set backspace=2
" Let the cursor do some crazy stuff
set virtualedit=all
" Set filetype stuff to on
filetype plugin indent on
" Custom overrides for indentation
autocmd FileType javascript setlocal ts=2 sts=2 sw=2
autocmd FileType typescript setlocal ts=2 sts=2 sw=2
autocmd FileType typescriptreact setlocal ts=2 sts=2 sw=2
autocmd FileType json setlocal ts=2 sts=2 sw=2
"-----------------------------------------------------------------------------
" Colors and layout
"-----------------------------------------------------------------------------
" tell VIM to always put a status line in, even if there is only one window
set laststatus=2
" Set the status line the way i like it
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n
" Fix slow regex engine for Typescript
set re=0
"set t_Co=256
"set term=xterm-256color
set number
"set background=light
"set listchars=tab:>-,trail:-,eol:$
set listchars=tab:▸\ ,eol:¬
syntax on
colorscheme default
"-----------------------------------------------------------------------------
" File stuff
"-----------------------------------------------------------------------------
" remember last cursor position
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Setting up the directories
set backup " backups are nice ...
set backupdir=$HOME/.vimbackup// " but not when they clog .
set viewdir=$HOME/.vimviews// " same for view files
set directory=$HOME/.vimswap// " same for swap files
" Creating directories if they don't exist
silent execute '!mkdir -p $HOME/.vimbackup'
silent execute '!mkdir -p $HOME/.vimswap'
silent execute '!mkdir -p $HOME/.vimviews'
"-----------------------------------------------------------------------------
" Plugin stuff
"-----------------------------------------------------------------------------
" Pathogen!
execute pathogen#infect()
" Mirror NERDTree across windows
autocmd BufWinEnter * NERDTreeMirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment