-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
130 lines (110 loc) · 3.19 KB
/
init.vim
File metadata and controls
130 lines (110 loc) · 3.19 KB
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
" https://vimawesome.com/
set completeopt=menu,menuone,noselect
set mouse=nvih
set laststatus=2
set statusline=%t%m%{get(b:,'coc_git_status','')}%{get(b:,'coc_git_blame','')}\ %=%{&ff}:[%04l,%03v][%3p%%]
set clipboard+=unnamedplus
autocmd InsertLeave * se nocul " 用浅色高亮当前行
autocmd InsertEnter * se cul " 用浅色高亮当前行
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
"--
"- Resources:
"- * Learn lua in X minutes
"- https://learnxinyminutes.com/docs/lua/
"-
"- * Lua crash course (12 min video)
"- https://www.youtube.com/watch?v=NneB6GX1Els
"-
"- * Neovim's official lua guide
"- https://neovim.io/doc/user/lua-guide.html
"-
"- * Lazy.nvim: plugin configuration
"- https://dev.to/vonheikemen/lazynvim-plugin-configuration-3opi
"--
lua << EOF
local version = vim.version()
if version.major == 0 and version.minor < 11 then
vim.api.nvim_err_writeln("Error: Neovim version must be ≥ 0.11 (current: "..version.major.."."..version.minor..")")
return -- 停止后续配置加载
end
-- vim.cmd('verbose map')
vim.opt.termguicolors = true
vim.opt.number = true
-- vim.opt.listchars='tab:>-'
vim.opt.listchars = {
eol = '⤶',
trail = '✚',
extends = '◀',
precedes = '▶',
tab = '␉·',
-- tab = '❤␉',
nbsp = '⎵',
-- space = '❤',
-- set listchars=eol:⏎,,trail:␠,nbsp:
}
vim.opt.list = true
if vim.fn.has("gui_running") then
if vim.g.gui_vimr == 1 then
-- vim.g.gui_vimr
else
vim.opt.guifont = "JetBrainsMono Nerd Font Mono:h14"
end
end
for _, venv in ipairs({"neovim2", "neovim3"}) do
local pypath = vim.fn.system({ "pyenv", "prefix", venv })
if ( vim.v.shell_error == 0 ) then
local pycmd = pypath:gsub("\n", "") .. "/bin/python"
if venv == "neovim3" then
vim.g.python3_host_prog = pycmd
else
vim.g.python_host_prog = pycmd
end
end
end
-- Colors are applied automatically based on user-defined highlight groups.
-- There is no default value
vim.cmd.highlight('IndentLine guifg=#123456')
-- Current indent line highlight
vim.cmd.highlight('IndentLineCurrent guifg=#123456')
vim.g.is_unix = vim.fn.has('unix') == 1 or vim.fn.has('mac') == 1
local load = function(mod)
package.loaded[mod] = nil
return require(mod)
end
-- load('user.commands')
local keymaps = load('user.keymaps')
keymaps.common()
keymaps.which_key()
local settings = load('user.settings')
settings.autocmd()
local plugins = load('user.plugins')
if ( vim.g.colorscheme ~= nil ) then
vim.cmd.colorscheme(vim.g.colorscheme)
else
vim.cmd.colorscheme("gruvbox")
end
EOF
" let s:curdir = fnamemodify(resolve(expand('<sfile>:p')), ':h')
" let s:cfg_files = split(globpath(expand(s:curdir.'/conf'), '*.vim'), '\n')
" call sort(s:cfg_files)
" for fpath in s:cfg_files
" exec 'source' . fnameescape(fpath)
" endfor
" let s:hour=strftime('%H')
" if s:hour >= '07' && s:hour <= '17'
" set background=light
" else
" set background=dark
" endif
let g:vista_default_executive = 'nvim_lsp'
let g:vista_executive_for = {
\ 'cpp': 'nvim_lsp',
\ 'php': 'nvim_lsp',
\ 'python': 'nvim_lsp',
\ 'lua': 'nvim_lsp',
\ }
"
" semshi
" https://github.com/numirias/semshi/blob/master/README.md