This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
/
vimrc
executable file
·220 lines (190 loc) · 5.37 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
runtime bundle/vim-pathogen/autoload/pathogen.vim
colo DarkSky
let g:android_sdk_path = '/opt/android-sdk'
set nocp
filetype off
"call pathogen#incubate()
execute pathogen#infect()
filetype on
filetype plugin indent on
let s:cpo_save=&cpo
set cpo&vim
map! <S-Insert> <MiddleMouse>
let &cpo=s:cpo_save
unlet s:cpo_save
set ofu=syntaxcomplete#Complete
set autoindent
syntax on
set smartindent
"set cindent
set cmdheight=1
set fileencodings=utf-8
set encoding=utf-8
set termencoding=utf-8
"set guifont="Terminus 8"
set helplang=it
set history=50
set hlsearch
set foldenable
set incsearch
set ruler
set shiftwidth=2
set nowrap
set sidescroll=1
set tildeop
set exrc
set secure
if version >= 700
set list listchars=tab:\ ·,trail:×,nbsp:%,eol:·,extends:»,precedes:«
else
set list listchars=tab:\ >,trail:_,nbsp:%,eol:$,extends:>,precedes:<
endif
set showcmd
set mouse=c
set suffixes=.bak,~,.o,.h,.info,.swp,.obj,.class
set tabstop=2
set expandtab
set window=53
set nu
set fdm=marker
set statusline=%F%m%r%h%w\ [Type:\ %Y]\ [Lines:\ %L\ @\ %p%%\ {%l;%v}]
set laststatus=2
let g:netrw_http_cmd = "wget -qO"
command -bar Hexmode call ToggleHex()
function ToggleHex()
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
let b:oldft=&ft
let b:oldbin=&bin
setlocal binary
let &ft="xxd"
let b:editHex=1
%!xxd
else
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
let b:editHex=0
%!xxd -r
endif
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
nnoremap <F3> :NumbersToggle<CR>
nnoremap <C-x> :Hexmode<CR>
inoremap <C-x> <Esc>:Hexmode<CR>
vnoremap <C-x> :<C-U>Hexmode<CR>
map <S-t> :digraph<CR>
silent map <Leader>pe :w<CR>:!perl %<CR>
map \c :!irb -r %<CR>
map t :tabnew<CR>
map <C-n> :tabn<CR>
map <C-p> :tabp<CR>
"Activate NERDTree
map N :NERDTreeToggle<CR>
if $VIM_NERDTREE != '' && $VIM_NERDTREE != '0' && $VIM_NERDTREE != 'false'
au VimEnter * :NERDTreeToggle
endif
"Lightline
if !has('gui_running')
set t_Co=256
endif
set nocompatible
set laststatus=2
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"⭤":""}'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
"Syntastic
let g:syntastic_c_checker = "clang"
let g:syntastic_c_compiler_options = "-std=c11"
let g:syntastic_cpp_checker = "clang"
let g:syntastic_cpp_compiler_options = "-std=c++11"
let g:syntastic_mode_map = { 'mode': 'active',
\ 'passive_filetypes': ['elixir'] }
"YouCompleteMe
let g:ycm_allow_changing_updatetime = 1
let g:ycm_global_ycm_extra_conf = $HOME . '/.vim/ycm.py'
let g:ycm_key_invoke_completion = '<Leader><Leader><Tab>'
let g:ycm_key_select_completion = '<Tab>'
set complete-=preview
"android-vim
set tags+=/home/shura/.vim/tags
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
let g:SuperTabDefaultCompletionType = 'context'
"print a \t
map <C-m> :.!echo -e \\t<CR>
"Copy
vmap <silent> <C-c> y:call system("xclip -i", getreg("\""))<CR>
"Paste
nmap <silent> <C-v> :call setreg("\"",system("xclip -o"))<CR>p
imap <silent> <C-v> <C-o>:call setreg("\"",system("xclip -o"))<CR><C-o>p
map <S-s> :VimShell<CR>
autocmd BufWritePre * :%s/\s\+$//e
autocmd BufReadPost *.pdf silent %!pdftotext -layout -nopgbrk "%" -
autocmd BufReadPost *.doc silent %!antiword "%" -
autocmd BufRead,BufNewFile *.vimp set ft=vim
autocmd BufRead,BufNewFile Emakefile set ft=erlang
autocmd BufRead,BufNewFile rebar.config set ft=erlang
autocmd BufRead,BufNewFile *.herml set ft=haml
autocmd BufRead,BufNewFile *.app.src set ft=erlang
autocmd BufRead,BufNewFile *.app set ft=erlang
if has("autocmd")
augroup Binary
au!
au BufReadPre *.bin,*.hex setlocal binary
au BufReadPost *
\ if exists('b:editHex') && b:editHex |
\ let b:editHex = 0 |
\ endif
au BufReadPost *
\ if &binary | Hexmode | endif
au BufUnload *
\ if getbufvar(expand("<afile>"), 'editHex') == 1 |
\ call setbufvar(expand("<afile>"), 'editHex', 0) |
\ endif
au BufWritePre *
\ if exists("b:editHex") && b:editHex && &binary |
\ let oldro=&ro | let &ro=0 |
\ let oldma=&ma | let &ma=1 |
\ silent exe "%!xxd -r" |
\ let &ma=oldma | let &ro=oldro |
\ unlet oldma | unlet oldro |
\ endif
au BufWritePost *
\ if exists("b:editHex") && b:editHex && &binary |
\ let oldro=&ro | let &ro=0 |
\ let oldma=&ma | let &ma=1 |
\ silent exe "%!xxd" |
\ exe "set nomod" |
\ let &ma=oldma | let &ro=oldro |
\ unlet oldma | unlet oldro |
\ endif
augroup END
endif
function! MarkupPreview()
silent update
let output_name = tempname() . '.html'
let output = system('~/.vim/bin/github-flavored-markup.rb "'.expand('%:p').'" > "'.output_name.'"')
if v:shell_error
call delete(output_name)
let output = split(output, '\n')[0]
echohl ErrorMsg
echomsg output
echohl NONE
else
exec 'silent !(xdg-open "'.output_name.'"; rm "'.output_name.'") &>/dev/null &'
redraw!
endif
endfunction
map <Leader>p :call MarkupPreview()<CR>