Skip to content

Instantly share code, notes, and snippets.

@raine
Created February 28, 2012 10:17
Show Gist options
  • Select an option

  • Save raine/1931742 to your computer and use it in GitHub Desktop.

Select an option

Save raine/1931742 to your computer and use it in GitHub Desktop.
" colorscheme wombat256mod
" colorscheme neverland
" set bg=dark
" colorscheme molokai
syntax enable
set background=dark
" colorscheme solarized
colorscheme wombat256mod
call pathogen#runtime_append_all_bundles()
syntax on " Enable syntax highlighting
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
filetype off
filetype on
runtime macros/matchit.vim
let mapleader = ","
set expandtab
retab
set tabstop=2
set shiftwidth=2
set ignorecase
set smartcase
set smartindent
set autoindent
set list
set listchars=trail:·
set scrolloff=3
set hidden
set nostartofline
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set statusline=%<%f\ %h%m%r%=%t\ \|\ %-14.(%l,%c%V%)\ %P
set laststatus=2
set ruler
set t_Co=256
set guioptions=
set history=1000
set nowrap
" au WinLeave * set nocursorline
" au WinEnter * set cursorline
set cursorline
set autowrite
set visualbell
set cpt=.,w,b,u
set completeopt=menu
set wildmode=longest,list,full
set wildmenu
set autoread
set tildeop
set rnu
set foldmethod=syntax
set foldlevel=99
set fo-=t
set tw=77
set isk=@,48-57,192-255,$
" Fuck you too, manual key.
nnoremap K <nop>
au FocusLost * silent! :wa
set wildignore+=*.class,*.jar,vendor/**
au FileType ruby map <D-r> <Esc>:!ruby %<CR>
au FileType ruby map! <D-r> <Esc>:!ruby %<CR>
au FileType python map <D-r> <Esc>:!python %<CR>
au FileType python map! <D-r> <Esc>:!python %<CR>
au BufNewFile,BufRead *.less set filetype=less
au BufNewFile,BufRead *.jst set syntax=jst filetype=jst
au BufNewFile,BufRead *.rabl set syntax=ruby filetype=ruby
au FileType javascript setlocal noexpandtab tabstop=4 shiftwidth=4
au FileType less setlocal expandtab shiftwidth=2
au FileType jst setlocal expandtab shiftwidth=2
" noremap <unique> <script> <D-1> :call <SID>Bf_SwitchTo( 1)<CR>:<BS>
" noremap <unique> <script> <D-2> :call <SID>Bf_SwitchTo( 2)<CR>:<BS>
" noremap <unique> <script> <D-3> :call <SID>Bf_SwitchTo( 3)<CR>:<BS>
" noremap <unique> <script> <D-4> :call <SID>Bf_SwitchTo( 4)<CR>:<BS>
" noremap <unique> <script> <D-5> :call <SID>Bf_SwitchTo( 5)<CR>:<BS>
" noremap <unique> <script> <D-6> :call <SID>Bf_SwitchTo( 6)<CR>:<BS>
" noremap <unique> <script> <D-7> :call <SID>Bf_SwitchTo( 7)<CR>:<BS>
" noremap <unique> <script> <D-8> :call <SID>Bf_SwitchTo( 8)<CR>:<BS>
" noremap <unique> <script> <D-9> :call <SID>Bf_SwitchTo( 9)<CR>:<BS>
" noremap <unique> <script> <D-0> :call <SID>Bf_SwitchTo( 10)<CR>:<BS>
" map <D-1> :tabn 1<CR>
" map <D-2> :tabn 2<CR>
" map <D-3> :tabn 3<CR>
" map <D-4> :tabn 4<CR>
" map <D-5> :tabn 5<CR>
" map <D-6> :tabn 6<CR>
" map <D-7> :tabn 7<CR>
" map <D-8> :tabn 8<CR>
" map <D-9> :tabn 9<CR>
" map! <D-1> <C-O>:tabn 1<CR>
" map! <D-2> <C-O>:tabn 2<CR>
" map! <D-3> <C-O>:tabn 3<CR>
" map! <D-4> <C-O>:tabn 4<CR>
" map! <D-5> <C-O>:tabn 5<CR>
" map! <D-6> <C-O>:tabn 6<CR>
" map! <D-7> <C-O>:tabn 7<CR>
" map! <D-8> <C-O>:tabn 8<CR>
" map! <D-9> <C-O>:tabn 9<CR>
" Reselect visual block after indent/outdent
vnoremap < <gv
vnoremap > >gv
nnoremap <space>w :w<CR>
imap <C-space> <Esc>
map! <C-space> <Esc>
nmap qc :QuickFixClear<CR>
nmap qk :cprev<CR>
nmap qj :cnext<CR>
" nmap <leader>qp :cprev<CR>
" nmap <leader>qn :cnext<CR>
nmap <leader>ba :bufdo bdelete<CR>
nmap <leader>b :Bclose<CR>
nmap <leader>bc :Bclose<CR>
nmap <leader>b! :Bclose!<CR>
nmap <leader>bc! :Bclose!<CR>
nmap <leader>zz :wqa<CR>
nmap <leader>log :s/;\?$//<CR>:nohl<CR>ciWconsole.log(<C-R>");<Esc>
vmap <leader>log :s/;\?$//<CR>:nohl<CR>cconsole.log(<C-R>");<Esc>
nmap <leader>lod :s/;\?$//<CR>:nohl<CR>ciWconsole.dir(<C-R>");<Esc>
vmap <leader>lod :s/;\?$//<CR>:nohl<CR>cconsole.dir(<C-R>");<Esc>
" nmap <leader>dl ds(:s/console\.log//<CR>:s/;$//<CR>:nohl<CR>
" nmap <leader>dl :s/console\.log(//<CR>:s/);$//<CR>:nohl<CR>
" nmap <leader>dl :s/console.\(log\\|dir\)(//<CR>:s/);*$//<CR>:nohl<CR>
nmap <leader>dl :s/console.\(log\\|dir\)(//<CR>:s/);*$//<CR>:nohl<CR>
nmap <C-space> :s/;\?$/;/<CR>:nohl<CR>
" nmap <leader>; :s/;\?$/;/<CR>:nohl<CR>``
nmap Q <Nop>
nmap <leader>sl ^v$<Left>
nmap <leader>gst :Gstatus<CR>
nmap <leader>gc :Gcommit<CR>
nmap <leader>gd :Gdiff<CR>
nmap <leader>gb :Gblame<CR>
nmap <leader>gr :Gread<CR>
nmap <leader>gap :Git add --patch<CR>
nmap <leader>gapp :Git add --patch %<CR>
" The following beast is something i didn't write... it will return the
" syntax highlighting group that the current "thing" under the cursor
" belongs to -- very useful for figuring out what to change as far as
" syntax highlighting goes.
nmap <leader>syn :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name")
\ . '> trans<' . synIDattr(synID(line("."),col("."),0),"name")
\ . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name")
\ . ">"<CR>
map <leader>a :Ack! ''<Left>
nmap <leader>1 :%s/\<<C-r><C-w>\>//gc<Left><Left><Left>
" nnoremap <F2> :<C-u>FufRenewCache<CR>
" nnoremap <C-t> :<C-u>FufFile **/<CR>
" nnoremap <C-s> :<C-u>FufBuffer<CR>
nnoremap <leader>m :<C-u>TagbarOpen<CR>
" inoremap "" ""<Esc>i
" inoremap '' ''<Esc>i
" inoremap <> <><Esc>i
" inoremap () ()<Esc>i
" inoremap {} {}<Esc>i
" inoremap [] []<Esc>i
onoremap ix i[
onoremap ax a[
onoremap an :<c-u>call <SID>NextTextObject('a', 'f')<cr>
xnoremap an :<c-u>call <SID>NextTextObject('a', 'f')<cr>
onoremap in :<c-u>call <SID>NextTextObject('i', 'f')<cr>
xnoremap in :<c-u>call <SID>NextTextObject('i', 'f')<cr>
onoremap al :<c-u>call <SID>NextTextObject('a', 'F')<cr>
xnoremap al :<c-u>call <SID>NextTextObject('a', 'F')<cr>
onoremap il :<c-u>call <SID>NextTextObject('i', 'F')<cr>
xnoremap il :<c-u>call <SID>NextTextObject('i', 'F')<cr>
function! s:NextTextObject(motion, dir)
let c = nr2char(getchar())
if c ==# "b"
let c = "("
elseif c ==# "B"
let c = "{"
elseif c ==# "d"
let c = "["
endif
exe "normal! ".a:dir.c."v".a:motion.c
endfunction
set guifont=Inconsolata:h12
set hlsearch
set incsearch " ...dynamically as they are typed.
" Intuitive backspacing in insert mode
set backspace=indent,eol,start
set timeoutlen=300
set listchars=tab:>-,trail:·,eol:$
nmap <silent> <leader>s :set nolist!<CR>
nmap <silent> <leader>n :silent :nohlsearch<CR>
set nolist!
" Save without sudoing originally
command! -bar -nargs=0 SudoW :silent exe “write !sudo tee % >/dev/null” | silent edit!
let NERDSpaceDelims = "2"
let NERDDefaultNesting = "0"
let NERDDefaultAlign = 'left'
" let g:CommandTMaxHeight = "30"
" let g:CommandTMatchWindowAtTop = "1"
"
map ,omg <plug>NERDCommenterComment
nnoremap <leader>nt :NERDTreeToggle<CR>
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplorerMoreThanOne = 1
" let g:ackprg="ack\\ -H\\ -i\\ --nocolor\\ --nogroup \\--column"
" let g:ackprg="ack-grep -H --nocolor --nogroup --column"
let g:tagbar_ctags_bin = '/usr/local/Cellar/ctags/5.8/bin/ctags'
let Tlist_Ctags_Cmd = '/usr/local/Cellar/ctags/5.8/bin/ctags'
let Tlist_Show_Menu = 1
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
let g:fuf_modesDisable = []
let g:fuf_buffertag_ctagsPath = '/usr/local/Cellar/ctags/5.8/bin/ctags'
let g:ctrlp_map = '<c-t>' " Leave this empty to disable the default mapping
" let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 0
let g:ctrlp_prompt_mappings = {
\ 'PrtBS()': ['<bs>', '<c-]>', '<c-h>'],
\ 'PrtCurLeft()': ['<left>', '<c-^>'],
\ }
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
" let g:ctrlp_custom_ignore = {
" \ 'dir': '\.git$\|\.hg$\|\.svn$',
" \ 'file': '\.exe$\|\.so$\|\.dll$',
" \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
" \ }
let g:ctrlp_max_height = 20
let g:ctrlp_match_window_bottom = 1
vmap <Leader>t= :Tabularize /^[^=]*\zs=\+>\?/<CR>
" vmap <Leader>a= :Tabularize /=<CR>
" nmap <Leader>a: :Tabularize /:\zs<CR>
" vmap <Leader>a: :Tabularize /:\zs<CR>
"
map <leader>t :!ctags -f tags --recurse --languages=ruby<CR>:FufTag<CR>
" map <F2> <Esc>:1,$!xmllint --format -<CR>
map <F3> <Esc>:%!json_xs -f json -t json-pretty<CR>
map <leader>ff <Esc>zfaB
function! ConditionalPairMap(open, close)
let line = getline('.')
let col = col('.')
if col < col('$') || stridx(line, a:close, col + 1) != -1
return a:open
else
return a:open . a:close . repeat("\<left>", len(a:close))
endif
endf
inoremap <expr> ( ConditionalPairMap('(', ')')
inoremap <expr> { ConditionalPairMap('{', '}')
inoremap <expr> [ ConditionalPairMap('[', ']')
" Jump over )
inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
inoremap <expr> ] strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]"
inoremap <expr> } strpart(getline('.'), col('.')-1, 1) == "}" ? "\<Right>" : "}"
" double percentage sign in command mode is expanded
" to directory of current file - http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>
nnoremap <F5> :silent! let &guifont = substitute(
\ &guifont,
\ ':h\zs\d\+',
\ '\=eval(submatch(0)+1)',
\ '')<CR>
nnoremap <F4> :silent! let &guifont = substitute(
\ &guifont,
\ ':h\zs\d\+',
\ '\=eval(submatch(0)-1)',
\ '')<CR>
hi MBENormal guifg=#938776
hi MBEChanged guifg=#938776
" MBEVisibleNormal
" MBEVisibleChanged
" hi MBEChanged guibg=darkblue ctermbg=darkblue termbg=white
"
let g:fuf_file_exclude = 'tmp/|\v\~$|\.o$|\.exe$|\.bak$|\.swp|\.class$|\.png$|\.jpg$|\.min.js$'
let g:Tb_MaxSize = 4
let g:Tb_TabWrap = 1
let g:sparkupNextMapping = '<c-l>'
autocmd User Rails/**/*.js set sw=4 noexpandtab ts=4 softtabstop=4
let g:Powerline_symbols = 'fancy'
let g:LustyJugglerAltTabMode = 1
let g:LustyJugglerShowKeys = 'a'
" let g:LustyJugglerShowKeys = 1
nmap <leader>l :LustyJuggler<CR>
map <leader>r :w\|:call CtrlC_to_Tmux()\|:call Send_to_Tmux(run . "\n")<CR>
map <leader>e :call CtrlC_to_Tmux()<CR>
map <leader>w :w<CR>
map <space>y "+y
map <space>p "+p
" function! CleanupJSObj()
" '<,'>s/,\?$/,/
" s/,,\?$//
" exe "normal! \<esc>"
" nohl
" endfunction
" nnoremap <leader>j :call CleanupJSObj()<CR>
source ~/.vimrc.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment