-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
194 lines (150 loc) · 4.97 KB
/
vimrc
File metadata and controls
194 lines (150 loc) · 4.97 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
set nocompatible
call pathogen#infect('~/.vim/bundle')
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" BASIC EDITING CONFIGURATION
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable filetype-specific indenting, syntax, and plugins
filetype plugin indent on
" COLOR SUPPORT
" Explicitly set 256 color support
syntax on
set t_Co=256
set background=light
set textwidth=120
set cc=+1
colorscheme jellybeans
if has('gui_running')
set guioptions-=T " no toolbar
set guioptions-=l " no left scrollbar
set guioptions-=L " no left scrollbar
set guioptions-=r " no right scrollbar
set guioptions-=R " no right scrollbar
endif
set guifont=Menlo:h13
" TEXT SETTINGS
" Disable line wrapping
set nowrap
" use indents of 2 spaces, and have them copied down lines:
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
" line numbers
set number
set numberwidth=3
" highlight current line
set cursorline
set cmdheight=2
" Open new horizontal split windows below current
set splitbelow
" Open new vertical split windows to the right
set splitright
" Set temporary directory (don't litter local dir with swp/tmp files)
set directory=/tmp/
" keep more context when scrolling off the end of a buffer
set scrolloff=5
" Disable backups
set nobackup
set nowritebackup
set noswapfile
" Hide stuffs
set hidden
" make tab completion for files/buffers act like bash
set wildmenu
" show the `best match so far' as search strings are typed:
set incsearch
set ignorecase
set smartcase
" KEY BINDINGS
let mapleader = ","
" RULERS
set ruler
""""""""""""""""""""""""""""""""""""""""
" Shell Settings
""""""""""""""""""""""""""""""""""""""""
set shell=/bin/sh
""""""""""""""""""""""""""""""""""""""""
" KEY BINDINGS
""""""""""""""""""""""""""""""""""""""""
" Move around splits with <c-hjkl>
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap ; :
" Insert a hash rocket with <c-l>
imap <c-l> <space>=><space>
"""""""""""""""""""""""""""""""""""""""
" ARDUINO
"""""""""""""""""""""""""""""""""""""""
au BufNewFile,BufRead *.pde setf arduino *
au BufNewFile,BufRead *.ino setf arduino *
au BufNewFile,BufReadPost *.pde set filetype=arduino
au BufNewFile,BufReadPost *.ino set filetype=arduino
map <silent> <LocalLeader>am :!make<CR>
map <silent> <LocalLeader>ac :!make clean<CR>
map <silent> <LocalLeader>au :!make upload<CR>
map <silent> <LocalLeader>aa :!make && make upload<CR>
"""""""""""""""""""""""""""""""""""""""
" MARKDOWN
"""""""""""""""""""""""""""""""""""""""
au BufNewFile,BufReadPost *.md set filetype=markdown
"""""""""""""""""""""""""""""""""""""""
" RUBY
"""""""""""""""""""""""""""""""""""""""
" Highlight ruby operators
let ruby_operators = 1
" Turn off rails bits of statusbar
" let g:rails_statusline=0
" Close taglist window if last file is closed
" let Tlist_Exit_OnlyWindow=1
""""""""""""""""""""""""""""""""""""""""""""
" AUTOCOMMANDS
""""""""""""""""""""""""""""""""""""""""""""
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
" kill trailing spaces when exiting file
fun! StripTrailingWhitespace()
" Don't strip on these filetypes
if &ft =~ 'markdown'
return
endif
%s/\s\+$//e
endfun
autocmd BufWritePre * call StripTrailingWhitespace()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" OPEN FILES IN DIRECTORY OF CURRENT FILE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>e :edit %%<CR>
map <leader>v :view %%
" For easy buffer toggling
map <Leader>, :b#<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Ctrl P
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"let g:ctrlp_map = '<Leader>t'
"let g:ctrlp_cmd = 'CtrlP
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CoffeeScript
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Configure Coffeescript folds
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NERDTree Helpers
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <C-n> :NERDTreeToggle<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ON THE GO MAPPINGS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Open document in Marked
:nnoremap <leader>m :silent !open -a Marked.app '%:p'<cr>
"Some help with optimizing .vimrc
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>ev :edit $MYVIMRC<cr>
"" Stop hitting that escape button all the time
inoremap <c-cr> <esc>
"" Some git commands
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>gc :Gcommit<cr>