forked from jsmestad/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
174 lines (132 loc) · 4.07 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
" Use Vim settings, rather then Vi settings. This setting must be as early as
" possible, as it has side effects.
set nocompatible
" Set map leader
let mapleader = ","
" NerdTree to show dot files
let NERDTreeShowHidden=1
" I dont want backups.
set nobackup
set nowritebackup
set noswapfile
set history=50
set hlsearch " highlight your search word
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
set autowrite " Automatically :write before running commands
" 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
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
filetype plugin indent on
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
set shell=/bin/zsh
" Numbers
set number
set numberwidth=5
color jellybeans
let g:ctrlp_custom_ignore = 'node_modules'
" Add Rails, Fugitive, and RVM info to statusline
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%{rbenv#statusline()}%=%-14.(%l,%c%V%)\ %P
" map to CtrlP
nnoremap <C-F> :CtrlP<cr>
let g:ctrlp_working_path_mode = '0'
" map to bufexplorer
nnoremap <C-B> :BufExplorer<cr>
let g:bufExplorerShowRelativePath=1
" Disable Syntastic for SASS/SCSS
let g:syntastic_disabled_filetypes = ['sass', 'scss']
" Disable persisting yankring
let g:yankring_persist=0
" Set Font
set guifont=PanicSans:h15
" vim-rspec mappings
nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
nnoremap <Leader>s :call RunNearestSpec()<CR>
nnoremap <Leader>l :call RunLastSpec()<CR>
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Create directional shortcuts for moving among between splits
nmap <C-j> <C-W>j
nmap <C-k> <C-W>k
nmap <C-l> <C-W>l
nmap <C-h> <C-W>h
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Easier window resizing
if bufwinnr(1)
map + <C-W>+
map - <C-W>-
end
" Remap jj or jk or to be the same as Esc to leave Insert mode.
imap ii <Esc>
" Tagbar
nmap <F8> :TagbarToggle<CR>
" NERDTree {{{
let NERDTreeDirArrows = 0
let NERDChristmasTree = 1
let NERDTreeHighlightCursorline = 1
let NERDTreeShowBookmarks = 1
let NERDTreeIgnore = ['\.pyc$', '\.pyo$', '\.rbc$', '\.class$', '\.o', '\~$']
let NERDTreeChDirMode = 2
nmap <F2> :NERDTreeToggle<CR>
map nt :NERDTreeToggle<CR>
" NERDCommenter
let NERDSpaceDelims = 1
let NERDRemoveAltComs = 0
" Syntastic
let g:syntastic_enable_signs = 1
let g:syntastic_quiet_messages = {'level': 'warnings'}
let g:syntastic_auto_loc_list = 2
" Gist
let g:gist_clip_command = 'pbcopy'
" Mouse
" ======
" Send more characters for redraws
set ttyfast
" Enable mouse use in all modes
set mouse=a
" Set this to the name of your terminal that supports mouse codes.
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
set ttymouse=xterm2
augroup vimrcEx
autocmd!
" automatically remove trailing whitespace before write
function! StripTrailingWhitespace()
normal mZ
%s/\s\+$//e
if line("'Z") != line(".")
echo "Stripped whitespace\n"
endif
normal `Z
endfunction
autocmd BufWritePre *.bldr,*.md,*.coffee,*.rake,*.js,*.rb,*.css,*.sass,*.scss,*.haml,*.erb,*.cpp,*.hpp,*.i :call StripTrailingWhitespace()
" Spell check Markdown and HTML
autocmd FileType html,markdown setlocal spelllang=en_us spell
" Automatically wrap at 80 characters for Markdown
autocmd BufRead,BufNewFile *.md setlocal textwidth=80
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile *.md set filetype=markdown
" Open NERDTree if no file specified
autocmd vimenter * if !argc() | NERDTree | endif
" hint to keep lines short
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
augroup END
" Local config
if filereadable($HOME . "/.vimrc.local")
source ~/.vimrc.local
endif