]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/vimrc
Remove old weechat config
[rbdr/dotfiles] / vim / vimrc
CommitLineData
0d23b6e5
BB
1set nocompatible
2
3set number
4set ruler
5syntax on
6
7" Set encoding
8set encoding=utf-8
9
10" Whitespace stuff
11set nowrap
12set tabstop=2
13set shiftwidth=2
14set softtabstop=2
15set expandtab
16set list listchars=tab:\ \ ,trail:ยท
17
18" Searching
19set hlsearch
20set incsearch
21set ignorecase
22set smartcase
23
24" Tab completion
25set wildmode=list:longest,list:full
26set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
27
28" Status bar
29set laststatus=2
30
31" Without setting this, ZoomWin restores windows in a way that causes
32" equalalways behavior to be triggered the next time CommandT is used.
33" This is likely a bludgeon to solve some other issue, but it works
34set noequalalways
35
36" NERDTree configuration
37let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
38map <Leader>n :NERDTreeToggle<CR>
39
40" CTags
41map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
42map <C-\> :tnext<CR>
43
44" Remember last location in file
45if has("autocmd")
46 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
47 \| exe "normal g'\"" | endif
48endif
49
50function s:setupWrapping()
51 set wrap
52 set wrapmargin=2
53 set textwidth=72
54endfunction
55
56function s:setupMarkup()
57 call s:setupWrapping()
58 map <buffer> <Leader>p :Hammer<CR>
59endfunction
60
61" make uses real tabs
62au FileType make set noexpandtab
63
64" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
65au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
66
67" md, markdown, and mk are markdown and define buffer-local preview
68au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
69
70" add json syntax highlighting
71au BufNewFile,BufRead *.json set ft=javascript
72
73au BufRead,BufNewFile *.txt call s:setupWrapping()
74
75" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
76au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
77
78" allow backspacing over everything in insert mode
79set backspace=indent,eol,start
80
81" load the plugin and indent settings for the detected filetype
82filetype plugin indent on
83
84" Opens an edit command with the path of the currently edited file filled in
85" Normal mode: <Leader>e
86map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
87
88" Opens a tab edit command with the path of the currently edited file filled in
89" Normal mode: <Leader>t
90map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
91
92" Inserts the path of the currently edited file into a command
93" Command mode: Ctrl+P
94cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
95
96" Unimpaired configuration
97" Bubble single lines
98nmap <C-Up> [e
99nmap <C-Down> ]e
100" Bubble multiple lines
101vmap <C-Up> [egv
102vmap <C-Down> ]egv
103
104" Enable syntastic syntax checking
105let g:syntastic_enable_signs=1
106let g:syntastic_quiet_warnings=1
107
108" gist-vim defaults
109if has("mac")
110 let g:gist_clip_command = 'pbcopy'
111elseif has("unix")
112 let g:gist_clip_command = 'xclip -selection clipboard'
113endif
114let g:gist_detect_filetype = 1
115let g:gist_open_browser_after_post = 1
116
117" Use modeline overrides
118set modeline
119set modelines=10
120
121" Default color scheme
122set t_Co=256
123color railscasts
124
125" Directories for swp files
126set backupdir=~/.vim/backup
127set directory=~/.vim/backup
128
129" Turn off jslint errors by default
130let g:JSLintHighlightErrorLine = 0
131
132" MacVIM shift+arrow-keys behavior (required in .vimrc)
133let macvim_hig_shift_movement = 1
134
135" % to bounce from do to end etc.
136runtime! macros/matchit.vim
137
138" Show (partial) command in the status line
139set showcmd
140
141" Include user's local vim config
142if filereadable(expand("~/.vimrc.local"))
143 source ~/.vimrc.local
144endif
145
146" Mapping for TagBar
147nmap <F8> :TagbarToggle<CR>
148
149" Mapping for CommandTBuffer
150map <Leader>t :CtrlP<CR>
151map <Leader>T :CtrlPBuffer<CR>
152map <Leader>R :CtrlPClearCache<CR>
153
154" Color Column
155set colorcolumn=81
156
157" Add Pathogen
158call pathogen#infect()