-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc
201 lines (180 loc) · 4.64 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
set nocompatible
" filetypes
filetype plugin indent on
" syntax
syntax enable
" highlights
highlight ChangesSignTextAdd ctermbg=10 ctermfg=15
highlight ChangesSignTextCh ctermbg=12 ctermfg=15
highlight ChangesSignTextDel ctermbg=9 ctermfg=15
highlight ColorColumn ctermbg=14
highlight CursorLine cterm=none ctermbg=10
highlight NonText ctermfg=7
highlight SpecialKey ctermfg=7
" options
set autoindent
set autoread
set autowrite
set background=light
set backspace=indent,eol,start
set colorcolumn=80
set complete-=i
set cursorline
set cursorlineopt=line
set encoding=utf-8
set expandtab
set fileformats=unix,dos,mac
set history=100
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set linebreak
set list
set listchars=tab:>-,eol:$,trail:.,extends:>,precedes:<,nbsp:%
set modeline
set modelines=5
set number
set pastetoggle=<F2>
set ruler
set shiftround
set shiftwidth=4
set shortmess+=I
set showbreak=+\ " don't delete
set showcmd
set showmatch
set showmode
set smartcase
set smarttab
set softtabstop=4
set tabstop=8
set tagcase=followscs
set undolevels=1000
set wrap
set wrapscan
" function JumpToLastPosition
function JumpToLastPosition()
if line("'\"") > 1 && line("'\"") <= line("$")
execute "normal! g'\""
endif
endfunction
" function RemoveTrailingBlankLines
function RemoveTrailingBlankLines()
let l:line = line(".")
let l:column = col(".")
normal G
while getline(".") =~ "^\\s*$"
if line(".") > 1
normal dd
else
normal dd
break
endif
endwhile
call cursor(l:line, l:column)
endfunction
" function MakeScriptExecutable
function MakeScriptExecutable()
if getline(1) =~ "^#!"
if getline(1) =~ "/bin/"
silent !chmod a+x <afile>
endif
endif
endfunction
" function RemoveTrailingWhitespace
function RemoveTrailingWhitespace()
let l:line = line(".")
let l:column = col(".")
:%s/\s\+$//e
call cursor(l:line, l:column)
endfunction
" function ToggleQuickMode
let b:quick_mode = 0
function ToggleQuickMode()
if b:quick_mode == 0
syntax off
set colorcolumn=
set nocursorline
set noincsearch
set nolist
set nonumber
set noshowmatch
set nowrap
:IndentLinesDisable
:DisableChanges
:ColorClear
let b:quick_mode = 1
else
syntax on
set colorcolumn=80
set cursorline
set incsearch
set list
set number
set showmatch
set wrap
:IndentLinesEnable
:EnableChanges
:ColorHighlight
let b:quick_mode = 0
endif
endfunction
" autocommands
augroup plugins
autocmd!
autocmd BufEnter,BufLeave *.css,*.scss,*.sass,*.html :ColorHighlight!
augroup END
augroup functions
autocmd!
autocmd BufReadPost * call JumpToLastPosition()
autocmd BufWritePost * call MakeScriptExecutable()
autocmd BufWritePre * call RemoveTrailingBlankLines()
autocmd BufWritePre * call RemoveTrailingWhitespace()
augroup END
" mappings
nnoremap <F3> :call ToggleQuickMode()<CR>
" extensions
augroup extensions
autocmd!
autocmd BufNewFile,BufReadPost *.json set filetype=javascript
autocmd BufNewFile,BufReadPost *.pt set filetype=xml
autocmd BufNewFile,BufReadPost *.t set filetype=perl
autocmd BufNewFile,BufReadPost *.zcml set filetype=xml
augroup END
" local options
augroup local_options
autocmd!
autocmd FileType erb setlocal shiftwidth=2 softtabstop=2
autocmd FileType html setlocal shiftwidth=2 softtabstop=2
autocmd FileType htmldjango setlocal shiftwidth=2 softtabstop=2
autocmd FileType ruby setlocal shiftwidth=2 softtabstop=2
autocmd FileType xml setlocal shiftwidth=2 softtabstop=2
augroup END
" plugin changes
let g:changes_fixed_sign_column = 1
let g:changes_vcs_check = 1
let g:changes_vcs_system = 'git'
" plugin ultisnips
let g:UltiSnipsListSnippets = '<c-s>'
" plugin syntastic
let g:syntastic_aggregate_errors = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 1
let g:syntastic_error_symbol = 'E>'
let g:syntastic_perl_checkers = ['perlcritic']
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_style_warning_symbol = 'S>'
let g:syntastic_warning_symbol = 'W>'
" plugin notes
let g:notes_conceal_bold = 0
let g:notes_conceal_code = 0
let g:notes_conceal_italic = 0
let g:notes_conceal_url = 0
let g:notes_directories = ['~/Documents/Notes']
let g:notes_suffix = '.md'
let g:notes_title_sync = 'rename_file'
let g:notes_unicode_enabled = 0
" plugin ultisnips
let g:UltiSnipsSnippetDirectories = ['UltiSnips', 'usnippets']