-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
203 lines (152 loc) · 5.3 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
source $VIMRUNTIME/defaults.vim
set mouse=
"set mouse-=a
"filetype off
"force 256 colors
"set t_Co=256
"" set Vim-specific sequences for RGB colors
"colorscheme bubblegum-256-dark
color jellybeans
"color zenburn
set background=dark
"if (has("termguicolors"))
" set termguicolors
" let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
"endif
"add cursorline
set cursorline
"highlight CursorLine ctermbg=234 ctermfg=none cterm=none
"leave background alone if running in terminal
if !has("gui_running")
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
endif
"autocmd ColorScheme * highlight Visual ctermfg=None ctermbg=237 cterm=None
"autocmd ColorScheme * highlight StatusLine ctermbg=239 ctermfg=white
filetype plugin indent on
syntax enable
"filetype plugin indent on " required
"filetype off
"just disable backup/swap files
set noswapfile
set nobackup
"change cwd to that of file opened
set autochdir
"write changes to vimrc?
set modifiable
"gvim
"if has('gui_running')
"set guifont=Terminus\ 10
"colorscheme evening
"colorscheme delek
"colors evening
"endif
"key mappings
"
"tabs
:map <F7> :tabp <CR>
:map <F8> :tabn <CR>
:map <F9> :tabe <CR>:E <CR>
":map <F9> :tabe %:h <CR>
"
:map <C-S-n> :set invnumber<CR>
" file is large from 10mb
let g:LargeFile = 1024 * 1024 * 10
augroup LargeFile
autocmd BufReadPre * let f=getfsize(expand("<afile>")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif
augroup END
function LargeFile()
" no syntax highlighting etc
set eventignore+=FileType
" save memory when other file is viewed
setlocal bufhidden=unload
" is read-only (write with :w new_filename)
setlocal buftype: ""
"setlocal buftype=nowrite
" no undo possible
setlocal undolevels=-1
" display message
autocmd VimEnter * echo "The file is larger than " . (g:LargeFile / 1024 / 1024) . " MB, so some options are changed (see .vimrc for details)."
endfunction
"don't wrap git commit messages
autocmd Syntax gitcommit setlocal textwidth=0
autocmd BufNewFile,BufRead *.html set syntax=php
"set paste
"let php_folding = 1 "Set PHP folding of classes and functions.
"let php_htmlInStrings = 1 "Syntax highlight HTML code inside PHP strings.
"let php_sql_query = 1 "Syntax highlight SQL code inside PHP strings.
"let php_noShortTags = 1 "Disable PHP short tags.
"set nocompatible " Because filetype detection doesn't work well in compatible mode
"filetype plugin indent on " Turns on filetype detection, filetype plugins, and filetype indenting all of which add nice extra features to whatever language you're using
"syntax enable " Turns on filetype detection if not already on, and then applies filetype-specific highlighting.
"set foldmethod=indent
set ruler
"set shiftwidth=4
"set softtabstop=4
"highlight! link DiffText MatchParen
"highlight DiffAdd cterm=none ctermfg=bg ctermbg=Green gui=none guifg=bg guibg=Green
"highlight DiffDelete cterm=none ctermfg=bg ctermbg=Red gui=none guifg=bg guibg=Red
"highlight DiffChange cterm=none ctermfg=bg ctermbg=Yellow gui=none guifg=bg guibg=Yellow
"highlight DiffText cterm=none ctermfg=bg ctermbg=Magenta gui=none guifg=bg guibg=Magenta
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=500
"Always show current position
set ruler
" Highlight search results
set hlsearch
" For regular expressions turn magic on
set magic
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Return to last edit position when opening files (You want this!)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" vim -b : edit binary using xxd-format!
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
" Format the status line
"set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
"set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
""""source /usr/share/vim/addons/plugin/powerline.vim
function! Preserve(command)
" Preparation: save window state
let l:saved_winview = winsaveview()
" Run the command:
execute a:command
" Clean up: restore previous window position
call winrestview(l:saved_winview)
endfunction
"remove trailing whitespace and reformat without losing postition
nnoremap <F5> :call Preserve("normal gg=G") <BAR>:call Preserve("%s/\\s\\+$//e")<CR>
set noshowmode
let g:airline_powerline_fonts = 1
"let g:airline_theme='base16_ashes'
set runtimepath^=~/.vim/bundle/vim-airline
"set runtimepath^=~/.vim/bundle/vim-airline-themes
"slow inserts
"set foldmethod=syntax
"set foldlevel=999
set guioptions+=a
set display+=uhex
"""ss format
set expandtab
set tabstop=2
set shiftwidth=2
autocmd FileType c setlocal noexpandtab softtabstop=0 shiftwidth=4
autocmd FileType sh setlocal noexpandtab softtabstop=0 shiftwidth=4
:set tabstop=4