Skip to content

Instantly share code, notes, and snippets.

@bfitch
Created June 24, 2014 16:16
Show Gist options
  • Save bfitch/0cd75795e3eed8d4c317 to your computer and use it in GitHub Desktop.
Save bfitch/0cd75795e3eed8d4c317 to your computer and use it in GitHub Desktop.
new .vimrc with vundle changes
set nocompatible
filetype off
"-----------------VUNDLE ----------------------
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"let Vundle manage Vundle
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Railscasts-Theme-GUIand256color'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-rails'
Plugin 'vim-ruby/vim-ruby'
Plugin 'godlygeek/tabular'
Plugin 'kchmck/vim-coffee-script'
Plugin 'tpope/vim-cucumber'
Plugin 'kien/ctrlp.vim'
Plugin 'SuperTab'
Plugin 'briancollins/vim-jst'
Plugin 'leshill/vim-json'
Plugin 'pangloss/vim-javascript'
Plugin 'tComment'
Plugin 'ack.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
"-----------------------------------------------
set number
set noswapfile
set nobackup
set nowb
set guioptions-=r
set guioptions-=L
set guioptions-=T
set noerrorbells
set novisualbell
set t_vb=
autocmd! GUIEnter * set vb t_vb= " Turn off bell sound
set nowrap " Wrap long lines
set autoindent " Indent at the same level of the previous line
set copyindent " copy previous indentation
set shiftwidth=2 " Use indents of 4 spaces
set softtabstop=2 " Let backspace delete indent
set expandtab " Tabs are spaces, not tabs
set splitbelow
set splitright
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop
set incsearch " show search matches as you type
set hlsearch " highlight matches
"-----------------CTRL-P------------------------
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
:map <C-F> :CtrlPClearAllCaches<CR>
"-----------------------------------------------
let mapleader=" "
"---------------Cucumber Alignment--------------
" Align cucumber tables as you type
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
vmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a. :Tabularize /=><CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
"-----------------------------------------------
map <Leader>n :NERDTreeToggle<CR>
" Opens an edit command with the path of the currently edited file filled in
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
map <Leader>s :split <C-R>=expand("%:p:h") . "/" <CR>
map <Leader>v :vsplit <C-R>=expand("%:p:h") . "/" <CR>
" Window navigation
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-L> <C-W><C-L>
nmap <C-H> <C-W><C-H>
nmap tt <C-W>
" Turn on syntax highlighting when we have colors or gui is running
if &t_Co > 2 || has("gui_running") " &t_Co > 2 => we have colors
syntax on
set guifont=Monaco:h12
endif
set pastetoggle=<F2> " Hit <F2> to disable/enable autoindention for paste
:nnoremap <C-T> :!ctags -R --exclude=.git --exclude=log<CR> " Generate CTags file
colorscheme railscasts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment