summaryrefslogtreecommitdiff
path: root/.vimrc
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2010-12-27 17:41:52 -0500
committerMike Crute <mike@crute.us>2010-12-27 17:41:52 -0500
commitf72ef2f1ba85ad10ab9b7d17255630e3019af81d (patch)
tree5820644bb67996d77aed4ed753cdb09af5bd177d /.vimrc
parent497d5e988bdfe261953fd6085c9f157a934c9143 (diff)
downloaddotfiles-f72ef2f1ba85ad10ab9b7d17255630e3019af81d.tar.bz2
dotfiles-f72ef2f1ba85ad10ab9b7d17255630e3019af81d.tar.xz
dotfiles-f72ef2f1ba85ad10ab9b7d17255630e3019af81d.zip
Moving vimrc into .vim directory
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc310
1 files changed, 0 insertions, 310 deletions
diff --git a/.vimrc b/.vimrc
deleted file mode 100644
index 03efd05..0000000
--- a/.vimrc
+++ /dev/null
@@ -1,310 +0,0 @@
1"
2" .vimrc VIM Preferences File
3" by Mike Crute (mcrute@gmail.com)
4"
5
6" The author_info.vim file defines the global used in the template
7" support functions. This will vary based on the computer where
8" vim is being used (work vs home, etc...) so it makes sense to
9" keep it seperate.
10
11" Author Info {{{
12if filereadable(expand("~/.vim/author_info.vim"))
13 source ~/.vim/author_info.vim
14else
15 echo "WARNING: Missing author info file, using defaults."
16 let g:AuthorName = "Mike Crute"
17 let g:Email = "mcrute@gmail.com"
18 let g:AuthorRef = ""
19 let g:Project = ""
20 let g:Company = ""
21 let g:CopyrightHolder = ""
22endif
23" }}}
24" Syntax Highlighting {{{
25syntax on
26colorscheme mcrute_slate
27set background=dark
28
29" MacVim gets its transparency settings all horked up if we don't
30" set this before we do GUI initialization stuff.
31set nocompatible
32
33" Have to do something a little different on the GUI otherwise its
34" totally impossible to see what we're doing. The cols/lines fits
35" pretty nicely on a 15" MBP at highest resolution.
36if has("gui_macvim") && has("gui_running")
37" set transparency=10
38 set lines=65
39 set columns=100
40" set guifont=Monaco:h10.00
41 set guifont=Anonymous\ Pro:h15.00
42 set go-=T
43" colorscheme mcrute
44 colorscheme fruity
45endif
46
47" Monospace 8 is a pretty nice font if we're running under GVIM.
48" The columns/lines in this setting fits just perfectly on my
49" Linux desktop at work at hightest resolution.
50if has("gui_gtk") && has("gui_running")
51 set lines=75
52 set columns=238
53 set guifont=Monospace\ 8
54 set guioptions=aegimrLt
55endif
56
57" AGI PD Template Files
58autocmd BufNewFile,BufRead,BufReadPost *.pd
59 \ set syntax=pyfusion
60
61" Apache Files in Apache dirs
62autocmd BufNewFile,BufRead,BufReadPost /apache*
63 \ set syntax=apache
64
65" JAD (Java Decompiled) Files
66autocmd BufNewFile,BufRead,BufReadPost *.jad
67 \ set syntax=java
68
69" Jinja2 Templates
70autocmd BufNewFile,BufRead,BufReadPost *.tmpl
71 \ set syntax=jinja
72
73" Python Files
74autocmd BufNewFile,BufRead *.py
75 \ setlocal foldmarker=#{,#}
76
77autocmd Filetype html,xml,xsl
78 \ source ~/.vim/scripts/closetag.vim
79
80autocmd BufNewFile,BufRead *.py
81 \ setlocal omnifunc=pythoncomplete#Complete
82" }}}
83" General Settings {{{
84set backspace=indent,eol,start
85set browsedir=buffer
86set fileformat=unix
87set hidden
88set history=1000
89set modeline
90set title
91set nojoinspaces
92set backup
93set directory=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp
94set backupdir=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp
95set viminfo='100,<50,s10,h,n$HOME/.vim/tmp/viminfo
96"set list
97set listchars=tab:>-,eol:$,trail:.
98"set listchars=tab:▸\ ,eol:¬
99set vb t_vb=
100let mapleader=","
101" }}}
102" Search Settings {{{
103set hlsearch
104set incsearch
105set showmatch
106set ignorecase
107set smartcase
108" }}}
109" Tab Settings {{{
110set autoindent
111set expandtab
112set shiftwidth=4
113set smarttab
114set softtabstop=4
115set tabstop=4
116" }}}
117" Visual Display {{{
118set laststatus=2
119set noequalalways
120set nowrap
121set number
122set ruler
123set scrolloff=4
124set showcmd
125set showtabline=2
126set splitbelow
127set splitright
128set virtualedit=all
129set wildmenu
130
131" Some stuff isn't availiable in < 7.0
132if version >= 700
133 set nospell
134endif
135
136function! ToggleLineWise()
137 if !exists('g:linewise')
138 let g:linewise = 'true'
139 endif
140
141 if g:linewise == 'true'
142 noremap j gj
143 noremap k gk
144 noremap <C-f> 20gj
145 noremap <C-b> 20gk
146 let g:linewise = 'false'
147 echo 'Linewise mode disabled'
148 else
149 unmap j
150 unmap k
151 unmap <C-f>
152 unmap <C-b>
153 let g:linewise = 'true'
154 echo 'Linewise mode re-enabled'
155 endif
156endfunction
157" }}}
158" Vim Plugins {{{
159filetype plugin on
160filetype indent on
161
162" Use verital splits for file explorer
163let g:explVertical=1
164
165" Set closing tag style for closetag.vim
166let g:closetag_html=1
167
168" Do all python highlighting
169let python_highlight_all=1
170
171" Some sane defaults for the explorer
172let g:explHideFiles='^\.,.*\.sw[po]$,.*\.pyc$'
173let g:explDetailedHelp=0
174" }}}
175" Custom Commands {{{
176" Cleanup windows crap from line endings
177command TrimSpaces %s/\s\+$//e
178command FixLineEnd %s/ //gi
179command ReIndent !reindent %
180command W write
181" }}}
182" Folding Settings {{{
183set foldenable
184set foldcolumn=3
185set foldmethod=marker
186" }}}
187" {{{ Select By Indent Level
188onoremap <silent>ai :<C-u>cal IndTxtObj(0)<CR>
189onoremap <silent>ii :<C-u>cal IndTxtObj(1)<CR>
190vnoremap <silent>ai :<C-u>cal IndTxtObj(0)<CR><Esc>gv
191vnoremap <silent>ii :<C-u>cal IndTxtObj(1)<CR><Esc>gv
192
193function! IndTxtObj(inner)
194 let curline = line(".")
195 let lastline = line("$")
196 let i = indent(line(".")) - &shiftwidth * (v:count1 - 1)
197 let i = i < 0 ? 0 : i
198
199 if getline(".") !~ "^\\s*$"
200 let p = line(".") - 1
201 let nextblank = getline(p) =~ "^\\s*$"
202
203 while p > 0 && ((i == 0 && !nextblank) || (i > 0 && ((indent(p) >= i && !(nextblank && a:inner)) || (nextblank && !a:inner))))
204 -
205 let p = line(".") - 1
206 let nextblank = getline(p) =~ "^\\s*$"
207 endwhile
208
209 normal! 0V
210 call cursor(curline, 0)
211
212 let p = line(".") + 1
213 let nextblank = getline(p) =~ "^\\s*$"
214
215 while p <= lastline && ((i == 0 && !nextblank) || (i > 0 && ((indent(p) >= i && !(nextblank && a:inner)) || (nextblank && !a:inner))))
216 +
217 let p = line(".") + 1
218 let nextblank = getline(p) =~ "^\\s*$"
219 endwhile
220
221 normal! $
222 endif
223endfunction
224" }}}
225" Line and Column Highlighting {{{
226"autocmd BufEnter * call SetColumnHighlighting(1)
227"autocmd BufLeave * call SetColumnHighlighting(0)
228
229function! SetColumnHighlighting(set_on)
230 if $TERM_PROGRAM == "Apple_Terminal" || version < 700
231 " Apple's Terminal.app is more than slightly retarded when it comes
232 " to colors and term compatibility so don't do this stuff on a Mac.
233 return
234 endif
235
236 if (!&readonly && a:set_on) && &filetype != "text"
237 set cursorline
238 set cursorcolumn
239
240 hi CursorColumn ctermbg=grey ctermfg=black
241 hi CursorLine ctermbg=grey ctermfg=black
242 else
243 set nocursorline
244 set nocursorcolumn
245 endif
246endfunction
247" }}}
248" Text Mode File Support {{{
249autocmd FileType text call DoTextMode()
250
251function! DoTextMode()
252 set textwidth=80
253 set nolist
254 set spell
255 call SetColumnHighlighting(0)
256endfunction
257
258" Use par if it is installed since it does a much better
259" job of formatting than the built-in formatter
260if executable("/opt/local/bin/par")
261 set formatprg="/opt/local/bin/par"
262endif
263
264if executable("/usr/local/bin/par")
265 set formatprg="/usr/local/bin/par"
266endif
267" }}}
268" Key Bindings {{{
269" Tab Key Bindings
270nnoremap tt :tabnew<CR>
271nnoremap tm :tabmove<CR>
272nnoremap tn :tabnext<CR>
273nnoremap tp :tabprev<CR>
274nnoremap tc :tabclose<CR>
275
276" Buffer Key Bindings
277nnoremap <C-l> :bnext!<CR>
278nnoremap <C-h> :bprev!<CR>
279nnoremap <leader>bn :bnext<CR>
280nnoremap <leader>bp :bprev<CR>
281
282" Paging Key Bindings
283nnoremap df <C-f>
284nnoremap fd <C-b>
285
286" Plugin Key Bindings
287nnoremap <leader>tl :TlistToggle<CR>
288nnoremap <leader>fe :Vexplore<CR>
289nnoremap <leader>ih :call InsertTemplate("header", 1)<CR>
290nnoremap <leader>sp :Sscratch<CR>
291
292" Convenience Key Bindings
293" cs: clears search buffer
294nnoremap cs :let @/=""<CR>
295nnoremap sp :set spell!<CR>
296
297" GUI-style Saving!
298map <C-s> :w<CR>
299
300" Turns selected camelCase into camel_case
301vnoremap <leader>dc :s/\v\C(([a-z]+)([A-Z]))/\2_\l\3/g<CR>
302
303" Run python scripts and display the output
304nnoremap <leader>p :!python %:p<CR>
305" }}}
306" {{{ Workarounds For Broken Shit
307au BufWrite /private/tmp/crontab.* set nowritebackup
308au BufWrite /private/etc/pw.* set nowritebackup
309" }}}
310" vim:foldenable:foldmethod=marker: