-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
276 lines (227 loc) · 8.36 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
scriptencoding utf-8
" ^^ Please leave the above line at the start of the file.
" Default configuration file for Vim
" $Header: /var/cvsroot/gentoo-x86/app-editors/vim-core/files/vimrc-r3,v 1.1 2006/03/25 20:26:27 genstef Exp $
" Written by Aron Griffis <[email protected]>
" Modified by Ryan Phillips <[email protected]>
" Modified some more by Ciaran McCreesh <[email protected]>
" Added Redhat's vimrc info by Seemant Kulleen <[email protected]>
" You can override any of these settings on a global basis via the
" "/etc/vim/vimrc.local" file, and on a per-user basis via "~/.vimrc". You may
" need to create these.
" {{{ Setup cache dir
let cachedir=expand('~/.cache/vim')
if !isdirectory(cachedir)
call mkdir(cachedir, "p", 0700)
endif
" }}}
"" {{{ Fetch + source the grml vimrc
let grmlrc=expand('~/.vimrc.grml')
if !filereadable(grmlrc)
echo "Fetching vimrc.grml..."
echo ""
silent !curl -L https://github.com/andreas-hofmann/dotfiles/raw/master/.vimrc.grml > ~/.vimrc.grml
endif
if filereadable(grmlrc)
source ~/.vimrc.grml
endif
" }}}
" {{{ Setting up Vundle - the vim plugin bundler
let vundlerc=expand('~/.vimrc.vundle')
if filereadable(vundlerc)
source ~/.vimrc.vundle
endif
" }}}
" {{{ Modeline settings
" We don't allow modelines by default. See bug #14088 and bug #73715.
" If you're not concerned about these, you can enable them on a per-user
" basis by adding "set modeline" to your ~/.vimrc file.
set nomodeline
" }}}
" {{{ Locale settings
" If we have a BOM, always honour that rather than trying to guess.
if &fileencodings !~? "ucs-bom"
set fileencodings^=ucs-bom
endif
" Always check for UTF-8 when trying to determine encodings.
if &fileencodings !~? "utf-8"
set fileencodings+=utf-8
endif
" Make sure we have a sane fallback for encoding detection
set fileencodings+=default
" }}}
" {{{ Syntax highlighting settings
" 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")
syntax on
endif
" }}}
" {{{ Terminal fixes
if &term ==? "xterm"
set t_Sb=^[4%dm
set t_Sf=^[3%dm
set ttymouse=xterm2
endif
if &term ==? "gnome" && has("eval")
" Set useful keys that vim doesn't discover via termcap but are in the
" builtin xterm termcap. See bug #122562. We use exec to avoid having to
" include raw escapes in the file.
exec "set <C-Left>=\eO5D"
exec "set <C-Right>=\eO5C"
endif
" }}}
" {{{ Filetype plugin settings
" Enable plugin-provided filetype settings, but only if the ftplugin
" directory exists (which it won't on livecds, for example).
if isdirectory(expand("$VIMRUNTIME/ftplugin"))
filetype plugin on
" Uncomment the next line (or copy to your ~/.vimrc) for plugin-provided
" indent settings. Some people don't like these, so we won't turn them on by
" default.
filetype indent on
endif
" }}}
" {{{ Fix &shell, see bug #101665.
if "" == &shell
if executable("/bin/bash")
set shell=/bin/bash
elseif executable("/bin/sh")
set shell=/bin/sh
endif
endif
"}}}
" {{{ Our default /bin/sh is bash, not ksh, so syntax highlighting for .sh
" files should default to bash. See :help sh-syntax and bug #101819.
if has("eval")
let is_bash=1
endif
" }}}
" {{{ Autocommands
if has("autocmd")
augroup gentoo
au!
" Gentoo-specific settings for ebuilds. These are the federally-mandated
" required tab settings. See the following for more information:
" http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml
" Note that the rules below are very minimal and don't cover everything.
" Better to emerge app-vim/gentoo-syntax, which provides full syntax,
" filetype and indent settings for all things Gentoo.
au BufRead,BufNewFile *.e{build,class} let is_bash=1|setfiletype sh
au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab
" In text files, limit the width of text to 78 characters, but be careful
" that we don't override the user's setting.
autocmd BufNewFile,BufRead *.txt
\ if &tw == 0 && ! exists("g:leave_my_textwidth_alone") |
\ setlocal textwidth=78 |
\ endif
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif
" When editing a crontab file, set backupcopy to yes rather than auto. See
" :help crontab and bug #53437.
autocmd FileType crontab set backupcopy=yes
augroup END
"Python Stuff goes here:
autocmd BufRead *.py set tabstop=4
autocmd BufRead *.py set shiftwidth=4
autocmd BufRead *.py set smarttab
autocmd BufRead *.py set expandtab
autocmd BufRead *.py set softtabstop=4
autocmd BufRead *.py set autoindent
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
"Ruby stuff goes here:
autocmd BufRead *.rb set tabstop=2
autocmd BufRead *.rb set shiftwidth=2
autocmd BufRead *.rb set smarttab
autocmd BufRead *.rb set expandtab
autocmd BufRead *.rb set softtabstop=2
autocmd BufRead *.rb set autoindent
"Tex Stuff goes here:
autocmd BufRead *.tex set tabstop=4
autocmd BufRead *.tex set shiftwidth=4
autocmd BufRead *.tex set smarttab
autocmd BufRead *.tex set expandtab
autocmd BufRead *.tex set softtabstop=4
autocmd BufRead *.tex set autoindent
"
"html stuff goes here:
autocmd BufRead *.html set tabstop=2
autocmd BufRead *.html set shiftwidth=2
autocmd BufRead *.html set smarttab
autocmd BufRead *.html set expandtab
autocmd BufRead *.html set softtabstop=2
autocmd BufRead *.html set autoindent
"htmldjango stuff goes here:
autocmd BufRead *.htmldjango set filetype=htmldjango
autocmd BufRead *.htmldjango set tabstop=2
autocmd BufRead *.htmldjango set shiftwidth=2
autocmd BufRead *.htmldjango set smarttab
autocmd BufRead *.htmldjango set expandtab
autocmd BufRead *.htmldjango set softtabstop=2
autocmd BufRead *.htmldjango set autoindent
endif " has("autocmd")
" }}}
" {{{ swp + backup dirs
set directory=~/.cache/vim/swp
let targetdir=expand('~/.cache/vim/swp')
if isdirectory(targetdir) != 1 && getftype(targetdir) == "" && exists("*mkdir")
call mkdir(targetdir, "p", 0700)
endif
set backupdir=~/.cache/vim/bak
let targetdir=expand('~/.cache/vim/bak')
if isdirectory(targetdir) != 1 && getftype(targetdir) == "" && exists("*mkdir")
call mkdir(targetdir, "p", 0700)
endif
" }}}
" {{{ Tweak tab navigation
noremap <C-h> gT
noremap <C-l> gt
map <C-t> <Esc>:tabnew .<CR>
" }}}
" {{{ General settings
set nocompatible " Use Vim defaults (much better!)
set bs=2 " Allow backspacing over everything in insert mode
set ai " Always set auto-indenting on
set history=1000 " keep 50 lines of command history
set ruler " Show the cursor position all the time
"Set colorscheme
colorscheme koehler
"set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hlsearch " Highlight search results
"set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes)
set nocp " Less compatibility
set listchars=trail:~,eol:$,nbsp:_,tab:>\ "
set statusline=%<%F%h%m%r%h%w%y\ %{&ff}\ %{strftime(\"%c\",getftime(expand(\"%:p\")))}%=\ lin:%l\,%L\ col:%c%V\ pos:%o\ ascii:%b\ %P
set laststatus=2
set number
" enable mouse
set mousemodel=extend
set viminfo='20,\"500 " Keep a .viminfo file.
" Don't use Ex mode, use Q for formatting
map Q gq
" When doing tab completion, give the following files lower priority. You may
" wish to set 'wildignore' to completely ignore files, and 'wildmenu' to enable
" enhanced tab completion. These can be done in the user vimrc file.
set suffixes+=.info,.aux,.log,.dvi,.bbl,.out,.o,.lo
" When displaying line numbers, don't use an annoyingly wide number column. This
" doesn't enable line numbers -- :set number will do that. The value given is a
" minimum width to use for the number column, not a fixed size.
if v:version >= 700
set numberwidth=3
endif
" }}}
let g:changelog_username="Andreas Hofmann <[email protected]>"
set foldmethod=marker
" vim: set fenc=utf-8 sw=4 sts=4 et foldmethod=marker :