-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
236 lines (214 loc) · 6.17 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
set makeencoding=char
scriptencoding utf-8
let $VIMRC_VIM = expand(expand('<sfile>:h') .. '/.vim')
language messages C
if has('win32')
set winaltkeys=yes
set guioptions=M
else
set mouse=a
endif
set autoread
set belloff=all
set clipboard=unnamed
set complete-=t
set completeslash=slash
set expandtab shiftwidth=2 tabstop=2
set fileencodings=ucs-bom,utf-8,cp932
set fileformats=unix,dos
set foldlevelstart=999
set foldmethod=indent
set grepformat&
set grepprg=internal
set hlsearch
set incsearch
set isfname-==
set keywordprg=:help
set laststatus=1
set list listchars=tab:-->
set matchpairs+=<:>
set matchtime=1
set nobackup
set noignorecase
set nonumber norelativenumber nocursorline
set noruler rulerformat&
set noshowmode
set noswapfile
set nowrap
set nowrapscan
set nowritebackup
set nrformats& nrformats+=unsigned nrformats-=octal
set pumheight=10
set scrolloff&
set sessionoptions=winpos,resize,tabpages,curdir,help
set shiftround
set showcmd
set showmatch
set showtabline=0 tabline&
set softtabstop=-1
set synmaxcol=300
set tags=./tags;
set termguicolors
set timeout timeoutlen=500 ttimeoutlen=100
set updatetime=500
set wildignore=*/node_modules/**
set wildmenu
set wildoptions=pum
if has('persistent_undo')
set undofile
" https://github.com/neovim/neovim/commit/6995fad260e3e7c49e4f9dc4b63de03989411c7b
if has('nvim')
let &undodir = expand('$VIMRC_VIM/undofiles/neovim')
else
let &undodir = expand('$VIMRC_VIM/undofiles/vim')
endif
silent! call mkdir(&undodir, 'p')
else
set noundofile
endif
if has('tabsidebar')
let g:tabsidebar_vertsplit = 0
set notabsidebaralign
set notabsidebarwrap
set showtabsidebar=1
set tabsidebarcolumns=10
function! Tabsidebar() abort
try
let tnr = g:actual_curtabpage
let s = printf("\n TABPAGE %d.\n", tnr)
for x in filter(getwininfo(), { i,x -> x.tabnr == tnr })
let bname = fnamemodify(bufname(x.bufnr), ":t")
if empty(bname)
let bname = '[No Name]'
endif
let s = s .. printf(" %s%s\n",
\ ((tabpagenr() == x.tabnr) && (winnr() == x.winnr) ? '*' : ' '),
\ bname)
endfor
return s
catch
return "ERR"
endtry
endfunction
set tabsidebar=%!Tabsidebar()
endif
let &cedit = "\<C-q>"
if $TERM =~# 'xterm-'
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif
let g:vim_indent_cont = &g:shiftwidth
let g:molder_show_hidden = 1
if has('vim_starting')
set packpath=$VIMRC_VIM/github
set runtimepath=$VIMRUNTIME
silent! source ~/.vimrc.local
filetype plugin indent on
syntax enable
packloadall
try
colorscheme aylin
catch
colorscheme default
endtry
endif
augroup vimrc
autocmd!
autocmd VimEnter,BufEnter * :call s:vimrc_init()
autocmd ColorScheme * :highlight! link TabSideBarFill StatusLine
augroup END
function! s:vimrc_init() abort
if has('win32') && executable('wmic') && has('gui_running')
if has('vim_starting')
let g:vimrc_term_cmd = []
function! s:outcb(ch, mes) abort
if 14393 < str2nr(trim(a:mes))
let g:vimrc_term_cmd = ['cmd.exe', '/k', 'doskey pwd=cd && doskey ls=dir /b && set prompt=$E[32m$$$E[0m']
endif
endfunction
call job_start('wmic os get BuildNumber', { 'out_cb': function('s:outcb'), })
endif
command! -nargs=0 Terminal :call term_start(g:vimrc_term_cmd, {
\ 'term_highlight' : 'Terminal',
\ 'term_finish' : 'close',
\ 'term_kill' : 'kill',
\ })
endif
if exists(':PkgSync')
" pkgsync.json is managed by .vimrc
call writefile([json_encode({
\ "packpath": "~/.vim/github",
\ "plugins": {
\ "start": {
\ "AhmedAbdulrahman": [
\ "vim-aylin"
\ ],
\ "kana": [
\ "vim-operator-replace",
\ "vim-operator-user",
\ ],
\ "mattn": [
\ "vim-molder"
\ ],
\ "rbtnn": [
\ "vim-ambiwidth",
\ "vim-gitdiff",
\ "vim-gloaded",
\ "vim-pkgsync",
\ ],
\ "thinca": [
\ "vim-qfreplace",
\ ],
\ }
\ }
\ })], expand('~/pkgsync.json'))
else
function! s:pkgsync_setup() abort
if !isdirectory(expand('$VIMRC_VIM/github/pack/rbtnn/start/vim-pkgsync'))
let path = expand('$VIMRC_VIM/github/pack/rbtnn/start/')
silent! call mkdir(path, 'p')
call term_start(['git', 'clone', '--depth', '1', 'https://github.com/rbtnn/vim-pkgsync.git'], {
\ 'cwd': path,
\ })
echo 'please restart Vim!'
endif
endfunction
command! -nargs=0 PkgSyncSetup :call s:pkgsync_setup()
endif
cabbrev W w
" Can't use <S-space> at :terminal
" https://github.com/vim/vim/issues/6040
tnoremap <silent><S-space> <space>
" Emacs key mappings
if has('win32') && (&shell =~# '\<cmd\.exe$')
tnoremap <silent><C-p> <up>
tnoremap <silent><C-n> <down>
tnoremap <silent><C-b> <left>
tnoremap <silent><C-f> <right>
tnoremap <silent><C-e> <end>
tnoremap <silent><C-a> <home>
tnoremap <silent><C-u> <esc>
tnoremap <silent><C-cr> <cr>
endif
cnoremap <C-b> <left>
cnoremap <C-f> <right>
cnoremap <C-e> <end>
cnoremap <C-a> <home>
nnoremap v <C-v>
nnoremap <silent><C-j> <Cmd>tabnext<cr>
nnoremap <silent><C-k> <Cmd>tabprevious<cr>
tnoremap <silent><C-j> <Cmd>tabnext<cr>
tnoremap <silent><C-k> <Cmd>tabprevious<cr>
nnoremap <silent><C-p> <Cmd>cprevious<cr>zz
nnoremap <silent><C-n> <Cmd>cnext<cr>zz
if get(g:, 'loaded_molder', v:false)
if &filetype == 'molder'
nnoremap <buffer> h <plug>(molder-up)
nnoremap <buffer> l <plug>(molder-open)
nnoremap <buffer> C <Cmd>call chdir(b:molder_dir) \| verbose pwd<cr>
endif
endif
if get(g:, 'loaded_operator_replace', v:false)
nmap <silent>x <Plug>(operator-replace)
endif
endfunction