-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvimrc.old
202 lines (168 loc) · 5.1 KB
/
vimrc.old
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
set nocompatible
filetype off
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
" Don't mess up local directories
set dir=~/.vim_crud
set backupdir=~/.vim_crud
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set noswapfile
"" Reduce autocomplete
set complete=.,w,b
" Enable syntax highlighting
syntax on
" Highlight last searched term
"set cursorline
"set cursorcolumn
set hlsearch
set hidden
set autowrite
set expandtab
set nowrap
set number
set visualbell
set noerrorbells
set wildmenu
set wildmode=list:longest
set wildignore=*.o,*.root,*.pyc,*.png,*.pdf,*.ps,*CVS/*,*/lxbatch/*,*/crab/*,*/lxbatch_log/*
set wildignore+=*.aux,*.fls,*.out,*.log,*.fdb_latexmk
set ignorecase
set smartcase
set scrolloff=3
set novisualbell
" Enable filetype detection
filetype plugin indent on
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set autoindent " always set autoindenting on
set shiftwidth=2
" For all text files set 'textwidth' to 78 characters.
autocmd FileType tex setlocal wildignore-=*.pdf
autocmd FileType tex setlocal wildignore-=*.png
autocmd FileType tex :syntax spell toplevel
autocmd FileType tex setlocal textwidth=10000
autocmd FileType tex setlocal textwidth=10000
autocmd FileType tex setlocal colorcolumn=10000
" Always move by display lines
nnoremap j gj
nnoremap k gk
nnoremap 0 g0
nnoremap $ g$
vnoremap j gj
vnoremap k gk
vnoremap 0 g0
vnoremap $ g$
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" Delete trailing whitespace before saving in cpp and python
autocmd BufWritePre *.cc,*.h,*py :%s/\s\+$//e
" When editing a file, always jump to the last known cursor position.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" NERD Tree settings
map <silent> <C-P> <ESC>:NERDTreeToggle<CR>
let NERDTreeIgnore=['CVS', 'pyc$', '\.root$', 'pdf$', 'png$', '@Batch', 'xml.bak$', 'xml.fragment$']
let NERDTreeWinSize=61
let NERDTreeWinPos=0
let NERDTreeChDirMode=2 "always set root as cwd
let NERDTreeChristmasTree = 1
let g:syntastic_auto_loc_list=0
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_enable_signs=1
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['ruby', 'python', 'js'],
\ 'passive_filetypes': ['cpp', 'c', 'tex'] }
let g:syntastic_javascript_checkers=['jshint']
set statusline=%t\ %m%r[%04l,%02c]
set statusline+=\ \ %#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
set laststatus=2
set noerrorbells
set vb t_vb=
set nospell
set tw=80
" Don't use plaintex, but tex
let g:tex_flavor='latex'
hi StatColor guibg=#95e454 guifg=black ctermbg=lightgreen ctermfg=black
hi Modified guibg=orange guifg=black ctermbg=lightred ctermfg=black
function! MyStatusLine(mode)
let statusline=""
if a:mode == 'Enter'
let statusline.="%#StatColor#"
endif
let statusline.="\(%n\)\ %f\ "
if a:mode == 'Enter'
let statusline.="%*"
endif
let statusline.="%#Modified#%m"
if a:mode == 'Leave'
let statusline.="%*%r"
elseif a:mode == 'Enter'
let statusline.="%r%*"
endif
let statusline .= "\ (%l/%L,\ %c)\ %P%=%h%w\ %y\ [%{&encoding}:%{&fileformat}]\ \ "
return statusline
endfunction
au WinEnter * setlocal statusline=%!MyStatusLine('Enter')
au WinLeave * setlocal statusline=%!MyStatusLine('Leave')
set statusline=%!MyStatusLine('Enter')
function! InsertStatuslineColor(mode)
if a:mode == 'i'
hi StatColor guibg=orange ctermbg=lightred
elseif a:mode == 'r'
hi StatColor guibg=#e454ba ctermbg=magenta
elseif a:mode == 'v'
hi StatColor guibg=#e454ba ctermbg=magenta
else
hi StatColor guibg=red ctermbg=red
endif
endfunction
au InsertEnter * call InsertStatuslineColor(v:insertmode)
au InsertLeave * hi StatColor guibg=#95e454 guifg=black ctermbg=lightgreen ctermfg=black
map \c" "+yi"
map \c' "+yi'
map \cW "+yiW
map \cw "+yiw
command! CondenseBlanks :%s/\n\{3,}/\r\r/e
let $uw='/afs/hep.wisc.edu/home/efriis'
let $uwcms='/afs/hep.wisc.edu/cms/efriis'
let $lxpwrk='/afs/cern.ch/work/f/friis'
let $lxp='/afs/cern.ch/home/f/friis'
func! WordProcessorMode()
setlocal formatoptions=1
setlocal noexpandtab
map j gj
map k gk
setlocal smartindent
setlocal spell spelllang=en_us
setlocal wrap
setlocal linebreak
setlocal syntax=none
endfu
com! WP call WordProcessorMode()
" Open a file in the same directory as the current file
map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
"au! BufRead,BufNewFile *.json set filetype=json
" Turn jk into leaving insert mode
imap jk <ESC>
set background=dark
colo solarized
function! TwiddleCase(str)
if a:str ==# toupper(a:str)
let result = tolower(a:str)
elseif a:str ==# tolower(a:str)
let result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g')
else
let result = toupper(a:str)
endif
return result
endfunction
vnoremap ~ y:call setreg('', TwiddleCase(@"), getregtype(''))<CR>gv""Pgv