Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 138 lines (108 sloc) 3.905 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
8b7e4ee @derekprior Consolidate autocommands into the augroup
derekprior authored
27 autocmd!
b291659 @jferris Vim configuration
jferris authored
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
8b7e4ee @derekprior Consolidate autocommands into the augroup
derekprior authored
39
40 " Cucumber navigation commands
41 autocmd User Rails Rnavcommand step features/step_definitions -glob=**/* -suffix=_steps.rb
42 autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb -default=routes
43
44 " Set syntax highlighting for specific file types
45 autocmd BufRead,BufNewFile *.md set filetype=markdown
46
47 " Enable spellchecking for Markdown
48 autocmd BufRead,BufNewFile *.md setlocal spell
49
50 " Automatically wrap at 80 characters for Markdown
51 autocmd BufRead,BufNewFile *.md setlocal textwidth=80
b291659 @jferris Vim configuration
jferris authored
52 augroup END
53
54 " Softtabs, 2 spaces
55 set tabstop=2
56 set shiftwidth=2
57 set expandtab
58
59 " Display extra whitespace
60 set list listchars=tab:»·,trail:·
61
f854c8d Use Silver Searcher as CtrlP backend
Adarsh Pandit authored
62 " Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
63 if executable('ag')
64 " Use Ag over Grep
a2d8383 Remove double escaped spaces in vimrc
Adarsh Pandit authored
65 set grepprg=ag\ --nogroup\ --nocolor
f854c8d Use Silver Searcher as CtrlP backend
Adarsh Pandit authored
66
67 " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
68 let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
b291659 @jferris Vim configuration
jferris authored
69 endif
70
71 " Color scheme
de071e9 @croaky switch to github vim color scheme
croaky authored
72 colorscheme github
b291659 @jferris Vim configuration
jferris authored
73 highlight NonText guibg=#060606
74 highlight Folded guibg=#0A0A0A guifg=#9090D0
75
76 " Numbers
77 set number
78 set numberwidth=5
79
80 " Snippets are activated by Shift+Tab
81 let g:snippetsEmu_key = "<S-Tab>"
82
c7efed4 @croaky Fix tab completion
croaky authored
83 " Tab completion
5a4eb46 @wordofchristian Implement a smarter tab completion function
wordofchristian authored
84 " will insert tab at beginning of line,
85 " will use completion if not at beginning
b291659 @jferris Vim configuration
jferris authored
86 set wildmode=list:longest,list:full
87 set complete=.,w,t
5a4eb46 @wordofchristian Implement a smarter tab completion function
wordofchristian authored
88 function! InsertTabWrapper()
89 let col = col('.') - 1
90 if !col || getline('.')[col - 1] !~ '\k'
91 return "\<tab>"
92 else
93 return "\<c-p>"
94 endif
95 endfunction
96 inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
b291659 @jferris Vim configuration
jferris authored
97
c7efed4 @croaky Fix tab completion
croaky authored
98 " Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
b291659 @jferris Vim configuration
jferris authored
99 let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
100
c7efed4 @croaky Fix tab completion
croaky authored
101 " Index ctags from any project, including those outside Rails
102 map <Leader>ct :!ctags -R .<CR>
103
9b3e09e @croaky Switch between the last two files
croaky authored
104 " Switch between the last two files
105 nnoremap <leader><leader> <c-^>
b291659 @jferris Vim configuration
jferris authored
106
107 " Get off my lawn
108 nnoremap <Left> :echoe "Use h"<CR>
109 nnoremap <Right> :echoe "Use l"<CR>
110 nnoremap <Up> :echoe "Use k"<CR>
111 nnoremap <Down> :echoe "Use j"<CR>
112
7394978 @calebthompson Add vim-rspec mappings
calebthompson authored
113 " vim-rspec mappings
114 nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
115 nnoremap <Leader>s :call RunNearestSpec()<CR>
116 nnoremap <Leader>l :call RunLastSpec()<CR>
117
b291659 @jferris Vim configuration
jferris authored
118 " Treat <li> and <p> tags like the block tags they are
119 let g:html_indent_tags = 'li\|p'
120
d754170 Open new splits to the right/bottom
Adarsh Pandit authored
121 " Open new split panes to right and bottom, which feels more natural
122 set splitbelow
123 set splitright
124
9a0c71e @mcmire Add mappings to switch windows more succinctly
mcmire authored
125 " Quicker window movement
126 nnoremap <C-j> <C-w>j
127 nnoremap <C-k> <C-w>k
128 nnoremap <C-h> <C-w>h
129 nnoremap <C-l> <C-w>l
130
341b7c9 @derekprior Add syntastic for syntax checking
derekprior authored
131 " configure syntastic syntax checking to check on open as well as save
132 let g:syntastic_check_on_open=1
133
a666267 @gylaz Move `.vimrc.local` to the bottom of .vimrc
gylaz authored
134 " Local config
135 if filereadable($HOME . "/.vimrc.local")
136 source ~/.vimrc.local
137 endif
Something went wrong with that request. Please try again.