Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 126 lines (99 sloc) 3.51 kb
675f4d8 @croaky Map Leader to Space
croaky authored
1 " Leader
2 let mapleader = " "
3
b291659 @jferris Vim configuration
jferris authored
4 set nocompatible " Use Vim settings, rather then Vi settings
5 set nobackup
6 set nowritebackup
61222a4 @gabebw Direct link to why we set noswap
gabebw authored
7 set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
b291659 @jferris Vim configuration
jferris authored
8 set history=50
9 set ruler " show the cursor position all the time
10 set showcmd " display incomplete commands
11 set incsearch " do incremental searching
12 set laststatus=2 " Always display the status line
13
14 " Switch syntax highlighting on, when the terminal has colors
15 " Also switch on highlighting the last used search pattern.
16 if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
17 syntax on
18 endif
19
deb7ee5 @calebthompson Move Bundles into a separate file
calebthompson authored
20 if filereadable(expand("~/.vimrc.bundles"))
21 source ~/.vimrc.bundles
22 endif
126344c @croaky Install Vundle
croaky authored
23
b291659 @jferris Vim configuration
jferris authored
24 filetype plugin indent on
25
26 augroup vimrcEx
27 au!
28
29 " For all text files set 'textwidth' to 78 characters.
30 autocmd FileType text setlocal textwidth=78
31
32 " When editing a file, always jump to the last known cursor position.
5fb4052 @derekprior Don't remember cursor position for commit messages
derekprior authored
33 " Don't do it for commit messages, when the position is invalid, or when
34 " inside an event handler (happens when dropping a file on gvim).
b291659 @jferris Vim configuration
jferris authored
35 autocmd BufReadPost *
5fb4052 @derekprior Don't remember cursor position for commit messages
derekprior authored
36 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
b291659 @jferris Vim configuration
jferris authored
37 \ exe "normal g`\"" |
38 \ endif
39 augroup END
40
41 " Softtabs, 2 spaces
42 set tabstop=2
43 set shiftwidth=2
44 set expandtab
45
46 " Display extra whitespace
47 set list listchars=tab:»·,trail:·
48
1f4e6d1 @gabebw Use ag instead of ack
gabebw authored
49 " Use Ag (https://github.com/ggreer/the_silver_searcher) instead of Grep when
50 " available
51 if executable("ag")
7aac1f8 @gylaz Remove --noheading flag from ag execution
gylaz authored
52 set grepprg=ag\ --nogroup\ --nocolor
b291659 @jferris Vim configuration
jferris authored
53 endif
54
55 " Color scheme
de071e9 @croaky switch to github vim color scheme
croaky authored
56 colorscheme github
b291659 @jferris Vim configuration
jferris authored
57 highlight NonText guibg=#060606
58 highlight Folded guibg=#0A0A0A guifg=#9090D0
59
60 " Numbers
61 set number
62 set numberwidth=5
63
64 " Snippets are activated by Shift+Tab
65 let g:snippetsEmu_key = "<S-Tab>"
66
c7efed4 @croaky Fix tab completion
croaky authored
67 " Tab completion
5a4eb46 @wordofchristian Implement a smarter tab completion function
wordofchristian authored
68 " will insert tab at beginning of line,
69 " will use completion if not at beginning
b291659 @jferris Vim configuration
jferris authored
70 set wildmode=list:longest,list:full
71 set complete=.,w,t
5a4eb46 @wordofchristian Implement a smarter tab completion function
wordofchristian authored
72 function! InsertTabWrapper()
73 let col = col('.') - 1
74 if !col || getline('.')[col - 1] !~ '\k'
75 return "\<tab>"
76 else
77 return "\<c-p>"
78 endif
79 endfunction
80 inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
b291659 @jferris Vim configuration
jferris authored
81
c7efed4 @croaky Fix tab completion
croaky authored
82 " Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
b291659 @jferris Vim configuration
jferris authored
83 let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
84
c7efed4 @croaky Fix tab completion
croaky authored
85 " Index ctags from any project, including those outside Rails
86 map <Leader>ct :!ctags -R .<CR>
87
b291659 @jferris Vim configuration
jferris authored
88 " Cucumber navigation commands
89 autocmd User Rails Rnavcommand step features/step_definitions -glob=**/* -suffix=_steps.rb
90 autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb -default=routes
d57e450 @gabebw Add :Cuc
gabebw authored
91
9b3e09e @croaky Switch between the last two files
croaky authored
92 " Switch between the last two files
93 nnoremap <leader><leader> <c-^>
b291659 @jferris Vim configuration
jferris authored
94
95 " Get off my lawn
96 nnoremap <Left> :echoe "Use h"<CR>
97 nnoremap <Right> :echoe "Use l"<CR>
98 nnoremap <Up> :echoe "Use k"<CR>
99 nnoremap <Down> :echoe "Use j"<CR>
100
7394978 @calebthompson Add vim-rspec mappings
calebthompson authored
101 " vim-rspec mappings
102 nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
103 nnoremap <Leader>s :call RunNearestSpec()<CR>
104 nnoremap <Leader>l :call RunLastSpec()<CR>
105
b291659 @jferris Vim configuration
jferris authored
106 " Treat <li> and <p> tags like the block tags they are
107 let g:html_indent_tags = 'li\|p'
108
49f16b1 @croaky Bundle vim-ruby/vim-ruby
croaky authored
109 " Set syntax highlighting for specific file types
84ce5cc @jferris Improve Markdown integration
jferris authored
110 au BufRead,BufNewFile *.md set filetype=markdown
80b77cd @croaky Run specs directly from vim
croaky authored
111
7adb116 @jferris Easier editing for Markdown files
jferris authored
112 " Enable spellchecking for Markdown
113 au BufRead,BufNewFile *.md setlocal spell
114
115 " Automatically wrap at 80 characters for Markdown
116 au BufRead,BufNewFile *.md setlocal textwidth=80
a666267 @gylaz Move `.vimrc.local` to the bottom of .vimrc
gylaz authored
117
d754170 Open new splits to the right/bottom
Adarsh Pandit authored
118 " Open new split panes to right and bottom, which feels more natural
119 set splitbelow
120 set splitright
121
a666267 @gylaz Move `.vimrc.local` to the bottom of .vimrc
gylaz authored
122 " Local config
123 if filereadable($HOME . "/.vimrc.local")
124 source ~/.vimrc.local
125 endif
Something went wrong with that request. Please try again.