Skip to content

Instantly share code, notes, and snippets.

@jhsu
Created March 16, 2010 03:11
Show Gist options
  • Save jhsu/333597 to your computer and use it in GitHub Desktop.
Save jhsu/333597 to your computer and use it in GitHub Desktop.
if has('gui')
set t_Co=256
end
colorscheme xoria256
set shiftwidth=2
set tabstop=2
set softtabstop=2
set noexpandtab
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
" filetype plugin indent on " Enable filetype-specific indenting and plugins
runtime! autoload/pathogen.vim
if exists('g:loaded_pathogen')
call pathogen#runtime_prepend_subdirectories(expand('~/.vimbundles'))
end
set guifont="Inconsolata 14"
set viminfo^=!
set clipboard+=unnamed
set history=1000 " have fifty lines of command-line (etc) history:
" Intuitive backspacing in insert mode
" set backspace=indent,eol,start
set bs=2 " Allow backspacing over anything
set nobackup " Don't leave backup files (swp is good)
set complete=.,w,b,t " Word completion rules
" set noruler
" set modeline
set number
" display the current mode and partially-typed commands in the status line:
" set showmode
" set showcmd
runtime! macros/matchit.vim " Load matchit (% to bounce from do to end, etc.)
let &guicursor = &guicursor . ",a:blinkon0" " stops blink wake up
augroup myfiletypes
autocmd FileType ruby,eruby,yaml,ru set ai sw=2 sts=2 ts=2 noet
autocmd FileType html,css set ai sw=2 sts=2 ts=2 noet
autocmd FileType php set ai sw=2 sts=2 ts=2 noet
" autocmd FileType css
augroup END
" some tips taken from http://items.sjbach.com/319/configuring-vim-right
set hidden
nnoremap ' `
nnoremap ` '
let mapleader = ","
set wildmenu
" make searches case-insensitive, unless they contain upper-case letters:
set ignorecase
set smartcase
" store swp elsewhere for backup
set backupdir=~/.vim-tmp
set directory=~/.vim-tmp
"faster scrolling using <C-e> and <C-y>
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" bash hotkeys
vmap <C-c> y
vmap <C-x> x
imap <C-v> <esc>p
" FuzzyFinder TextMate
" map <leader>t :FuzzyFinderTextMate<CR>
" map <leader>b :FuzzyFinderBuffer<CR>
" " let g:fuzzy_ignore=*.log,*.swp,*.db
" let g:fuzzy_matching_limit=70
" NERD_tree
map <leader>d :execute 'NERDTreeToggle ' . getcwd()<CR>
" highlight search
set hlsearch
set incsearch " as you type
set shortmess=atI " rid interruptive prompts
set visualbell
set nobackup " Don't leave backup files (swp is good)
set complete=.,w,b,t " Word completion rules
" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd
let &guicursor = &guicursor . ",a:blinkon0" " stops blink wake up
" don'tmake it look like there are line breaks where there aren't:
set wrap
if has("statusline")
highlight GoodMsg guifg=magenta
let g:git_branch_status_head_current=1
set laststatus=2
set statusline=%<%F%#GoodMsg#%{GitBranchInfoString()}%#StatusLine#%=%([%M%R%H%W]\ %)%l,%c%V\ %P\ (%n)
endif " set statusline format
set showbreak=\\ " show line break
" normally don't automatically format `text' as it is typed, IE only do this
" with comments, at 79 characters:
" set formatoptions-=t
" have the h and l cursor keys wrap between lines (like <Space> and <BkSpc> do
" by default), and ~ covert case over line breaks; also have the cursor keys
" wrap in insert mode:
set whichwrap=h,l,~,[,]
" page down with <Space> (like in `Lynx', `Mutt', `Pine', `Netscape Navigator',
" `SLRN', `Less', and `More'); page up with - (like in `Lynx', `Mutt', `Pine'),
" or <BkSpc> (like in `Netscape Navigator'):
noremap <Space> <PageDown>
noremap <BS> <PageUp>
noremap - <PageUp>
" [<Space> by default is like l, <BkSpc> like h, and - like k.]
" use <F6> to cycle through split windows (and <Shift>+<F6> to cycle backwards,
" where possible):
nnoremap <F6> <C-W>w
nnoremap <S-F6> <C-W>W
" use <Ctrl>+N/<Ctrl>+P to cycle through files:
nnoremap <C-N> :next<CR>
nnoremap <C-P> :prev<CR>
" [<Ctrl>+N by default is like j, and <Ctrl>+P like k.]
" have % bounce between angled brackets, as well as t'other kinds:
set matchpairs+=<:>
map j gj
map k gk
nnoremap <F1> :help<Space>
vmap <F1> <C-C><F1>
omap <F1> <C-C><F1>
map! <F1> <C-C><F1>
" RUBY
autocmd FileType ruby map <buffer> <leader><space> :w!<cr>:!ruby %<cr>
" Snippets
imap <C-q> <C-]>
" HTML
let html_use_css = 1
let use_xhtml = 1
au FileType html set syntax=html
""""""""""""""""""""""""""""""
" HTML
"""""""""""""""""""""""""""""""
"autocmd FileType html inorea <buffer> cahref <c-r>=IMAP_PutTextWithMovement('<a href=""><++></a>')<cr>
"autocmd FileType html inorea <buffer> cbold <c-r>=IMAP_PutTextWithMovement('<b><++></b>')<cr>
"autocmd FileType html inorea <buffer> cimg <c-r>=IMAP_PutTextWithMovement('<img src="<++>" alt="<++>" />')<cr>
"autocmd FileType html inorea <buffer> cpara <c-r>=IMAP_PutTextWithMovement('<p><++></p>')<cr>
"autocmd FileType html inorea <buffer> ctag <c-r>=IMAP_PutTextWithMovement('<<++>><++></<++>>')<cr>
"autocmd FileType html inorea <buffer> ctag1 <c-r>=IMAP_PutTextWithMovement("<<++>><cr><++><cr></<++>>")<cr>
map <C-T> <Esc>:tabnew<CR>
" Indent XML readably
" function! DoPrettyXML()
" 1,$!xmllint --format --recover -
" endfunction
" command! PrettyXML call DoPrettyXML()
" miniBufExplorer
" allow <C-Tab> and <C-S-Tab>
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplUseSingleClick = 1
" Rails
" Change which file opens after executing :Rails command
let g:rails_default_file='config/database.yml'
" detect if gui
" if has("gui_running")
" endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment