Skip to content

Instantly share code, notes, and snippets.

@grahams
Created July 16, 2013 20:23
Show Gist options
  • Save grahams/6012316 to your computer and use it in GitHub Desktop.
Save grahams/6012316 to your computer and use it in GitHub Desktop.
" .vimrc
" Originally Jon Parise
" Modified by Sean Graham
set encoding=utf-8
if file_readable(expand("~/.vimrc_local"))
source ~/.vimrc_local
endif
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
map x05 !par
" General configuration settings
"
set backupcopy=yes
set noautoindent " turn autoindenting off
set autowrite " auto-save before running external commands
set nobackup " turn backups off
set backspace=2 " smarter backspace
set nocompatible " turn off full vi compatibility
set cpoptions=aABceF " vi compatibility options
set noerrorbells " turn off error bells
set esckeys " allows cursor keys in insert mode
set formatoptions=cqrt " options for "text format" ("gp")
set helpheight=0 " disable help
set nohlsearch " turn off search result highlighting
set noignorecase " don't ignore case in search patterns
set noinsertmode " don't start vim in insertmode
set joinspaces " insert two spaces after period when joining lines
set laststatus=0 " always show status line
set nolist " turn off extended character listing
set magic " use extended regexp in search patterns
set nonumber " don't number lines
set report=0 " show all changes
set noruler " show cursor position
set shortmess=atI " abbreviate all messages
set noshowcmd " don't show incomplete commands
set showmode " show the current mode
set suffixes=.class " ignore filesnames with these suffixes
set nostartofline " don't jump to first char with page commands
set textwidth=76 " set the maximum text width
set notitle " suppress title messages
set t_vb= " turn off terminal's visual bell
set visualbell " replace audible bells with visual bells
set wildchar=<TAB> " character used for command line expansion
set wrapmargin=5 " wrap from the right margin
set nowritebackup " don't write backups
set columns=80 " sets the number of columns displayed
set tabstop=4 " set the tab stop
set expandtab " expand tabs to spaces
set shiftwidth=4 " number of spaces in each indent
set softtabstop=4 " treat spaces as virtual tabs
set diffopt=filler,iwhite
let mapleader=','
" Shortcut to rapidly toggle "set list" and use Textmate symbols
nmap <leader>l : set list!<CR>
set listchars=tab:▸\ ,eol:¬
nnoremap <leader>h <Esc>:call ToggleHardMode()<CR>
" Shortcuts to rapidly edit files in the directory containing the current
" open file. From: http://vimcasts.org/episodes/the-edit-command/
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>ew :e %%
map <leader>es :sp %%
map <leader>ev :vsp %%
map <leader>et :tabe %%
" map Clover-[0-9], etc. to tab switching
map <D-S-]> gt
map <D-S-[> gT
map <D-1> 1gt
map <D-2> 2gt
map <D-3> 3gt
map <D-4> 4gt
map <D-5> 5gt
map <D-6> 6gt
map <D-7> 7gt
map <D-8> 8gt
map <D-9> 9gt
map <D-0> :tablast<CR>
if has("unix")
nmap xr :r $HOME/.vimxfer<CR>
nmap xw :'a,.w! $HOME/.vimxfer<CR>
vmap xr c<esc>:r $HOME/.vimxfer<CR>
vmap xw :w! $HOME/.vimxfer<CR>
else
nmap xr :r c:\Temp\.vimxfer<CR>
nmap xw :'a,.w! c:\Temp\.vimxfer<CR>
vmap xr c<esc>:r c:\Temp\.vimxfer<cr>
vmap xw :w! c:\Temp\.vimxfer<CR>
endif
syntax on
syntax off
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
map <C-L> :%!xmllint --format -<CR> :set filetype=xml<CR>
" bindings for Tern
" XXX: Should be limited to JS files
map <D-®> :TernRename<CR>
map <F3> :TernDefPreview<CR>
map <D-R> :TernRefs<CR>
function! PostPlugins()
" Set up bindings for Tabularize
if exists(":Tabularize")
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
endif
endfunction
" Gist plugin settings
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_post_private = 1
if has("autocmd")
filetype on
filetype plugin on
autocmd FileType c,cpp,js,java,php,css,javascript set formatoptions=cqrto
\ cindent comments=sr:/*,mb:*,ex:*/,://
" Treat .rss files as XML
autocmd BufNewFile,BufRead *.rss setfiletype xml
" Enter hardmode by default
" autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode()
" Syntax of these languages is fussy over tabs Vs spaces
" autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
" autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Customisations based on house-style (arbitrary)
" autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
" autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
" autocmd FileType javascript setlocal ts=4 sts=4 sw=4 noexpandtab
autocmd VimEnter * :call PostPlugins()
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment