-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared_vimrc
246 lines (191 loc) · 6.21 KB
/
shared_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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'kien/ctrlp.vim'
Plugin 'haya14busa/incsearch.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-scripts/perl-support.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'hashivim/vim-terraform'
Plugin 'tpope/vim-commentary'
Plugin 'easymotion/vim-easymotion'
" All of your Plugins must be added before the following line
call vundle#end() " required
syntax on
colorscheme dante
set shiftwidth=4
set undofile
set undodir=~/.vim/undo
"noremap <silent> <F5> :%!iconv -f cp1251 -t koi8-u<CR>
"noremap <silent> <F6> :%!iconv -f koi8-u -t cp1251<CR>
set backspace=indent,eol,start
set ttymouse=xterm
set mouse=a
set incsearch
set hidden " don't unload buffers
set browsedir =current " which directory to use for the file browser
set modeline
set termencoding=utf-8
" Enable file type detection.
" " Use the default filetype settings, so that mail gets 'tw' set to 72,
" " 'cindent' is on in C files, etc.
" " Also load indent files, to automatically do language-dependent indenting
filetype plugin indent on
" status line
" set statusline=%<%f%h%m%r\ %b\ %{&encoding}\ 0x\ \ %l,%c%V\ %P
set statusline=%=%f\ \"%F\"\ %m%R\ [%5l(%3p%%):%3c-(0x%2B,%2b),%Y,%{&encoding}]
set laststatus=2
set showcmd
set sessionoptions=curdir,buffers,tabpages,winsize
" Nerd tree
let NERDTreeMouseMode = 3
let NERDTreeQuitOnOpen = 1
let NERDTreeShowBookmarks = 1
"" Настройки для SessionMgr
"let g:SessionMgr_AutoManage = 1
"let g:SessionMgr_DefaultName = "session"
"let g:SessionMgr_Dir = "/home/cono/.vim/sessions"
" encryption
set cm=blowfish2
" F6 - previous buffer
nmap <F6> :bp<cr>
vmap <F6> <esc>:bp<cr>
imap <F6> <esc>:bn<cr>
" F7 - next buffer
nmap <F7> :bn<cr>
vmap <F7> <esc>:bn<cr>
imap <F7> <esc>:bn<cr>
" F8 - close quickfix window
nmap <F8> :cclose<cr>
vmap <F8> <esc>:cclose<cr>
imap <F8> <esc>:cclose<cr>
" F9 - close quickfix window
nmap <F9> :copen<cr>
vmap <F9> <esc>:copen<cr>
imap <F9> <esc>:copen<cr>
" F10 - close buffer
nmap <F10> :bd<cr>
vmap <F10> <esc>:bd<cr>
imap <F10> <esc>:bd<cr>
" F12 - NERDTreeToggle
nmap <F12> :NERDTreeToggle<cr>
vmap <F12> <esc>:NERDTreeToggle<cr>
imap <F12> <esc>:NERDTreeToggle<cr>
" do not mark brackets
let loaded_matchparen = 1
function DevelCover()
let l:path = expand("%:p:h")
let l:dzil_ini = findfile("dist.ini", l:path . ";/")
let l:path = fnamemodify(l:dzil_ini, ":p:h")
exe "cd " . l:path
let l:vim_cover = system("dzil cover -report vim 2>&1 | grep -E '\\.vim$' | perl -aple '$_=$F[-1]'")
exe "source " . l:vim_cover
redraw!
cd -
endfunction
nmap <LocalLeader>dc :call DevelCover()<cr>
vmap <LocalLeader>dc <esc>:call DevelCover()<cr>
imap <LocalLeader>dc <esc>:call DevelCover()<cr>
" PerlSupport
"let g:Perl_GlobalTemplateFile = "~/.vim/perl-support/templates/Templates"
set completeopt-=preview
set completeopt+=longest
set mps-=[:]
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup FileSettings
autocmd!
" setting up for Vim
autocmd FileType vim call LangVim()
" setting up for Perl
autocmd FileType xs call LangPerl()
autocmd FileType perl call LangPerl()
autocmd FileType perl6 call LangPerl()
autocmd FileType raku call LangPerl()
" setting up for Java
autocmd FileType java call LangJava()
autocmd FileType javascript call LangJavaScript()
" setting up for C/C++
autocmd FileType c call LangC('C')
autocmd FileType cpp call LangC('C')
autocmd FileType xml call LangXML('xml')
autocmd FileType xsd call LangXML('xsd')
" setting up for text files
autocmd FileType text setlocal textwidth=80
augroup END
function DefaultLangSettings()
" can set default settings
setlocal tabstop=4 shiftwidth=4 softtabstop=4
setlocal expandtab autoindent smartindent
endfunction
function LangVim()
call DefaultLangSettings()
setlocal noexpandtab
endfunction
function LangPerl()
call DefaultLangSettings()
endfunction
function LangJava()
call DefaultLangSettings()
endfunction
function LangJavaScript()
call DefaultLangSettings()
endfunction
function LangXML(langDialect)
call DefaultLangSettings()
endfunction
function LangC(langDialect)
call DefaultLangSettings()
setlocal tabstop=4 shiftwidth=4 softtabstop=4
setlocal cindent
setlocal cinoptions=
endfunction
" Protect large files from sourcing and other overhead.
" Files become read only
if !exists("my_auto_commands_loaded")
let my_auto_commands_loaded = 1
" Large files are > 10M
" Set options:
" eventignore+=FileType (no syntax highlighting etc
" assumes FileType always on)
" noswapfile (save copy of file)
" bufhidden=unload (save memory when other file is viewed)
" buftype=nowritefile (is read-only)
" undolevels=-1 (no undo possible)
let g:LargeFile = 1024 * 1024 * 10
augroup LargeFile
autocmd BufReadPre * let f=expand("<afile>") | if getfsize(f) > g:LargeFile | set eventignore+=FileType | setlocal noswapfile bufhidden=unload buftype=nowrite undolevels=-1 | else | set eventignore-=FileType | endif
augroup END
endif
" Airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
" incsearch
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
set hlsearch
let g:incsearch#auto_nohlsearch = 1
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
" CtrlP
let g:ctrlp_working_path_mode = 'ra'
" BufExplorer
let g:bufExplorerSortBy='fullpath'
" Commentary
noremap <C-_> :Commentary<cr>