-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
99 lines (83 loc) · 2.79 KB
/
init.vim
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
" _ ___ _____ __ __ ___
" | \ | \ \ / /_ _| \/ | / _ \
" | \| |\ \ / / | || |\/| | | | | |
" | |\ | \ V / | || | | | | |_| |
" |_| \_| \_/ |___|_| |_|___\___/
" SYS ENV ---------------------- {{{
" Environment {
" Identify platform {
silent function! OSX()
return has('macunix')
endfunction
silent function! LINUX()
return has('unix') && !has('macunix') && !has('win32unix')
endfunction
silent function! WINDOWS()
return (has('win32') || has('win64'))
endfunction
" }
" Basics {
set nocompatible " Must be first line
if !WINDOWS()
set shell=/bin/zsh
endif
" }
" Windows Compatible {
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
if WINDOWS()
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif
" }
" vim-autoclose不生效的Fix {
" https://github.com/spf13/spf13-vim/issues/780
if &term[:4] == "xterm" || &term[:5] == 'screen' || &term[:3] == 'rxvt'
inoremap <silent> <C-[>OC <RIGHT>
endif
" }
" }
" System ---------------------- {{{
:filetype on
:filetype indent on
:filetype plugin on
:set fencs=utf-8,chinese fenc=utf-8 enc=utf-8
:set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
:set termencoding=utf-8
:syntax on
" Client
:let g:python_host_prog = '/usr/local/bin/python2'
:let g:python3_host_prog = '/opt/homebrew/opt/python@3.10/bin/python3.10'
" :let g:ruby_host_prog = '/opt/homebrew/lib/ruby/gems/3.1.0/bin/neovim-ruby-host'
" 插件镜像地址修改
" :let g:plug_url_format = 'https://git::@github.com.cnpmjs.org/%s.git'
" }}}
let g:vimspector_enable_mappings = 'HUMAN'
" packadd! vimspector
" Basic ---------------------- {{{
augroup basic
autocmd!
autocmd BufReadPost * :let &t_ut=''
autocmd BufReadPost * :set expandtab
autocmd BufReadPost * :set smarttab
autocmd BufReadPost * :set autoindent
autocmd BufReadPost * :set number
autocmd BufReadPost * :set relativenumber
" 保留退出前最后编辑的痕迹
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
augroup END
" }}}
" 插件包引入(vim-plug)
:source $HOME/.vim/init/init-packages.vim
" UI 配置(TODO: 必须跟在package后 否则ui配置不生效)
:source $HOME/.vim/init/init-ui.vim
" 插件配置
:source $HOME/.vim/init/init-better-defaults.vim
" 按键映射
:source $HOME/.vim/init/init-keybindings.vim
" 自定义辅助
:source $HOME/.vim/init/init-assist.vim
" Lua插件包引入(packer)
:source $HOME/.vim/init/init-packer.vim
" 自定义Lua插件
:source $HOME/.vim/lua/init.lua
" }}}