Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created September 29, 2019 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/e1c851f4bfc7d3ad9fda3813f3a98dcd to your computer and use it in GitHub Desktop.
Save isaacs/e1c851f4bfc7d3ad9fda3813f3a98dcd to your computer and use it in GitHub Desktop.
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
call plug#end()
set nu
set encoding=utf-8
let mapleader=","
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
set list listchars=tab:\ \ ,trail:·
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc
" Status bar
" set laststatus=2
" ZoomWin configuration
map <Leader>z :ZoomWin<CR>
" make and python use real tabs
au FileType make set noexpandtab
au FileType python set noexpandtab
au FileType markdown set textwidth=75
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" load the plugin and indent settings for the detected filetype
filetype plugin indent on
" Use modeline overrides
set modeline
set modelines=10
" Default color scheme
color default
set regexpengine=1
syntax enable
set mouse=a
set ruler
set term=xterm-256color
color fruit
color camo
color desertEx
" when using a projector, use a light color scheme and no syntax
function Pres ()
:colorscheme dawn
:syntax off
endfunction
map <Leader>pres :call Pres()<CR>
command! -range DY call DateYaml()
function DateYaml ()
read !echo "date: $(node -p 'new Date().toISOString()')"
endfunction
map <Leader>dy :DY<CR>
set nohls
set hls
noremap <Leader><Space> :noh<CR>:call clearmatches()<CR>
noremap <Leader>. :%s/\v +$//g<CR>
" map <Leader>. :tabn<CR>
" this makes it use the system clipboard
" whenever yanking to the "unnamed" register.
set clipboard=unnamed
set wrap
" set modelines=0
set tabstop=2
set expandtab
set softtabstop=2
set shiftwidth=2
set expandtab
set cul
set nocul
set ttyfast
set autoindent
set showmode
set showcmd
set visualbell
nnoremap / /\v
vnoremap / /\v
if exists("&colorcolumn")
set colorcolumn=80
endif
nnoremap j gj
nnoremap k gk
" make xX use the "x" register, rather than the default register
" d already deletes and yanks to the default register
noremap x "xx
noremap X "xX
" make cC yank to the "c" register.
" it's rare that you want to correct and then re-paste, but possible.
noremap c "cc
noremap C "cC
" this bit makes Q, W and WQ work just like their lowercase counterparts
com -bang Q q<bang>
com -bang W w<bang> <args>
com -bang WQ wq<bang> <args>
com -bang Wq wq<bang> <args>
com -bang WQa wqa<bang> <args>
com -bang Wqa wqa<bang> <args>
com -bang WQA wqa<bang> <args>
" super annoying typos if you maintain a pacakge manager
iab pacakges packages
iab pacakge package
iab verison version
iab verisons versions
iab nodE_modules node_modules
iab teh the
iab hte the
iab wiht with
iab eaisly easily
iab ofr for
" shift to move the window, not the cursor.
inoremap JJJJ <Esc><C-e><C-e><C-e>
inoremap KKKK <Esc><C-y><C-y><C-y>
inoremap HHHH <Esc>zhzhzhzhzhzh
inoremap LLLL <Esc>zlzlzlzlzlzl
map J <C-e>
map K <C-y>
map H zhzh
map L zlzl
" control to switch windows
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-h> <C-w>h
map <C-l> <C-w>l
" f1, you are my nemesis.
map <F1> <Esc>
imap <F1> <Esc>
" escape is so far away
noremap <Leader>m <Esc>
inoremap <Leader>m <Esc>
" node files are javascript
au! BufNewFile,BufRead,BufWrite * if getline(1) =~ '^\#!.*node' | setf javascript | endif
" italic comments
set t_ZH=
set t_ZR=
highlight Comment cterm=italic gui=italic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment