Skip to content

Instantly share code, notes, and snippets.

@kristoferjoseph
Created April 2, 2013 16:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristoferjoseph/5293944 to your computer and use it in GitHub Desktop.
Save kristoferjoseph/5293944 to your computer and use it in GitHub Desktop.
Copy of my hand tuned .vimrc file
"PATHOGEN
execute pathogen#infect()
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
"RELOAD VIMRC
nmap <silent> <leader>sv :so $MYVIMRC<CR>
nmap <silent> <leader>ev :e $MYVIMRC<CR>
"LEADER
let mapleader=","
nnoremap ; :
inoremap jj <ESC>
"ESSENTIAL
set nocompatible
filetype plugin indent on
set modelines=0
runtime macros/matchit.vim
"COMING HOME
set encoding=utf-8
set scrolloff=3
set autoindent
set copyindent
set showmode
set showcmd
set hidden
set history=1000
set undolevels=1000
set wildignore=*.swp,*.bak,*.pyc,*.class
set title
set visualbell
set noerrorbells
set shortmess=atI
set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set relativenumber
set nobackup
set noswapfile
"THEME
color molokai
"SYNTAX
syntax on
set number
set tabstop=4
set shiftwidth=4
set shiftround "use multiple of shiftwidth when indenting with '<' and '>'
set softtabstop=4
set smarttab
set expandtab
"White space
"set list
nmap <leader>l :set list!<CR>
set listchars=tab:\|_,trail:.,extends:$,nbsp:.,eol:¬
"Remove extra whitespace on save
augroup prewrites
autocmd!
autocmd BufWritePre,FileWritePre * :%s/\s\+$//e | %s/\r$//e
augroup END
"Javascript
nmap <leader>j :JSBeautify<CR>
"Use Node.js for JavaScript interpretation
let $JS_CMD='node'
"Tell vim to use javascript syntax for JSON files
autocmd BufNewFile,BufRead *.json set ft=javascript
"SEARCH
nnoremap / /\v
vnoremap / /\v
set wildmenu
set wildmode=list:longest
set ignorecase
set smartcase
set gdefault
set showmatch
set incsearch
set infercase
set grepprg=ack\ --nogroup\ --column\ $*
set grepformat=%f:%l:%c:%m
nnoremap & :&&<CR> xnoremap & :&&<CR>
xnoremap * :<C-u>call <SID>VSetSearch()<CR>/<C-R>=@/<CR><CR>
xnoremap :<C-u>call <SID>VSetSearch()<CR>?<C-R>=@/<CR><CR>
function! s:VSetSearch()
let temp = @s
norm! gv"sy
let @/ = '\V' . substitute(escape(@s, '/\'), '\n', '\\n', 'g') let @s = temp
endfunction
nnoremap <leader>a !Ack
"HIGHLIGHTING
nmap <silent> ,<Space> :nohlsearch<CR>
set hlsearch
"JUMP TO BRACKETS
nnoremap <tab> %
vnoremap <tab> %
"COPY PASTE
"reselect the last text that was pasted
nnoremap <leader>v V`]
set clipboard=unnamed
set pastetoggle=<F2>
nnoremap <leader>y :YRShow<CR>
"NAVIGATION
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
"WINDOW
set winminheight=0
set winheight=999
"Jump between splits
:nmap <silent> <C-h> :wincmd h<CR>
:nmap <silent> <C-j> :wincmd j<CR>
:nmap <silent> <C-k> :wincmd k<CR>
:nmap <silent> <C-l> :wincmd l<CR>
"FILES
"Jump between buffers
:nmap <silent> [b :bprevious<CR>
:nmap <silent> ]b :bnext<CR>
:nmap <silent> [B :bfirst<CR>
:nmap <silent> ]B :blast<CR>
"Expansion to active file directory
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
"Save on focus out of file
au FocusLost * :wa
"Sudo write file after the fact
cmap w!! w !sudo tee % >/dev/null
"WRAP
set wrap
set textwidth=79
set formatoptions=qrn1
"set colorcolumn=85
"Markdown preview
function! s:setupMarkup()
nnoremap <leader>p :silent !open -a Marked.app '%:p'<cr>
endfunction
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment