Includes features such as: * `:Bundle`, which wraps `bundle`. * An internalized version of `bundle open`: `:Bopen` (and `:Bsplit`, `:Btabedit`, etc.). * `'path'` and `'tags'` are automatically altered to include all gems from your bundle. (Generate those tags with [gem-ctags](https://github.com/tpope/gem-ctags)!) * Highlight Bundler keywords in `Gemfile`. * Support for `gf` in `Gemfile.lock`, plus syntax highlighting that distinguishes between installed and missing gems.
142 lines
3.8 KiB
VimL
142 lines
3.8 KiB
VimL
" Leader
|
|
let mapleader = " "
|
|
|
|
set nocompatible " Use Vim settings, rather then Vi settings
|
|
set nobackup
|
|
set nowritebackup
|
|
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
|
|
set history=50
|
|
set ruler " show the cursor position all the time
|
|
set showcmd " display incomplete commands
|
|
set incsearch " do incremental searching
|
|
set laststatus=2 " Always display the status line
|
|
|
|
" Switch syntax highlighting on, when the terminal has colors
|
|
" Also switch on highlighting the last used search pattern.
|
|
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
|
|
syntax on
|
|
endif
|
|
|
|
" Declare bundles are handled via Vundle
|
|
filetype off " required!
|
|
set rtp+=~/.vim/bundle/vundle/
|
|
call vundle#rc()
|
|
|
|
" Let Vundle manage Vundle
|
|
Bundle 'gmarik/vundle'
|
|
|
|
" Define bundles via Github repos
|
|
Bundle 'croaky/vim-colors-github'
|
|
Bundle 'danro/rename.vim'
|
|
Bundle 'kchmck/vim-coffee-script'
|
|
Bundle 'kien/ctrlp.vim'
|
|
Bundle 'nanki/treetop.vim'
|
|
Bundle 'thoughtbot/vim-rspec'
|
|
Bundle 'timcharper/textile.vim'
|
|
Bundle 'tpope/vim-bundler'
|
|
Bundle 'tpope/vim-cucumber'
|
|
Bundle 'tpope/vim-endwise'
|
|
Bundle 'tpope/vim-fugitive'
|
|
Bundle 'tpope/vim-haml'
|
|
Bundle 'tpope/vim-markdown'
|
|
Bundle 'tpope/vim-rails'
|
|
Bundle 'tpope/vim-surround'
|
|
Bundle 'tsaleh/vim-matchit'
|
|
Bundle 'vim-scripts/ctags.vim'
|
|
Bundle 'vim-scripts/greplace.vim'
|
|
Bundle 'vim-scripts/tComment'
|
|
Bundle 'xenoterracide/html.vim'
|
|
|
|
filetype plugin indent on
|
|
|
|
augroup vimrcEx
|
|
au!
|
|
|
|
" For all text files set 'textwidth' to 78 characters.
|
|
autocmd FileType text setlocal textwidth=78
|
|
|
|
" When editing a file, always jump to the last known cursor position.
|
|
" Don't do it when the position is invalid or when inside an event handler
|
|
" (happens when dropping a file on gvim).
|
|
autocmd BufReadPost *
|
|
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
|
\ exe "normal g`\"" |
|
|
\ endif
|
|
augroup END
|
|
|
|
" Softtabs, 2 spaces
|
|
set tabstop=2
|
|
set shiftwidth=2
|
|
set expandtab
|
|
|
|
" Display extra whitespace
|
|
set list listchars=tab:»·,trail:·
|
|
|
|
" Use Ag (https://github.com/ggreer/the_silver_searcher) instead of Grep when
|
|
" available
|
|
if executable("ag")
|
|
set grepprg=ag\ --noheading\ --nogroup\ --nocolor
|
|
endif
|
|
|
|
" Color scheme
|
|
colorscheme github
|
|
highlight NonText guibg=#060606
|
|
highlight Folded guibg=#0A0A0A guifg=#9090D0
|
|
|
|
" Numbers
|
|
set number
|
|
set numberwidth=5
|
|
|
|
" Snippets are activated by Shift+Tab
|
|
let g:snippetsEmu_key = "<S-Tab>"
|
|
|
|
" Tab completion
|
|
" will insert tab at beginning of line,
|
|
" will use completion if not at beginning
|
|
set wildmode=list:longest,list:full
|
|
set complete=.,w,t
|
|
function! InsertTabWrapper()
|
|
let col = col('.') - 1
|
|
if !col || getline('.')[col - 1] !~ '\k'
|
|
return "\<tab>"
|
|
else
|
|
return "\<c-p>"
|
|
endif
|
|
endfunction
|
|
inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
|
|
|
|
" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
|
|
let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
|
|
|
|
" Index ctags from any project, including those outside Rails
|
|
map <Leader>ct :!ctags -R .<CR>
|
|
|
|
" Cucumber navigation commands
|
|
autocmd User Rails Rnavcommand step features/step_definitions -glob=**/* -suffix=_steps.rb
|
|
autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb -default=routes
|
|
|
|
" Switch between the last two files
|
|
nnoremap <leader><leader> <c-^>
|
|
|
|
" Get off my lawn
|
|
nnoremap <Left> :echoe "Use h"<CR>
|
|
nnoremap <Right> :echoe "Use l"<CR>
|
|
nnoremap <Up> :echoe "Use k"<CR>
|
|
nnoremap <Down> :echoe "Use j"<CR>
|
|
|
|
" Treat <li> and <p> tags like the block tags they are
|
|
let g:html_indent_tags = 'li\|p'
|
|
|
|
" Markdown files end in .md
|
|
au BufRead,BufNewFile *.md set filetype=markdown
|
|
|
|
" Enable spellchecking for Markdown
|
|
au BufRead,BufNewFile *.md setlocal spell
|
|
|
|
" Automatically wrap at 80 characters for Markdown
|
|
au BufRead,BufNewFile *.md setlocal textwidth=80
|
|
|
|
" Local config
|
|
if filereadable($HOME . "/.vimrc.local")
|
|
source ~/.vimrc.local
|
|
endif
|