Skip to content

Instantly share code, notes, and snippets.

@donaldducky
Created July 10, 2011 04:00
Show Gist options
  • Save donaldducky/1074249 to your computer and use it in GitHub Desktop.
Save donaldducky/1074249 to your computer and use it in GitHub Desktop.
Don's vimrc
install pathogen
autoload/pathogen.vim
plugins installed:
ctrlp.vim
mustache.vim
snipMate
vim-colors-solarized
vim-fugitive
vim-surround
xml.vim
" coding preferences
"noremap <C-P> :!rake publish<CR>
" this ensures auto commands are reset when the .vimrc is sourced multiple times
autocmd!
" automatically do a syntax check on these files on save
au BufWritePost *.php !php -l <afile>
au BufWritePost *.rb !ruby -c <afile>
au BufWritePost Rakefile !ruby -c <afile>
au BufWritePost Vagrantfile !ruby -c <afile>
au BufRead,BufNewFile *.tpl set filetype=html.xhtml.javascript
au BufRead,BufNewFile *.phtml set filetype=html.xhtml.javascript.php.phtml
au BufRead,BufNewFile *.as set filetype=actionscript
au BufRead,BufNewFile *.json set filetype=json
au BufRead,BufNewFile *.md set filetype=mkd
au BufRead,BufNewFile Rakefile set filetype=ruby
au BufRead,BufNewFile Vagrantfile set filetype=ruby
" remove man page lookup...don't need this
noremap K <ESC>
" run PHP syntax check
noremap ; :!php -l %<CR>
" i never use ctrl+h to backspace, so remap it to toggle hlsearch
" TODO: change key mapping to an easier thing to press
noremap <C-H> :set hlsearch! hlsearch?<CR>
noremap <C-N> :set nu! nu?<CR>
noremap <F2> :so ~/.vimrc<CR>
noremap <F3> :set list! list?<CR>
noremap <F4> :set paste! paste?<CR>
" enable syntax coloring
syntax on
set encoding=utf-8
" tab preferences
set tabstop=2
set shiftwidth=2
set expandtab
" to see what these options are use
" :help command-name (ie. :help ruler)
set ruler
set uc=0
set incsearch
set hlsearch
" don't wrap at the end of search buffer
"set nowrapscan
set number
set textwidth=0
set nowrap
set foldenable
set foldmethod=marker
set foldlevel=0
set scrolljump=5
set scrolloff=1
set autoindent
set smartindent
set ignorecase
set smartcase
set formatoptions=qroct
set backspace=indent,eol,start
set laststatus=2
set statusline=
set statusline+=%a
set statusline+=\ %f "path of the filename
"set statusline+=\ %t "tail of the filename
set statusline+=\ %y "filetype
set statusline+=%h "help file flag
set statusline+=%m "modified flag
set statusline+=%r "read only flag
set statusline+=%= "left/right separator
set statusline+=[col\ %c,\ "cursor column
set statusline+=line\ %l\ of\ %L] "cursor line/total lines
set statusline+=\ %5P "percent through file
set statusline+=\ [%{&ff}:%{strlen(&enc)?&enc:'none'}] "file encoding
let mapleader = ","
let g:mapleader = ","
" plugin stuff
call pathogen#runtime_append_all_bundles()
filetype plugin on
" solarized color scheme
set background=dark
set t_Co=16
let g:solarized_termcolors=16
colorscheme solarized
" http://vim.wikia.com/wiki/Wrap_a_visual_selection_in_an_HTML_tag
" Wrap visual selection in an HTML tag.
vmap <Leader>w <Esc>:call VisualHTMLTagWrap()<CR>
function! VisualHTMLTagWrap()
let tag = input("Tag to wrap block: ")
if len(tag) > 0
normal `>
if &selection == 'exclusive'
exe "normal i</".tag.">"
else
exe "normal a</".tag.">"
endif
normal `<
exe "normal i<".tag.">"
normal `<
endif
endfunction
map <Leader>gb <Esc>:Gblame<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment