mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 11:20:06 +08:00
Compare commits
353 Commits
af055c0c73
...
7648ccb0b7
Author | SHA1 | Date | |
---|---|---|---|
|
7648ccb0b7 | ||
|
408cc9fbef | ||
|
d40346455c | ||
|
b0b0762037 | ||
|
282e3d5902 | ||
|
864ac61848 | ||
|
22c922b5f3 | ||
|
ef60dd60d6 | ||
|
218f253db0 | ||
|
7efe5bc008 | ||
|
5520a11abd | ||
|
4c4647f5ec | ||
|
de1171ff0c | ||
|
451a0e6ff1 | ||
|
377b7d716b | ||
|
b2a354c0ad | ||
|
3346505fb9 | ||
|
d4f30b8865 | ||
|
dc0d65d0bb | ||
|
793aa62053 | ||
|
bcbe5023d0 | ||
|
0230993946 | ||
|
ea4fb98400 | ||
|
e059b76ca3 | ||
|
f8c9c475f4 | ||
|
0fccfab12d | ||
|
f818591314 | ||
|
7edc45e572 | ||
|
6b653dbf86 | ||
|
921d96cb10 | ||
|
e029d6343c | ||
|
7979f7b043 | ||
|
22b15dfe50 | ||
|
e31f6b2380 | ||
|
f03c8e6ea2 | ||
|
78ce96478d | ||
|
2fea2697e6 | ||
|
2d9fb315bb | ||
|
cb17aecf83 | ||
|
9345f01986 | ||
|
b525e520e5 | ||
|
511480cabc | ||
|
c5202375be | ||
|
e9cc0e46f7 | ||
|
1cd8341200 | ||
|
15d2176463 | ||
|
d2ea5ece2b | ||
|
e00540b1e5 | ||
|
6b7c5a14ce | ||
|
d22a341fc0 | ||
|
6cf0c361b0 | ||
|
bfdf0e0851 | ||
|
522aebb509 | ||
|
74ba9cc90a | ||
|
6a97b72dc3 | ||
|
a10d464ca9 | ||
|
e5f8d2b012 | ||
|
bdc177e320 | ||
|
ee5cc484d1 | ||
|
f6ee684f00 | ||
|
6d0631fe0b | ||
|
a98a673c7d | ||
|
401d549941 | ||
|
47bbf8efc0 | ||
|
271c76e792 | ||
|
fa5d3e1d1c | ||
|
157e276226 | ||
|
097ea8684d | ||
|
24712351a1 | ||
|
d6a34e3aff | ||
|
74748dba2e | ||
|
de1815dd50 | ||
|
2af288455e | ||
|
0ee4532004 | ||
|
87f7eca4c5 | ||
|
6d7ebe6891 | ||
|
5130094e91 | ||
|
9bd6508e8c | ||
|
e9446e63fe | ||
|
ad078317fb | ||
|
e7091fbfaf | ||
|
896a9a43ef | ||
|
8465f680df | ||
|
99466a152f | ||
|
1c4627c212 | ||
|
4d3c680a93 | ||
|
592bf3941a | ||
|
49e00f00f5 | ||
|
721e31186f | ||
|
4515c6162c | ||
|
49b944a29d | ||
|
94c6282ba4 | ||
|
77216853d9 | ||
|
503842a9a3 | ||
|
c2899ae1f8 | ||
|
ea7134702c | ||
|
2ae196cab5 | ||
|
9c31df502d | ||
|
fcaab916b5 | ||
|
fd9a12aa67 | ||
|
db3ea12b2d | ||
|
456d1f2856 | ||
|
5b127e22dd | ||
|
ccfceebe98 | ||
|
7ece5acd37 | ||
|
1d68f475f7 | ||
|
bee24ee792 | ||
|
c28fda48b1 | ||
|
d6bc345442 | ||
|
732401aee9 | ||
|
172b79f658 | ||
|
01e948f6be | ||
|
9e46432d18 | ||
|
78e32eb47d | ||
|
7ff2fec04a | ||
|
ccfc031441 | ||
|
c9fd7f91c7 | ||
|
17a380aed9 | ||
|
545a3bc5fa | ||
|
a7fbe2415b | ||
|
5b3b5886d4 | ||
|
79d9a8323d | ||
|
4db99ea058 | ||
|
d393df8ada | ||
|
1d8dbeb8bb | ||
|
ae6b976930 | ||
|
a31dc92f8e | ||
|
f6e07c5659 | ||
|
f07c2e3e31 | ||
|
5f06cb9eb8 | ||
|
91170cab09 | ||
|
f934a4128b | ||
|
cbc3f5e50c | ||
|
18f2edc395 | ||
|
32aec1ec5b | ||
|
5816fbbbfa | ||
|
99738624b4 | ||
|
7c80fe4369 | ||
|
5cb566b359 | ||
|
ac148697e4 | ||
|
8649032dc5 | ||
|
3d557dceeb | ||
|
34c343b697 | ||
|
3a22f555dd | ||
|
f759826426 | ||
|
180493c1b5 | ||
|
ea2dea6fdc | ||
|
348d868d9d | ||
|
4846788807 | ||
|
a1e9a37951 | ||
|
a3264f9d75 | ||
|
833c9ac3d0 | ||
|
714e3b41ca | ||
|
7f33b177fe | ||
|
6ca19772e1 | ||
|
41aba65a98 | ||
|
2a2deac2e6 | ||
|
ec1f970f3f | ||
|
a87ea5b2f9 | ||
|
254df1095f | ||
|
2083a13ad6 | ||
|
f5c6730177 | ||
|
3e1b7fe5b9 | ||
|
16a5086d8b | ||
|
8244c4a848 | ||
|
ae41ade26d | ||
|
90b7a0b733 | ||
|
70e2ea7d03 | ||
|
f27756c566 | ||
|
735298e5b4 | ||
|
a1596e9f20 | ||
|
887943dc84 | ||
|
62d829d03f | ||
|
4563880fee | ||
|
5b88660a3f | ||
|
2f0cfdf5a0 | ||
|
6a47dd47ca | ||
|
0ad6c2adbb | ||
|
7eb68ca364 | ||
|
44d77ab4bf | ||
|
0ff4ab9255 | ||
|
e7d90f4d82 | ||
|
1eeff6661f | ||
|
78e2b24d4b | ||
|
45ba5c66e5 | ||
|
55ae728f06 | ||
|
57465855c9 | ||
|
f6020d09d5 | ||
|
06770399fd | ||
|
61501adb7b | ||
|
6dafed1aca | ||
|
96fe87f849 | ||
|
4336429e58 | ||
|
04a3402b5a | ||
|
a6a9237d79 | ||
|
7036897359 | ||
|
d4bac8e59e | ||
|
49fff62e21 | ||
|
5ed5184a3d | ||
|
dc63d2459b | ||
|
468322ca4f | ||
|
cf80d38025 | ||
|
c97b857588 | ||
|
591f277cca | ||
|
32bb69aa13 | ||
|
319f432493 | ||
|
de82bea37d | ||
|
f74d1c057a | ||
|
ad5b9e5496 | ||
|
951af73c68 | ||
|
a631440d5a | ||
|
e5387c15c8 | ||
|
dcfc4b0404 | ||
|
681fe2f16d | ||
|
2ad0da4272 | ||
|
f8b280e03e | ||
|
c46968d5e1 | ||
|
9ee8606e80 | ||
|
74c93c6c6a | ||
|
e24e5ec2ec | ||
|
a0a66e301e | ||
|
84cb742b9a | ||
|
5de1889197 | ||
|
874f72ce94 | ||
|
29501af80f | ||
|
f11ad921eb | ||
|
256e72f5e4 | ||
|
bea9bf7ff2 | ||
|
e0f260a169 | ||
|
5796b28ecf | ||
|
166c277645 | ||
|
23446bed8f | ||
|
fe719db366 | ||
|
4c02edf30b | ||
|
8a89c5f743 | ||
|
85b35020e0 | ||
|
1c3e61b5c5 | ||
|
dc65e2b3bf | ||
|
5d9a515653 | ||
|
13f564b23a | ||
|
0559ad462d | ||
|
f80b8fd88e | ||
|
54072389a9 | ||
|
3da309e1b2 | ||
|
e341ee2971 | ||
|
05babbac17 | ||
|
5b8271a737 | ||
|
a3944d67fb | ||
|
f56ae9c4db | ||
|
3ce8cfd6dc | ||
|
a36a958357 | ||
|
fa053d3d56 | ||
|
6023d20227 | ||
|
8a49f600b3 | ||
|
4067eef913 | ||
|
c088a642df | ||
|
02528cf3c7 | ||
|
0433e60e83 | ||
|
a4757de8cf | ||
|
23a8289662 | ||
|
e629491197 | ||
|
9947755e66 | ||
|
206c56db80 | ||
|
b9741e7c2b | ||
|
b9cc3e76e9 | ||
|
f46cd4aab5 | ||
|
1d323bfcc3 | ||
|
1c31f7218a | ||
|
9d01f6db8c | ||
|
80cc95887e | ||
|
4c6a80d9a5 | ||
|
89ddeb2497 | ||
|
4e3bdac883 | ||
|
83be314258 | ||
|
b5866a81e7 | ||
|
ea76ba75aa | ||
|
031a6a2497 | ||
|
1c9a09223f | ||
|
03c9f6b01b | ||
|
cb6510f4ff | ||
|
e5573683ae | ||
|
d7e45e884b | ||
|
56d1f34917 | ||
|
b33626c63b | ||
|
870f8fee96 | ||
|
b2651ab24a | ||
|
8077f78d13 | ||
|
f791f5bbd8 | ||
|
42ed861445 | ||
|
7bad66fad6 | ||
|
fda1dcd028 | ||
|
302804ac9e | ||
|
1c17c7d164 | ||
|
0fe85e9a53 | ||
|
3e39df3c89 | ||
|
a77d42c9d8 | ||
|
27f8a3dd44 | ||
|
44f0cea649 | ||
|
5e6065380f | ||
|
e25b45fc3a | ||
|
0e4561c524 | ||
|
8cbdeab879 | ||
|
e4eaf08443 | ||
|
4f4a001ad4 | ||
|
2dc6512397 | ||
|
85968ea1cc | ||
|
133c24ab5f | ||
|
9ff8cd53f1 | ||
|
9a55c1266c | ||
|
d26a6add50 | ||
|
6474a325ce | ||
|
2d8a09fb24 | ||
|
4ec679494c | ||
|
0e96d80d3f | ||
|
2874b81aac | ||
|
7533737080 | ||
|
d7fedb08fd | ||
|
20024e9af0 | ||
|
f09bf4b4f3 | ||
|
b3a18b2367 | ||
|
f8bb09b19c | ||
|
ae657eb2d7 | ||
|
5c92ec644f | ||
|
043dc34c38 | ||
|
ab5b059736 | ||
|
e95cee105d | ||
|
5f274bc97f | ||
|
b6aa4b9fea | ||
|
42d2af638e | ||
|
977bf3d0d0 | ||
|
e1fc546d7f | ||
|
cbaf31f8cc | ||
|
6a7c968f8a | ||
|
9169a2db2a | ||
|
1115c2c9e2 | ||
|
7e53b3b884 | ||
|
bfef1c9d73 | ||
|
a22c463d2a | ||
|
26a02014e8 | ||
|
cc7ce88d3e | ||
|
1fae37933e | ||
|
02c93e237e | ||
|
384faecd49 | ||
|
c50c9493d6 | ||
|
17a1cbe151 | ||
|
f7ebfb455e | ||
|
7cceee2793 | ||
|
ee37afbe7d | ||
|
63a8e25b86 | ||
|
13264157ee | ||
|
1b85677baf | ||
|
c1541c006e | ||
|
daf814589b |
@ -7,12 +7,44 @@
|
||||
"=============================================================================
|
||||
|
||||
let s:AUTODOC = SpaceVim#api#import('dev#autodoc')
|
||||
let s:AUTODOC.begin = '^<!-- SpaceVim follow HEAD en start -->$'
|
||||
let s:AUTODOC.end = '^<!-- SpaceVim follow HEAD en end -->$'
|
||||
let s:AUTODOC.begin = '^<!-- SpaceVim follow HEAD start -->$'
|
||||
let s:AUTODOC.end = '^<!-- SpaceVim follow HEAD end -->$'
|
||||
|
||||
|
||||
function! s:generate_content(lang) abort
|
||||
let content = SpaceVim#dev#releases#parser_prs(a:lang)
|
||||
return content
|
||||
if a:lang == 'cn'
|
||||
let features = ['## 新特性', '']
|
||||
let bugfixs = ['', '## 问题修复', '']
|
||||
let docs = ['', '## 文档更新', '']
|
||||
let tests = ['', '## 测试', '']
|
||||
let others = ['', '## 其他', '']
|
||||
let breakchanges = ['', '## 非兼容变更']
|
||||
else
|
||||
let features = ['## New features', '']
|
||||
let bugfixs = ['', '## Bugfixs', '']
|
||||
let docs = ['', '## Docs', '']
|
||||
let tests = ['', '## Tests', '']
|
||||
let others = ['', '## Others', '']
|
||||
let breakchanges = ['', '## Breakchanges']
|
||||
endif
|
||||
let logs = systemlist('git log --oneline --pretty="- %s" 2a2deac2..HEAD')
|
||||
for l in logs
|
||||
if l =~ '^- [^(]*([^)]*)!:'
|
||||
call add(breakchanges, l)
|
||||
elseif l =~ '^- feat(' || l =~ '^- perf('
|
||||
call add(features, l)
|
||||
elseif l =~ '^- fix('
|
||||
call add(bugfixs, l)
|
||||
elseif l =~ '^- docs('
|
||||
call add(docs, l)
|
||||
elseif l =~ '^- test('
|
||||
call add(tests, l)
|
||||
else
|
||||
call add(others, l)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return features + bugfixs + docs + tests + others + breakchanges
|
||||
endfunction
|
||||
|
||||
let s:AUTODOC.content_func = function('s:generate_content')
|
||||
|
@ -1,156 +0,0 @@
|
||||
--!/usr/bin/lua
|
||||
|
||||
local M = {}
|
||||
|
||||
local function executable(exe) -- {{{
|
||||
return vim.fn.executable(exe) == 1
|
||||
end
|
||||
-- }}}
|
||||
|
||||
local logger = require('spacevim.logger').derive('bundle')
|
||||
local nt = require('spacevim.api').import('notify')
|
||||
local jobs = {}
|
||||
|
||||
local function rename_exit(id, data, event) -- {{{
|
||||
logger.info('extract job exit code:' .. data)
|
||||
if data == 0 then
|
||||
local b = jobs['rename_id_' .. id]
|
||||
if b then
|
||||
nt.notify('update bundle files')
|
||||
end
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
local function rename_bundle(id, data, evet) -- {{{
|
||||
logger.info('extract job exit code:' .. data)
|
||||
if data == 0 then
|
||||
local b = jobs['remove_old_bundle_id_' .. id]
|
||||
if b then
|
||||
local p
|
||||
if b.branch then
|
||||
p = '/refs/heads/' .. b.branch
|
||||
elseif b.commit then
|
||||
p = '/archive/' .. b.commit
|
||||
end
|
||||
local target = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p
|
||||
if b.branch then
|
||||
p = b.repo .. '-' .. b.branch
|
||||
elseif b.commit then
|
||||
p = b.repo .. '-' .. b.commit
|
||||
end
|
||||
target = target .. '/' .. p
|
||||
local cmd = { 'mv', target, 'bundle/' .. b.directory }
|
||||
logger.info(vim.inspect(cmd))
|
||||
local jobid = vim.fn.jobstart(cmd, { on_exit = rename_exit })
|
||||
logger.info('job id is:' .. jobid)
|
||||
if jobid > 0 then
|
||||
jobs['rename_id_' .. jobid] = b
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
local function remove_old_bundle(id, data, event) -- {{{
|
||||
logger.info('extract job exit code:' .. data)
|
||||
if data == 0 then
|
||||
local b = jobs['extract_id_' .. id]
|
||||
if b then
|
||||
local old_bundle = 'bundle/' .. b.directory
|
||||
local cmd = { 'rm', '-rf', old_bundle }
|
||||
logger.info(vim.inspect(cmd))
|
||||
local jobid = vim.fn.jobstart(cmd, { on_exit = rename_bundle })
|
||||
logger.info('job id is:' .. jobid)
|
||||
if jobid > 0 then
|
||||
jobs['remove_old_bundle_id_' .. jobid] = b
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
-- }}}
|
||||
|
||||
local function extract(b) -- {{{
|
||||
if not executable('unzip') then
|
||||
nt.notify('unzip is not executable!')
|
||||
return
|
||||
end
|
||||
local p
|
||||
if b.branch then
|
||||
p = '/refs/heads/' .. b.branch
|
||||
elseif b.commit then
|
||||
p = '/archive/' .. b.commit
|
||||
end
|
||||
local target = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p
|
||||
local zipfile = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p .. '.zip'
|
||||
local cmd = { 'unzip', '-d', target, zipfile }
|
||||
logger.info(vim.inspect(cmd))
|
||||
local jobid = vim.fn.jobstart(cmd, { on_exit = remove_old_bundle })
|
||||
logger.info('job id is:' .. jobid)
|
||||
if jobid > 0 then
|
||||
jobs['extract_id_' .. jobid] = b
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
local function download_exit(id, data, event) -- {{{
|
||||
logger.info('download job exit code:' .. data)
|
||||
if data == 0 then
|
||||
local b = jobs['download_id_' .. id]
|
||||
if b then
|
||||
extract(b)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
function M.download(b) -- {{{
|
||||
if not executable('curl') then
|
||||
nt.notify('curl is not executable!')
|
||||
return
|
||||
end
|
||||
logger.info('start to download bundle:\n' .. vim.inspect(b))
|
||||
-- local cmd = { 'curl', '-L', '--create-dirs' }
|
||||
local cmd = { 'curl', '-fLo' }
|
||||
local p
|
||||
if b.branch then
|
||||
p = '/refs/heads/' .. b.branch
|
||||
elseif b.commit then
|
||||
p = '/archive/' .. b.commit
|
||||
end
|
||||
local url = b.url .. b.username .. '/' .. b.repo .. '/' .. p .. '.zip'
|
||||
local f = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p .. '.zip'
|
||||
table.insert(cmd, f)
|
||||
table.insert(cmd, '--create-dirs')
|
||||
table.insert(cmd, url)
|
||||
logger.info(vim.inspect(cmd))
|
||||
local jobid = vim.fn.jobstart(cmd, { on_exit = download_exit })
|
||||
logger.info('job id is:' .. jobid)
|
||||
if jobid > 0 then
|
||||
jobs['download_id_' .. jobid] = b
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_bundles() -- {{{
|
||||
local bs = vim.api.nvim_eval("SpaceVim#api#data#toml#get().parse_file('bundle/plugins.toml')")
|
||||
M.__bs = bs.repos
|
||||
return bs.repos
|
||||
end
|
||||
-- }}}
|
||||
|
||||
function M.complete(a, b, c) -- {{{
|
||||
if not M.__bs then
|
||||
M.get_bundles()
|
||||
end
|
||||
local rst = {}
|
||||
for _, v in pairs(M.__bs) do
|
||||
if vim.startswith(v.repo, a) then
|
||||
table.insert(rst, v.username .. '/' .. v.repo)
|
||||
end
|
||||
end
|
||||
return rst
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return M
|
@ -1,12 +0,0 @@
|
||||
local b = require('spacevim.dev.bundle')
|
||||
vim.api.nvim_create_user_command('SPBundleUpdate', function(opt)
|
||||
local bundles = b.get_bundles()
|
||||
if opt.fargs[1] == 'all' then for _, v in pairs(bundles) do b.download(v) end end
|
||||
for _, v in pairs(bundles) do
|
||||
if v.username .. '/' .. v.repo == opt.fargs[1] then
|
||||
b.download(v)
|
||||
return
|
||||
end
|
||||
end
|
||||
print('can not find bundle:' .. opt.fargs[1])
|
||||
end, { nargs = 1, complete = b.complete })
|
@ -1,22 +1,24 @@
|
||||
vim.api.nvim_create_user_command('Nvim', function(opt)
|
||||
local cmd = { 'nvim-qt', '--' }
|
||||
for _, v in pairs(opt.fargs) do
|
||||
table.insert(cmd, v)
|
||||
end
|
||||
if vim.api.nvim_create_user_command then
|
||||
vim.api.nvim_create_user_command('Nvim', function(opt)
|
||||
local cmd = { 'nvim-qt', '--' }
|
||||
for _, v in pairs(opt.fargs) do
|
||||
table.insert(cmd, v)
|
||||
end
|
||||
|
||||
vim.fn.jobstart(cmd)
|
||||
end, { nargs = '*', complete = 'file' })
|
||||
vim.fn.jobstart(cmd)
|
||||
end, { nargs = '*', complete = 'file' })
|
||||
|
||||
vim.api.nvim_create_user_command('Vim', function(opt)
|
||||
local cmd = { 'gvim', }
|
||||
for _, v in pairs(opt.fargs) do
|
||||
table.insert(cmd, v)
|
||||
end
|
||||
vim.api.nvim_create_user_command('Vim', function(opt)
|
||||
local cmd = { 'gvim' }
|
||||
for _, v in pairs(opt.fargs) do
|
||||
table.insert(cmd, v)
|
||||
end
|
||||
|
||||
vim.fn.jobstart(cmd, {
|
||||
env = {
|
||||
VIM = '',
|
||||
VIMRUNTIME = ''
|
||||
}
|
||||
})
|
||||
end, { nargs = '*', complete = 'file' })
|
||||
vim.fn.jobstart(cmd, {
|
||||
env = {
|
||||
VIM = '',
|
||||
VIMRUNTIME = '',
|
||||
},
|
||||
})
|
||||
end, { nargs = '*', complete = 'file' })
|
||||
end
|
||||
|
@ -144,6 +144,30 @@ alternate = "docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md"
|
||||
["docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md"]
|
||||
alternate = "docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md"
|
||||
|
||||
["docs/_posts/2020-11-28-use-vim-as-a-nim-ide.md"]
|
||||
alternate = "docs/_posts/2024-03-09-use-vim-as-a-nim-ide.md"
|
||||
|
||||
["docs/_posts/2024-03-09-use-vim-as-a-nim-ide.md"]
|
||||
alternate = "docs/_posts/2020-11-28-use-vim-as-a-nim-ide.md"
|
||||
|
||||
["docs/_posts/2020-08-10-use-vim-as-a-swift-ide.md"]
|
||||
alternate = "docs/_posts/2024-03-09-use-vim-as-a-swift-ide.md"
|
||||
|
||||
["docs/_posts/2024-03-09-use-vim-as-a-swift-ide.md"]
|
||||
alternate = "docs/_posts/2020-08-10-use-vim-as-a-swift-ide.md"
|
||||
|
||||
["docs/_posts/2022-04-24-use-vim-as-a-scala-ide.md"]
|
||||
alternate = "docs/_posts/2024-03-09-use-vim-as-a-scala-ide.md"
|
||||
|
||||
["docs/_posts/2024-03-09-use-vim-as-a-scala-ide.md"]
|
||||
alternate = "docs/_posts/2022-04-24-use-vim-as-a-scala-ide.md"
|
||||
|
||||
["docs/_posts/2024-03-01-use-vim-as-a-elixir-ide.md"]
|
||||
alternate = "docs/_posts/2020-08-13-use-vim-as-a-elixir-ide.md"
|
||||
|
||||
["docs/_posts/2020-08-13-use-vim-as-a-elixir-ide.md"]
|
||||
alternate = "docs/_posts/2024-03-01-use-vim-as-a-elixir-ide.md"
|
||||
|
||||
["README.md"]
|
||||
alternate = "README.cn.md"
|
||||
|
||||
|
@ -1,9 +1,260 @@
|
||||
[vader-test]
|
||||
# 测试版本:
|
||||
# vim 7.4.052 Ubuntu 14.04
|
||||
# vim 7.4.1689 Ubuntu 16.04
|
||||
# vim 8.0.1453 Ubuntu 18.04
|
||||
# vim 8.1.2269 Ubuntu 20.04
|
||||
# vim 8.2.3995 Ubuntu 22.04
|
||||
# vim 9.1.0016 Ubuntu 24.04
|
||||
# nvim 0.4.3 Ubuntu 20.04
|
||||
# nvim 0.6.1 Ubuntu 22.04
|
||||
# nvim 0.7.2 Ubuntu 24.04
|
||||
# - vimbin: vim
|
||||
# vimtag: v7.4.052
|
||||
# disable_es: true
|
||||
# - vimbin: vim
|
||||
# vimtag: v7.4.629
|
||||
# disable_es: true
|
||||
# - vimbin: vim
|
||||
# vimtag: v7.4.1689
|
||||
# disable_es: true
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.0.0027
|
||||
# disable_es: true
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.0.0183
|
||||
# disable_es: true
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.0.0184
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.0.1453
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.1.2269
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.2.2434
|
||||
# - vimbin: vim
|
||||
# vimtag: v8.2.3995
|
||||
# - vimbin: vim
|
||||
# vimtag: nightly
|
||||
# - vimbin: nvim
|
||||
# vimtag: nightly
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.9.1
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.9.0
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.8.3
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.8.2
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.8.1
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.8.0
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.7.2
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.7.0
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.6.1
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.6.0
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.5.1
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.5.0
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.4.4
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.4.3
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.4.2
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.4.0
|
||||
# - vimbin: nvim
|
||||
# vimtag: v0.3.8
|
||||
|
||||
[vader-nvim-win]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-test.options.env]
|
||||
[vader-nvim-win.options.env]
|
||||
VIM_BIN = 'nvim'
|
||||
VIM_Es = "--headless"
|
||||
[vader-nvim-wsl]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-nvim-wsl.options.env]
|
||||
VIM_BIN = 'wsl -e nvim'
|
||||
VIM_Es = "--headless"
|
||||
[vader-nvim-038]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-nvim-038.options.env]
|
||||
VIM_BIN = 'D:\Neovim\v0.3.8\bin\nvim.exe'
|
||||
VIM_Es = "--headless"
|
||||
VIM = 'D:\Neovim\v0.3.8'
|
||||
VIMRUNTIME = 'D:\Neovim\v0.3.8\share\nvim\runtime'
|
||||
[vader-nvim-050]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-nvim-050.options.env]
|
||||
VIM_BIN = 'D:\Neovim\v0.5.0\bin\nvim.exe'
|
||||
VIM_Es = "--headless"
|
||||
VIM = 'D:\Neovim\v0.5.0'
|
||||
VIMRUNTIME = 'D:\Neovim\v0.5.0\share\nvim\runtime'
|
||||
[vader-nvim-061]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-nvim-061.options.env]
|
||||
VIM_BIN = 'D:\Neovim\v0.6.1\bin\nvim.exe'
|
||||
VIM_Es = "--headless"
|
||||
VIM = 'D:\Neovim\v0.6.1'
|
||||
VIMRUNTIME = 'D:\Neovim\v0.6.1\share\nvim\runtime'
|
||||
[vader-nvim-072]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-nvim-072.options.env]
|
||||
VIM_BIN = 'D:\Neovim\v0.7.2\bin\nvim.exe'
|
||||
VIM_Es = "--headless"
|
||||
VIM = 'D:\Neovim\v0.7.2'
|
||||
[vader-nvim-080]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-nvim-080.options.env]
|
||||
VIM_BIN = 'D:\Neovim\v0.8.0\bin\nvim.exe'
|
||||
VIM_Es = "--headless"
|
||||
VIM = 'D:\Neovim\v0.8.0'
|
||||
# vim 7.4.1185
|
||||
[vader-vim-741185]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-741185.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_7.4.1185_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_7.4.1185_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_7.4.1185_x64'
|
||||
[vader-vim-741185-buf]
|
||||
command = 'D:\Vim\gvim_7.4.1185_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-741185-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_7.4.1185_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_7.4.1185_x64'
|
||||
# vim 7.4.1689
|
||||
[vader-vim-741689]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-741689.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_7.4.1689_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_7.4.1689_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_7.4.1689_x64'
|
||||
[vader-vim-741689-buf]
|
||||
command = 'D:\Vim\gvim_7.4.1689_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-741689-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_7.4.1689_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_7.4.1689_x64'
|
||||
# vim 8.0.0027
|
||||
[vader-vim-800027]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-800027.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_8.0.0027_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_8.0.0027_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.0.0027_x64'
|
||||
[vader-vim-800027-buf]
|
||||
command = 'D:\Vim\gvim_8.0.0027_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-800027-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_8.0.0027_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.0.0027_x64'
|
||||
# vim 8.0.1453
|
||||
[vader-vim-801453]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-801453.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_8.0.1453_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_8.0.1453_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.0.1453_x64'
|
||||
[vader-vim-801453-buf]
|
||||
command = 'D:\Vim\gvim_8.0.1453_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-801453-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_8.0.1453_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.0.1453_x64'
|
||||
# vim 8.1.2269
|
||||
[vader-vim-812269]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-812269.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_8.1.2269_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_8.1.2269_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.1.2269_x64'
|
||||
[vader-vim-812269-buf]
|
||||
command = 'D:\Vim\gvim_8.1.2269_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-812269-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_8.1.2269_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.1.2269_x64'
|
||||
# vim 8.2.3995
|
||||
[vader-vim-823995]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-823995.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_8.2.3995_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_8.2.3995_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.2.3995_x64'
|
||||
[vader-vim-823995-buf]
|
||||
command = 'D:\Vim\gvim_8.2.3995_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-823995-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_8.2.3995_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_8.2.3995_x64'
|
||||
# vim 9.1.0196
|
||||
[vader-vim-910196]
|
||||
command = "make"
|
||||
args = ['test']
|
||||
isBackground = false
|
||||
[vader-vim-910196.options.env]
|
||||
VIM_BIN = 'D:\Vim\gvim_9.1.0196_x64\vim.exe'
|
||||
VIM_Es = "-Es"
|
||||
VIM = 'D:\Vim\gvim_9.1.0196_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_9.1.0196_x64'
|
||||
[vader-vim-910196-buf]
|
||||
command = 'D:\Vim\gvim_9.1.0196_x64\vim.exe'
|
||||
args = ['-Nu', 'test/vimrc', '-Es', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-vim-910196-buf.options.env]
|
||||
VIM = 'D:\Vim\gvim_9.1.0196_x64'
|
||||
VIMRUNTIME = 'D:\Vim\gvim_9.0.0196_x64'
|
||||
[vader-nvim-buf]
|
||||
command = 'nvim'
|
||||
args = ['-Nu', 'test/vimrc', '--headless', '-c', 'Vader! ${relativeFile}']
|
||||
isBackground = false
|
||||
[vader-nvim-buf.options.env]
|
||||
VIM = ''
|
||||
VIMRUNTIME = ''
|
||||
[generate-vim-doc]
|
||||
command = "python"
|
||||
args = ['-m', 'vimdoc', '.']
|
||||
@ -22,9 +273,28 @@
|
||||
[test_regexp.problemMatcher]
|
||||
useStdout = true
|
||||
[test_regexp.problemMatcher.pattern]
|
||||
regexp = '\(.*\):\(\d\+\):\(\d\+\)\s\(\S.*\)'
|
||||
file = 1
|
||||
line = 2
|
||||
column = 3
|
||||
#severity = 4
|
||||
message = 4
|
||||
regexp = '\(.*\):\(\d\+\):\(\d\+\)\s\(\S.*\)'
|
||||
file = 1
|
||||
line = 2
|
||||
column = 3
|
||||
#severity = 4
|
||||
message = 4
|
||||
[open-nvim-050]
|
||||
command = "wt.exe"
|
||||
args = ['new-tab', '-p', 'nvim-v0.5.0']
|
||||
isBackground = true
|
||||
[open-nvim-050.options]
|
||||
cwd = 'C:\Users\wsdjeg\.SpaceVim'
|
||||
[open-nvim-050.options.env]
|
||||
VIM = 'D:\Neovim\v0.5.0'
|
||||
VIMRUNTIME = 'D:\Neovim\v0.5.0\share\nvim\runtime'
|
||||
[open-nvim-030]
|
||||
command = "wt.exe"
|
||||
args = ['new-tab', '-p', 'nvim-v0.3.0']
|
||||
isBackground = true
|
||||
description = 'open neovim v0.3.0 in new terminal tab'
|
||||
[open-nvim-030.options]
|
||||
cwd = 'C:\Users\wsdjeg\.SpaceVim'
|
||||
[open-nvim-030.options.env]
|
||||
VIM = 'D:\Neovim\v0.3.0\share\nvim'
|
||||
VIMRUNTIME = 'D:\Neovim\v0.3.0\share\nvim\runtime'
|
||||
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
# usage: script/bootstrap
|
||||
#
|
||||
|
||||
cd docs && bundle install
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
# usage: script/build-production
|
||||
#
|
||||
# Run the jekyll build
|
||||
|
||||
cd docs && bundle exec jekyll build
|
@ -1,75 +0,0 @@
|
||||
exe 'set nocp'
|
||||
set rtp+=/build/GitHub.vim
|
||||
set rtp+=/API
|
||||
so /build/GitHub.vim/plugin/github.vim
|
||||
let s:LIST = SpaceVim#api#import('data#list')
|
||||
let s:log = filereadable('build_log') ? system('cat build_log') : ''
|
||||
let g:githubapi_verbose = 1
|
||||
function! s:update_log(log, summary, new_log) abort
|
||||
let log = split(a:log, "\n")
|
||||
let begin = -1
|
||||
let end = -1
|
||||
for i in range(len(log))
|
||||
if log[i] =~ a:summary
|
||||
let begin = i
|
||||
endif
|
||||
if begin != -1 && log[i] ==# '</details>'
|
||||
let end = i
|
||||
endif
|
||||
endfor
|
||||
if begin != -1 && end != -1
|
||||
return s:LIST.replace(log, begin, end, split(a:new_log, "\n"))
|
||||
else
|
||||
return a:log . "\n" . a:new_log
|
||||
endif
|
||||
|
||||
endfunction
|
||||
if !empty(s:log)
|
||||
if $LINT ==# 'vader'
|
||||
let s:summary = $VIM . ' ' . $LINT . ' build log'
|
||||
else
|
||||
let s:summary = $LINT . ' build log'
|
||||
endif
|
||||
let s:log = '<details><summary>' . s:summary . "</summary>\n" . s:log . "\n</details>"
|
||||
let s:comments = github#api#issues#List_comments('SpaceVim', 'SpaceVim',$TRAVIS_PULL_REQUEST ,'')
|
||||
if empty(s:comments)
|
||||
call github#api#issues#Create_comment('SpaceVim','SpaceVim', $TRAVIS_PULL_REQUEST, {'body': s:log}, 'SpaceVimBot', $BOTSECRET)
|
||||
else
|
||||
let s:nr = 0
|
||||
for s:comment in s:comments
|
||||
if s:comment.user.login ==# 'SpaceVimBot'
|
||||
let s:nr = s:comment.id
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if s:nr == 0
|
||||
call github#api#issues#Create_comment('SpaceVim','SpaceVim', $TRAVIS_PULL_REQUEST, {'body': s:log}, 'SpaceVimBot', $BOTSECRET)
|
||||
else
|
||||
call github#api#issues#Edit_comment('SpaceVim','SpaceVim', s:nr,
|
||||
\ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
if $LINT ==# 'vader'
|
||||
let s:summary = $VIM . ' ' . $LINT . ' build log'
|
||||
else
|
||||
let s:summary = $LINT . ' build log'
|
||||
endif
|
||||
let s:log = '<details><summary>' . s:summary . "</summary>\n" . s:log . "\n</details>"
|
||||
let s:comments = github#api#issues#List_comments('SpaceVim', 'SpaceVim',$TRAVIS_PULL_REQUEST ,'')
|
||||
if !empty(s:comments)
|
||||
let s:nr = 0
|
||||
for s:comment in s:comments
|
||||
if s:comment.user.login ==# 'SpaceVimBot'
|
||||
let s:nr = s:comment.id
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if s:nr != 0
|
||||
call github#api#issues#Edit_comment('SpaceVim','SpaceVim', s:nr,
|
||||
\ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
echom v:shell_error
|
||||
quit
|
@ -1,455 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_detact () {
|
||||
cp -f ../../$1 $1
|
||||
}
|
||||
|
||||
_detact_bundle () {
|
||||
cp -f ../../bundle/$1/$2 $2
|
||||
}
|
||||
|
||||
_checkdir () {
|
||||
if [[ ! -d "$1" ]]; then
|
||||
mkdir -p $1
|
||||
fi
|
||||
}
|
||||
|
||||
_default_readme () {
|
||||
cat <<EOT > README.md
|
||||
# $1
|
||||
> $2
|
||||
|
||||
This plugin is automatically detach from [SpaceVim](https://github.com/SpaceVim/SpaceVim/). you can use it without SpaceVim.
|
||||
EOT
|
||||
}
|
||||
|
||||
|
||||
main () {
|
||||
case "$1" in
|
||||
flygrep)
|
||||
git clone https://github.com/wsdjeg/FlyGrep.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir syntax/
|
||||
_checkdir autoload/SpaceVim/api
|
||||
_checkdir autoload/SpaceVim/api/vim
|
||||
_checkdir autoload/SpaceVim/api/neovim
|
||||
_checkdir autoload/SpaceVim/api/data
|
||||
_checkdir autoload/SpaceVim/mapping
|
||||
_checkdir autoload/SpaceVim/plugins
|
||||
_detact autoload/SpaceVim/plugins/flygrep.vim
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/api/logger.vim
|
||||
_detact autoload/SpaceVim/api/vim/buffer.vim
|
||||
_detact autoload/SpaceVim/api/vim/regex.vim
|
||||
_detact autoload/SpaceVim/api/vim/compatible.vim
|
||||
_detact autoload/SpaceVim/api/vim/floating.vim
|
||||
_detact autoload/SpaceVim/api/vim/highlight.vim
|
||||
_detact autoload/SpaceVim/api/vim/statusline.vim
|
||||
_detact autoload/SpaceVim/api/vim/window.vim
|
||||
_detact autoload/SpaceVim/api/neovim/floating.vim
|
||||
_detact autoload/SpaceVim/api/data/dict.vim
|
||||
_detact autoload/SpaceVim/api/data/list.vim
|
||||
_detact autoload/SpaceVim/api/data/json.vim
|
||||
_detact autoload/SpaceVim/api/data/string.vim
|
||||
_detact autoload/SpaceVim/api/prompt.vim
|
||||
_detact autoload/SpaceVim/api/job.vim
|
||||
_detact autoload/SpaceVim/api/vim.vim
|
||||
_detact autoload/SpaceVim/api/file.vim
|
||||
_detact autoload/SpaceVim/api/system.vim
|
||||
_detact autoload/SpaceVim/api/time.vim
|
||||
_detact autoload/SpaceVim/mapping/search.vim
|
||||
_detact autoload/SpaceVim/logger.vim
|
||||
# detach lua version flygrep
|
||||
_checkdir lua/spacevim/api
|
||||
_checkdir lua/spacevim/api/vim
|
||||
_checkdir lua/spacevim/plugin
|
||||
_detact lua/spacevim/plugin/flygrep.lua
|
||||
_detact lua/spacevim/plugin/search.lua
|
||||
_detact lua/spacevim.lua
|
||||
_detact lua/spacevim/logger.lua
|
||||
_detact lua/spacevim/api.lua
|
||||
_detact lua/spacevim/api/logger.lua
|
||||
_detact lua/spacevim/api/prompt.lua
|
||||
_detact lua/spacevim/api/notify.lua
|
||||
_detact lua/spacevim/api/password.lua
|
||||
_detact lua/spacevim/api/vim.lua
|
||||
_detact lua/spacevim/api/system.lua
|
||||
_detact lua/spacevim/api/vim/compatible.lua
|
||||
_detact lua/spacevim/api/vim/highlight.lua
|
||||
_detact lua/spacevim/api/vim/regex.lua
|
||||
_detact lua/spacevim/api/vim/keys.lua
|
||||
_detact lua/spacevim/api/vim/buffer.lua
|
||||
_detact lua/spacevim/api/vim/window.lua
|
||||
_detact lua/spacevim/api/vim/statusline.lua
|
||||
# detach syntax/ftplugin etc
|
||||
_detact syntax/SpaceVimFlyGrep.vim
|
||||
# detach bundle
|
||||
_checkdir plugin
|
||||
_detact_bundle FlyGrep plugin/FlyGrep.vim
|
||||
_detact_bundle FlyGrep README.md
|
||||
_detact_bundle FlyGrep addon-info.json
|
||||
_checkdir doc/
|
||||
_detact_bundle FlyGrep doc/FlyGrep.txt
|
||||
# detach LICENSE
|
||||
_detact LICENSE
|
||||
# detach test vimrc
|
||||
_checkdir test
|
||||
_detact_bundle FlyGrep test/vimrc
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_flygrep https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/FlyGrep.vim.git
|
||||
git push wsdjeg_flygrep master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
dein-ui)
|
||||
git clone https://github.com/wsdjeg/dein-ui.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir syntax/
|
||||
_checkdir autoload/SpaceVim/api
|
||||
_checkdir autoload/SpaceVim/api/data
|
||||
_checkdir autoload/SpaceVim/api/vim
|
||||
_checkdir autoload/SpaceVim/mapping
|
||||
_checkdir autoload/SpaceVim/plugins
|
||||
_detact autoload/SpaceVim/plugins/manager.vim
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/commands.vim
|
||||
_detact autoload/SpaceVim/logger.vim
|
||||
_detact autoload/SpaceVim/api/job.vim
|
||||
_detact autoload/SpaceVim/api/system.vim
|
||||
_detact autoload/SpaceVim/api/data/list.vim
|
||||
_detact autoload/SpaceVim/api/vim/compatible.vim
|
||||
_detact syntax/SpaceVimPlugManager.vim
|
||||
_detact LICENSE
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_dein_ui https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/dein-ui.vim.git
|
||||
git push wsdjeg_dein_ui master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
iedit)
|
||||
git clone https://github.com/wsdjeg/iedit.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir autoload/SpaceVim/api/vim
|
||||
_checkdir autoload/SpaceVim/api/data
|
||||
_checkdir autoload/SpaceVim/plugins
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/api/vim/compatible.vim
|
||||
_detact autoload/SpaceVim/api/vim/highlight.vim
|
||||
_detact autoload/SpaceVim/api/data/string.vim
|
||||
_detact autoload/SpaceVim/plugins/iedit.vim
|
||||
_checkdir autoload/plugin
|
||||
cat <<EOT > autoload/plugin/iedit.vim
|
||||
"=============================================================================
|
||||
" iedit.vim --- multiple cursor support for neovim and vim
|
||||
" Copyright (c) 2016-2022 Shidong Wang & Contributors
|
||||
" Author: Shidong Wang < wsdjeg@outlook.com >
|
||||
" URL: https://github.com/wsdjeg/iedit.vim
|
||||
" License: MIT license
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section Introduction, intro
|
||||
" @stylized iedit.vim
|
||||
" @library
|
||||
" @order intro version dicts functions exceptions layers api faq
|
||||
" multiple cursor in vim, written in pure vim script for MacVim, gvim and vim version
|
||||
" 8.0+.
|
||||
"
|
||||
|
||||
command! -nargs=0 Iedit call SpaceVim#plugins#iedit#start()
|
||||
EOT
|
||||
_detact LICENSE
|
||||
_default_readme "iedit.vim" "multiple cussor support for Vim/Neovim"
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update"
|
||||
git remote add wsdjeg_vim_todo https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/iedit.vim.git
|
||||
git push wsdjeg_vim_todo master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
vim-todo)
|
||||
git clone https://github.com/wsdjeg/vim-todo.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir syntax/
|
||||
_detact syntax/SpaceVimTodoManager.vim
|
||||
_checkdir autoload/SpaceVim/api/vim
|
||||
_checkdir autoload/SpaceVim/api/data
|
||||
_checkdir autoload/SpaceVim/plugins
|
||||
_checkdir autoload/SpaceVim/mapping
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/api/logger.vim
|
||||
_detact autoload/SpaceVim/api/job.vim
|
||||
_detact autoload/SpaceVim/api/system.vim
|
||||
_detact autoload/SpaceVim/api/data/string.vim
|
||||
_detact autoload/SpaceVim/api/file.vim
|
||||
_detact autoload/SpaceVim/api/vim/buffer.vim
|
||||
_detact autoload/SpaceVim/api/vim/regex.vim
|
||||
_detact autoload/SpaceVim/api/vim/compatible.vim
|
||||
_detact autoload/SpaceVim/logger.vim
|
||||
_detact autoload/SpaceVim/mapping/search.vim
|
||||
_detact autoload/SpaceVim/plugins/todo.vim
|
||||
_checkdir plugin
|
||||
cat <<EOT > plugin/todo.vim
|
||||
"=============================================================================
|
||||
" todo.vim --- todo manager for SpaceVim
|
||||
" Copyright (c) 2016-2023 Wang Shidong & Contributors
|
||||
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
command! OpenTodo call todo#open()
|
||||
EOT
|
||||
_detact LICENSE
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update"
|
||||
git remote add wsdjeg_vim_todo https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/vim-todo.git
|
||||
git push wsdjeg_vim_todo master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
vim-chat)
|
||||
git clone https://github.com/wsdjeg/vim-chat.git detach/$1
|
||||
cd detach/$1
|
||||
_detact LICENSE
|
||||
_checkdir autoload/SpaceVim/api
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/api/job.vim
|
||||
_checkdir autoload/chat/
|
||||
_detact_bundle vim-chat autoload/chat.vim
|
||||
_detact_bundle vim-chat autoload/chat/gitter.vim
|
||||
_detact_bundle vim-chat autoload/chat/logger.vim
|
||||
_detact_bundle vim-chat autoload/chat/notify.vim
|
||||
_detact_bundle vim-chat autoload/chat/qq.vim
|
||||
_detact_bundle vim-chat autoload/chat/weixin.vim
|
||||
_checkdir doc/
|
||||
_detact_bundle vim-chat doc/vim-chat.txt
|
||||
_checkdir syntax/
|
||||
_detact_bundle vim-chat syntax/vimchat.vim
|
||||
_detact_bundle vim-chat addon-info.json
|
||||
_detact_bundle vim-chat README.md
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_vim_chat https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/vim-chat.git
|
||||
git push wsdjeg_vim_chat master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
JavaUnit.vim)
|
||||
git clone https://github.com/wsdjeg/JavaUnit.vim.git detach/$1
|
||||
cd detach/$1
|
||||
# _detact LICENSE
|
||||
# _checkdir autoload/SpaceVim/api
|
||||
# _detact autoload/SpaceVim/api.vim
|
||||
# _detact autoload/SpaceVim/api/job.vim
|
||||
# _checkdir autoload/chat/
|
||||
_detact_bundle JavaUnit.vim README.md
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_javaunit_vim https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/JavaUnit.vim.git
|
||||
git push wsdjeg_javaunit_vim master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
git.vim)
|
||||
git clone https://github.com/wsdjeg/git.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir autoload/SpaceVim/api
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/api/job.vim
|
||||
_detact_bundle git.vim LICENSE
|
||||
_detact_bundle git.vim README.md
|
||||
_detact_bundle git.vim addon-info.json
|
||||
_checkdir autoload/git/branch
|
||||
_detact_bundle git.vim autoload/git.vim
|
||||
_detact_bundle git.vim autoload/git/add.vim
|
||||
_detact_bundle git.vim autoload/git/blame.vim
|
||||
_detact_bundle git.vim autoload/git/branch.vim
|
||||
_detact_bundle git.vim autoload/git/branch/manager.vim
|
||||
_detact_bundle git.vim autoload/git/checkout.vim
|
||||
_detact_bundle git.vim autoload/git/cherry_pick.vim
|
||||
_detact_bundle git.vim autoload/git/clean.vim
|
||||
_detact_bundle git.vim autoload/git/commit.vim
|
||||
_detact_bundle git.vim autoload/git/config.vim
|
||||
_detact_bundle git.vim autoload/git/diff.vim
|
||||
_detact_bundle git.vim autoload/git/fetch.vim
|
||||
_detact_bundle git.vim autoload/git/log.vim
|
||||
_detact_bundle git.vim autoload/git/logger.vim
|
||||
_detact_bundle git.vim autoload/git/merge.vim
|
||||
_detact_bundle git.vim autoload/git/mv.vim
|
||||
_detact_bundle git.vim autoload/git/pull.vim
|
||||
_detact_bundle git.vim autoload/git/push.vim
|
||||
_detact_bundle git.vim autoload/git/rebase.vim
|
||||
_detact_bundle git.vim autoload/git/reflog.vim
|
||||
_detact_bundle git.vim autoload/git/remote.vim
|
||||
_detact_bundle git.vim autoload/git/reset.vim
|
||||
_detact_bundle git.vim autoload/git/rm.vim
|
||||
_detact_bundle git.vim autoload/git/stash.vim
|
||||
_detact_bundle git.vim autoload/git/status.vim
|
||||
_checkdir doc
|
||||
_detact_bundle git.vim doc/git.txt
|
||||
_checkdir plugin
|
||||
_detact_bundle git.vim plugin/git.vim
|
||||
_checkdir syntax
|
||||
_detact_bundle git.vim syntax/git-blame.vim
|
||||
_detact_bundle git.vim syntax/git-commit.vim
|
||||
_detact_bundle git.vim syntax/git-config.vim
|
||||
_detact_bundle git.vim syntax/git-log.vim
|
||||
_detact_bundle git.vim syntax/git-rebase.vim
|
||||
_detact_bundle git.vim syntax/git-reflog.vim
|
||||
_checkdir test
|
||||
_detact_bundle git.vim test/vimrc
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_git_vim https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/git.vim.git
|
||||
git push wsdjeg_git_vim master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
vim-cheat)
|
||||
git clone https://github.com/wsdjeg/vim-cheat.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir plugin/
|
||||
_checkdir autoload/
|
||||
_detact LICENSE
|
||||
_detact_bundle vim-cheat autoload/cheat.vim
|
||||
_detact_bundle vim-cheat plugin/cheat.vim
|
||||
_detact_bundle vim-cheat README.md
|
||||
_detact_bundle vim-cheat .travis.yml
|
||||
_detact_bundle vim-cheat .vintrc.yaml
|
||||
_checkdir doc/
|
||||
_detact_bundle vim-cheat doc/vim-cheat.txt
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_vim_cheat https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/vim-cheat.git
|
||||
git push wsdjeg_vim_cheat master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
xmake.vim)
|
||||
git clone https://github.com/wsdjeg/xmake.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir plugin/
|
||||
_detact_bundle xmake.vim plugin/xmake.vim
|
||||
_detact_bundle xmake.vim plugin/xmgen.py
|
||||
_checkdir autoload/
|
||||
_detact_bundle xmake.vim autoload/xmake.vim
|
||||
_detact_bundle xmake.vim autoload/spy.lua
|
||||
_detact LICENSE
|
||||
_default_readme "xmake.vim" "xmake support for neovim/vim"
|
||||
_checkdir autoload/xmake/
|
||||
_detact_bundle xmake.vim autoload/xmake/log.vim
|
||||
_checkdir doc/
|
||||
_detact_bundle xmake.vim doc/xmake.txt
|
||||
_checkdir UltiSnips/
|
||||
_detact_bundle xmake.vim UltiSnips/lua.snippets
|
||||
_checkdir rplugin/python3/deoplete/sources/docs/
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/xmake.py
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_defines
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_defines
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_deps
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_files
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_headers
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_includedirs
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_linkdirs
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_links
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/add_subdirs
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/is_os
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/is_plat
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_basename
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_headerdir
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_kind
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_languages
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_objectdir
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_optimize
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_project
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_strip
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_symbols
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_targetdir
|
||||
_detact_bundle xmake.vim rplugin/python3/deoplete/sources/docs/set_warnings
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_xmake_vim https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/xmake.vim.git
|
||||
git push wsdjeg_xmake_vim master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
scrollbar.vim)
|
||||
git clone https://github.com/wsdjeg/scrollbar.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir autoload/SpaceVim/api/
|
||||
_checkdir autoload/SpaceVim/api/vim
|
||||
_detact autoload/SpaceVim/api.vim
|
||||
_detact autoload/SpaceVim/api/vim.vim
|
||||
_detact autoload/SpaceVim/api/vim/buffer.vim
|
||||
_detact autoload/SpaceVim/api/vim/window.vim
|
||||
_checkdir autoload/SpaceVim/plugins/
|
||||
_detact autoload/SpaceVim/plugins/scrollbar.vim
|
||||
_detact LICENSE
|
||||
_default_readme "scrollbar.vim" "floating scrollbar support for neovim/vim[wip]"
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_scrollbar https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/scrollbar.vim.git
|
||||
git push wsdjeg_scrollbar master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
github.vim)
|
||||
git clone https://github.com/wsdjeg/GitHub.vim.git detach/$1
|
||||
cd detach/$1
|
||||
_checkdir plugin/
|
||||
_checkdir autoload/
|
||||
_detact LICENSE
|
||||
_detact_bundle github.vim autoload/github.vim
|
||||
_detact_bundle github.vim plugin/github.vim
|
||||
_default_readme "GitHub.vim" "GitHub API support for neovim/vim[wip]"
|
||||
_checkdir doc/
|
||||
_detact_bundle github doc/github.txt
|
||||
git add .
|
||||
git config user.email "wsdjeg@qq.com"
|
||||
git config user.name "SpaceVimBot"
|
||||
git commit -m "Auto Update based on https://github.com/SpaceVim/SpaceVim/commit/${GITHUB_SHA}"
|
||||
git remote add wsdjeg_github_vim https://SpaceVimBot:${BOTSECRET}@github.com/wsdjeg/GitHub.vim.git
|
||||
git push wsdjeg_github_vim master
|
||||
cd -
|
||||
rm -rf detach/$1
|
||||
exit 0
|
||||
;;
|
||||
spacevim-theme)
|
||||
exit 0
|
||||
esac
|
||||
}
|
||||
|
||||
main $@
|
@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Fail on unset variables and command errors
|
||||
set -ue -o pipefail
|
||||
|
||||
# Prevent commands misbehaving due to locale differences
|
||||
export LC_ALL=C
|
||||
|
||||
install_vim() {
|
||||
local URL=https://github.com/vim/vim
|
||||
local tag=$1
|
||||
local ext=$([[ $tag == "nightly" ]] && echo "" || echo "-b $tag")
|
||||
local tmp="$(mktemp -d)"
|
||||
local out="${DEPS}/_vim/$tag"
|
||||
mkdir -p $out
|
||||
git clone --depth 1 --single-branch $ext $URL $tmp
|
||||
cd $tmp
|
||||
|
||||
# Apply Vim patch v8.0.1635 to fix build with Python.
|
||||
if grep -q _POSIX_THREADS src/if_python3.c; then
|
||||
sed -i '/#ifdef _POSIX_THREADS/,+2 d' src/if_python3.c
|
||||
fi
|
||||
|
||||
./configure \
|
||||
--with-features=huge \
|
||||
--enable-pythoninterp \
|
||||
--enable-python3interp \
|
||||
--enable-luainterp \
|
||||
--prefix=${out}
|
||||
make
|
||||
make install
|
||||
}
|
||||
|
||||
install_nvim() {
|
||||
local URL=https://github.com/neovim/neovim
|
||||
local tag=$1
|
||||
local tmp="$(mktemp -d)"
|
||||
local out="${DEPS}/_neovim/$tag"
|
||||
mkdir -p $out
|
||||
curl -o $tmp/nvim-linux64.tar.gz -L "https://github.com/neovim/neovim/releases/download/$tag/nvim-linux64.tar.gz"
|
||||
tar -xzvf $tmp/nvim-linux64.tar.gz -C $tmp
|
||||
cp -r $tmp/nvim-linux64/* $out
|
||||
chmod +x $out/bin/nvim
|
||||
# fix ModuleNotFoundError: No module named 'setuptools'
|
||||
python3 -m pip install -U setuptools
|
||||
python3 -m pip install pynvim
|
||||
}
|
||||
|
||||
install() {
|
||||
local vim=$1
|
||||
local tag=$2
|
||||
|
||||
if [[ -d "${DEPS}/_$vim/$tag/bin" ]]; then
|
||||
echo "Use a cached version '$HOME/_$vim/$tag'."
|
||||
return
|
||||
fi
|
||||
if [[ $vim == "nvim" ]]; then
|
||||
install_nvim $tag
|
||||
else
|
||||
install_vim $tag
|
||||
fi
|
||||
}
|
||||
|
||||
install $@
|
@ -1,63 +0,0 @@
|
||||
function install_vim($ver)
|
||||
{
|
||||
if ($ver -eq "nightly")
|
||||
{
|
||||
$url = 'https://github.com/vim/vim-win32-installer/releases/download/v8.2.3361/gvim_8.2.3361_x86.zip'
|
||||
}
|
||||
else
|
||||
{
|
||||
$ver = $ver -replace "^v", ""
|
||||
$url = 'https://github.com/vim/vim-win32-installer/releases/download/v' + $ver + '/gvim_' + $ver + '_x86.zip'
|
||||
}
|
||||
$Env:VIM_BIN = $Env:DEPS + '\vim\vim82\vim.exe'
|
||||
$zip = $Env:DEPS + '\vim.zip'
|
||||
echo "download: $url"
|
||||
echo "path: $zip"
|
||||
(New-Object Net.WebClient).DownloadFile($url, $zip)
|
||||
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:DEPS)
|
||||
}
|
||||
|
||||
function install_nvim($ver)
|
||||
{
|
||||
if ($ver -eq "nightly")
|
||||
{
|
||||
$url = 'https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip'
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = 'https://github.com/neovim/neovim/releases/download/' + $ver + '/nvim-win64.zip'
|
||||
}
|
||||
$zip = $Env:DEPS + '\nvim.zip'
|
||||
(New-Object Net.WebClient).DownloadFile($url, $zip)
|
||||
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:DEPS)
|
||||
if (Test-Path '$DEPS\Neovim\bin\nvim.exe') {
|
||||
$Env:VIM_BIN = $Env:DEPS + '\Neovim\bin\nvim.exe'
|
||||
}else{
|
||||
$Env:VIM_BIN = $Env:DEPS + '\nvim-win64\bin\nvim.exe'
|
||||
|
||||
}
|
||||
echo "VIM_BIN is: $Env:VIM_BIN"
|
||||
}
|
||||
|
||||
function download_lua()
|
||||
{
|
||||
$url = 'https://github.com/wsdjeg/vim-galore-zh_cn/releases/download/downdows/lua53.zip'
|
||||
$zip = $Env:DEPS + '\lua53.zip'
|
||||
(New-Object Net.WebClient).DownloadFile($url, $zip)
|
||||
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:DEPS + '\vim\vim82')
|
||||
}
|
||||
|
||||
if ($Env:VIM_BIN.StartsWith("nvim"))
|
||||
{
|
||||
mkdir $Env:DEPS
|
||||
install_nvim $Env:VIM_TAG
|
||||
}
|
||||
elseif ($Env:VIM_BIN.StartsWith("vim"))
|
||||
{
|
||||
mkdir $Env:DEPS
|
||||
install_vim $Env:VIM_TAG
|
||||
download_lua
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
date_en=`cat docs/_site/sitemap.xml`
|
||||
date_cn=`cat docs/_site/cn/sitemap.xml`
|
||||
echo $date_en | grep -oP 'https://spacevim[^\<]*' > urls_en.txt
|
||||
echo $date_cn | grep -oP 'https://spacevim[^\<]*' > urls_cn.txt
|
||||
|
||||
|
||||
curl -H 'Content-Type:text/plain' --data-binary @urls_en.txt "http://data.zz.baidu.com/urls?site=spacevim.org&token=4MYgdYW7QHIaM01P"
|
||||
curl -H 'Content-Type:text/plain' --data-binary @urls_cn.txt "http://data.zz.baidu.com/urls?site=spacevim.org&token=4MYgdYW7QHIaM01P"
|
@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
export TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}
|
||||
if [ "$LINT" = "vimlint" ]; then
|
||||
if [[ -f build_log ]]; then
|
||||
rm build_log
|
||||
fi
|
||||
for file in $(git ls-files | grep SpaceVim.*.vim);
|
||||
do
|
||||
/tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log 2>&1;
|
||||
done
|
||||
if [[ -s build_log ]]; then
|
||||
exit 2
|
||||
fi
|
||||
elif [ "$LINT" = "vimlint-errors" ]; then
|
||||
if [[ -f build_log ]]; then
|
||||
rm build_log
|
||||
fi
|
||||
for file in $(git ls-files | grep SpaceVim.*.vim);
|
||||
do
|
||||
/tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log 2>&1;
|
||||
done
|
||||
if [[ -s build_log ]]; then
|
||||
exit 2
|
||||
fi
|
||||
elif [ "$LINT" = "file-encoding" ]; then
|
||||
if [[ -f build_log ]]; then
|
||||
rm build_log
|
||||
fi
|
||||
for file in $(git diff --name-only HEAD master);
|
||||
do
|
||||
# get the encoding of a file, based on:
|
||||
# https://superuser.com/a/351658/618193
|
||||
# It should be -b instead of -bi
|
||||
encoding=`file -b --mime-encoding $file`
|
||||
if [ $encoding != "utf-8" ] && [ $encoding != "us-ascii" ];
|
||||
then
|
||||
echo $file " " $encoding >> build_log
|
||||
fi
|
||||
done
|
||||
if [[ -s build_log ]]; then
|
||||
exit 2
|
||||
fi
|
||||
elif [ "$LINT" = "vint" ]; then
|
||||
if [[ -f build_log ]]; then
|
||||
rm build_log
|
||||
fi
|
||||
for file in $(git ls-files | grep SpaceVim.*.vim);
|
||||
do
|
||||
vint --enable-neovim $file >> build_log 2>&1;
|
||||
done
|
||||
if [[ -s build_log ]]; then
|
||||
exit 2
|
||||
fi
|
||||
elif [ "$LINT" = "vint-errors" ]; then
|
||||
if [[ -f build_log ]]; then
|
||||
rm build_log
|
||||
fi
|
||||
for file in $(git ls-files | grep SpaceVim.*.vim);
|
||||
do
|
||||
vint --enable-neovim --error $file >> build_log 2>&1;
|
||||
done
|
||||
if [[ -s build_log ]]; then
|
||||
exit 2
|
||||
fi
|
||||
elif [ "$LINT" = "vader" ]; then
|
||||
if [ "$VIM_BIN" = "nvim" ]; then
|
||||
export PATH="${DEPS}/_neovim/${VIM_TAG}/bin:${PATH}"
|
||||
export VIM="${DEPS}/_neovim/${VIM_TAG}/share/nvim/runtime"
|
||||
else
|
||||
export PATH="${DEPS}/_vim/${VIM_TAG}/bin:${PATH}"
|
||||
export VIM="${DEPS}/_vim/${VIM_TAG}/share/vim"
|
||||
fi
|
||||
|
||||
echo "\$PATH: \"${PATH}\""
|
||||
echo "\$VIM: \"${VIM}\""
|
||||
echo "================= ${VIM_BIN} version ======================"
|
||||
$VIM_BIN --version
|
||||
pip install covimerage
|
||||
pip install codecov
|
||||
python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
|
||||
make test_coverage
|
||||
covimerage -vv xml --omit 'build/*'
|
||||
codecov -X search gcov pycov -f coverage.xml
|
||||
elif [ "$LINT" = "jekyll" ]; then
|
||||
.ci/build-production
|
||||
fi
|
||||
set +x
|
@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage () {
|
||||
echo ".ci/update_remote.sh [option] [target]"
|
||||
}
|
||||
|
||||
push_gitee()
|
||||
{
|
||||
git remote add gitee https://SpaceVimBot:${BOTSECRET}@gitee.com/spacevim/SpaceVim.git
|
||||
git push gitee master -f
|
||||
}
|
||||
|
||||
push_gitlab()
|
||||
{
|
||||
git remote add gitlab https://SpaceVimBot:${BOTSECRET}@gitlab.com/SpaceVim/SpaceVim.git
|
||||
git push gitlab master -f
|
||||
}
|
||||
|
||||
push_coding()
|
||||
{
|
||||
git remote add coding https://spacevim%40outlook.com:${CODINGBOTSECRET}@e.coding.net/spacevim/SpaceVim.git
|
||||
git push coding master -f
|
||||
}
|
||||
|
||||
main () {
|
||||
case $1 in
|
||||
--help|-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
gitee)
|
||||
push_gitee
|
||||
exit 0
|
||||
;;
|
||||
gitlab)
|
||||
push_gitlab
|
||||
exit 0
|
||||
;;
|
||||
coding)
|
||||
push_coding
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main $@
|
@ -7,3 +7,8 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
[*.toml]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
charset = utf-8
|
||||
|
||||
|
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -1,5 +0,0 @@
|
||||
bundle/** linguist-vendored
|
||||
autoload/SpaceVim/api/iconv/** linguist-vendored
|
||||
lua/spacevim/api/iconv/** linguist-vendored
|
||||
docs/** linguist-documentation
|
||||
bundle/git.vim/** linguist-detectable
|
22
.github/CODEOWNERS
vendored
22
.github/CODEOWNERS
vendored
@ -1,22 +0,0 @@
|
||||
# These owners will be the default owners for everything in
|
||||
# the repo. Unless a later match takes precedence,
|
||||
# @wsdjeg will be requested for review when someone opens a
|
||||
# pull request.
|
||||
# Just watching this repo, disable duplicate message
|
||||
# * @wsdjeg
|
||||
|
||||
# lang#julia layer
|
||||
autoload/SpaceVim/layers/lang/julia.vim @jingpengw
|
||||
docs/layers/lang/julia.md @jingpengw
|
||||
docs/cn/layers/lang/julia.md @jingpengw
|
||||
|
||||
# lang#javascript layer
|
||||
autoload/SpaceVim/layers/lang/javascript.vim @zhujinxuan @S1ngS1ng @chemzqm
|
||||
docs/layers/lang/javascript.md @zhujinxuan @S1ngS1ng @chemzqm
|
||||
docs/cn/layers/lang/javascript.md @zhujinxuan @S1ngS1ng @chemzqm
|
||||
|
||||
|
||||
# lang#erlang layer
|
||||
autoload/SpaceVim/layers/lang/erlang.vim @suzuiyuegjy
|
||||
docs/layers/lang/erlang.md @suzuiyuegjy
|
||||
docs/cn/layers/lang/erlang.md @suzuiyuegjy
|
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +0,0 @@
|
||||
custom: https://spacevim.org/sponsors/
|
29
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
29
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@ -1,29 +0,0 @@
|
||||
name: Bug Report
|
||||
description: File a bug report
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior.
|
||||
description: What is the expected behavior?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce-step
|
||||
attributes:
|
||||
label: The reproduce ways from Vim starting.
|
||||
description: The reproduce ways are needed to debug.
|
||||
placeholder: Tell us what you see!
|
||||
value: "A bug happened!"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: SPDebugInfo
|
||||
attributes:
|
||||
label: Output of the `:SPDebugInfo!`
|
||||
description: Please copy and paste the result of :SPDebugInfo! command.
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,5 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Community Support
|
||||
url: https://app.element.io/#/room/#spacevim:matrix.org
|
||||
about: Please ask and answer questions here.
|
28
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
28
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@ -1,28 +0,0 @@
|
||||
name: Feature Request
|
||||
description: request an new feature
|
||||
labels: ["feature request"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this feature request!
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe..
|
||||
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature-solution
|
||||
attributes:
|
||||
label: Describe the solution you'd like.
|
||||
description: A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context or screenshots about the feature request here.
|
||||
|
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,13 +0,0 @@
|
||||
### PR Prelude
|
||||
|
||||
Thank you for working on SpaceVim! :)
|
||||
|
||||
Please complete these steps and check these boxes before filing your PR:
|
||||
|
||||
- [ ] I have read and understood SpaceVim's [CONTRIBUTING](https://github.com/SpaceVim/SpaceVim/blob/master/CONTRIBUTING.md) document.
|
||||
- [ ] I have read and understood SpaceVim's [CODE_OF_CONDUCT](https://github.com/SpaceVim/SpaceVim/blob/master/CODE_OF_CONDUCT.md) document.
|
||||
- [ ] I understand my PR may be closed if it becomes obvious I didn't actually perform all of these steps.
|
||||
|
||||
### Why this change is necessary and useful?
|
||||
|
||||
[Please explain **in detail** why the changes in this PR are needed.]
|
15
.github/SUPPORT.md
vendored
15
.github/SUPPORT.md
vendored
@ -1,15 +0,0 @@
|
||||
SpaceVim is an open source project.
|
||||
Currently, this project is maintained by [@wsdjeg](https://github.com/wsdjeg),
|
||||
If you use SpaceVim in your daily work and feel that it has made your life easier,
|
||||
please consider supporting SpaceVim by:
|
||||
|
||||
- [Become a backer on opencollective](https://opencollective.com/spacevim)
|
||||
- [Become a backer on Bountysource](https://salt.bountysource.com/teams/spacevim)
|
||||
|
||||
Also, you can buy me a coffee via ko-fi.com or wechat:
|
||||
|
||||
<a href='https://ko-fi.com/SpaceVim' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||
|
||||
| wechat | alipay |
|
||||
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
|
||||
| <img src="https://spacevim.org/img/weixin.png" height="150" width="150"> | <img src="https://spacevim.org/img/zhifubao.png" height="150" width="150"> |
|
18
.github/workflows/async.yml
vendored
18
.github/workflows/async.yml
vendored
@ -1,18 +0,0 @@
|
||||
name: Detach Plugins
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
detachPlugin: ["flygrep", "dein-ui", "vim-todo", "iedit", "scrollbar.vim", "vim-chat", "vim-cheat", "xmake.vim", "github.vim", "JavaUnit.vim", "git.vim"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Detach ${{ matrix.detachPlugin }}
|
||||
env:
|
||||
BOTSECRET: ${{ secrets.BOTSECRET_GITHUB }}
|
||||
run: .ci/detach_plugin.sh ${{ matrix.detachPlugin }}
|
201
.github/workflows/check.yml
vendored
201
.github/workflows/check.yml
vendored
@ -1,201 +0,0 @@
|
||||
name: test
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- vimbin: vim
|
||||
vimtag: v7.4.052
|
||||
disable_es: true
|
||||
- vimbin: vim
|
||||
vimtag: v7.4.629
|
||||
disable_es: true
|
||||
- vimbin: vim
|
||||
vimtag: v7.4.1689
|
||||
disable_es: true
|
||||
- vimbin: vim
|
||||
vimtag: v8.0.0027
|
||||
disable_es: true
|
||||
- vimbin: vim
|
||||
vimtag: v8.0.0183
|
||||
disable_es: true
|
||||
- vimbin: vim
|
||||
vimtag: v8.0.0184
|
||||
- vimbin: vim
|
||||
vimtag: v8.0.1453
|
||||
- vimbin: vim
|
||||
vimtag: v8.1.2269
|
||||
- vimbin: vim
|
||||
vimtag: v8.2.2434
|
||||
- vimbin: vim
|
||||
vimtag: v8.2.3995
|
||||
- vimbin: vim
|
||||
vimtag: nightly
|
||||
- vimbin: nvim
|
||||
vimtag: nightly
|
||||
- vimbin: nvim
|
||||
vimtag: v0.9.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.9.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.3
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.2
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.7.2
|
||||
- vimbin: nvim
|
||||
vimtag: v0.7.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.6.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.6.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.5.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.5.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.4
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.3
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.2
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.3.8
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
VIM_BIN: ${{ matrix.vimbin }}
|
||||
VIM_TAG: ${{ matrix.vimtag }}
|
||||
DEPS: /home/runner/work/SpaceVim/deps
|
||||
DISABLE_ES: ${{ matrix.disable_es }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl lua5.2 liblua5.2-dev
|
||||
- name: Install ${{ matrix.vimbin }} ${{ matrix.vimtag }}
|
||||
run: |
|
||||
.ci/install/linux.sh $VIM_BIN $VIM_TAG
|
||||
- name: Run test
|
||||
run: |
|
||||
if [ "$VIM_BIN" = "nvim" ]; then
|
||||
export PATH="${DEPS}/_neovim/${VIM_TAG}/bin:${PATH}"
|
||||
export VIM="${DEPS}/_neovim/${VIM_TAG}/share/nvim/runtime"
|
||||
export VIM_Es="--headless"
|
||||
else
|
||||
export PATH="${DEPS}/_vim/${VIM_TAG}/bin:${PATH}"
|
||||
export VIM="${DEPS}/_vim/${VIM_TAG}/share/vim"
|
||||
if [ "$DISABLE_ES" = "true" ]; then
|
||||
export VIM_Es=""
|
||||
else
|
||||
export VIM_Es="-Es"
|
||||
fi
|
||||
fi
|
||||
export PATH="/home/runner/.local/bin:${PATH}"
|
||||
echo "\$PATH: \"${PATH}\""
|
||||
echo "\$VIM: \"${VIM}\""
|
||||
echo "================= ${VIM_BIN} version ======================"
|
||||
$VIM_BIN --version
|
||||
pip3 install --upgrade "pip < 21.0"
|
||||
pip3 install covimerage virtualenv codecov
|
||||
make test_coverage
|
||||
covimerage -vv xml --omit 'build/*' --omit 'bundle/*'
|
||||
codecov -X search gcov pycov -f coverage.xml
|
||||
Windows:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- vimbin: vim
|
||||
vimtag: nightly
|
||||
- vimbin: vim
|
||||
vimtag: v7.4.1185
|
||||
- vimbin: vim
|
||||
vimtag: v7.4.1689
|
||||
- vimbin: vim
|
||||
vimtag: v8.0.0027
|
||||
- vimbin: vim
|
||||
vimtag: v8.0.1453
|
||||
- vimbin: vim
|
||||
vimtag: v8.1.2269
|
||||
- vimbin: vim
|
||||
vimtag: v8.2.2434
|
||||
- vimbin: vim
|
||||
vimtag: v8.2.3995
|
||||
- vimbin: nvim
|
||||
vimtag: nightly
|
||||
- vimbin: nvim
|
||||
vimtag: v0.9.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.9.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.3
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.2
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.8.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.7.2
|
||||
- vimbin: nvim
|
||||
vimtag: v0.7.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.6.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.6.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.5.1
|
||||
- vimbin: nvim
|
||||
vimtag: v0.5.0
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.4
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.3
|
||||
- vimbin: nvim
|
||||
vimtag: v0.4.2
|
||||
- vimbin: nvim
|
||||
vimtag: v0.3.8
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
VIM_BIN: ${{ matrix.vimbin }}
|
||||
VIM_TAG: ${{ matrix.vimtag }}
|
||||
DEPS: C:\deps
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Install ${{ matrix.vimbin }} ${{ matrix.vimtag }}
|
||||
run: |
|
||||
.ci/install/windows.ps1 $VIM_BIN $VIM_TAG
|
||||
- name: Run test
|
||||
run: |
|
||||
if ($Env:VIM_BIN.StartsWith("nvim"))
|
||||
{
|
||||
if (Test-Path $env:DEPS\Neovim\bin ) {
|
||||
$Env:PATH = $Env:DEPS + '\Neovim\bin\;' + $Env:PATH
|
||||
$Env:VIM = $Env:DEPS + '\Neovim\share\nvim'
|
||||
}else{
|
||||
$Env:PATH = $Env:DEPS + '\nvim-win64\bin\;' + $Env:PATH
|
||||
$Env:VIM = $Env:DEPS + '\nvim-win64\share\nvim'
|
||||
}
|
||||
$Env:VIM_Es = '--headless'
|
||||
}
|
||||
elseif ($Env:VIM_BIN.StartsWith("vim"))
|
||||
{
|
||||
$Env:PATH = $Env:DEPS + '\vim\vim82\;' + $Env:PATH
|
||||
$Env:VIM = $Env:DEPS + '\vim'
|
||||
}
|
||||
echo $Env:PATH
|
||||
echo $Env:VIM
|
||||
make test
|
34
.github/workflows/docker.yml
vendored
34
.github/workflows/docker.yml
vendored
@ -1,34 +0,0 @@
|
||||
name: docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
push: true
|
||||
tags: spacevim/spacevim:latest
|
13
.github/workflows/lint.yml
vendored
13
.github/workflows/lint.yml
vendored
@ -1,13 +0,0 @@
|
||||
name: reviewdog
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
vint:
|
||||
name: runner / vint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: vint
|
||||
uses: reviewdog/action-vint@v1
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-review # Change reporter.
|
23
.github/workflows/remote.yml
vendored
23
.github/workflows/remote.yml
vendored
@ -1,23 +0,0 @@
|
||||
name: mirror
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mirror: ["gitee", "coding", "gitlab"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Push to ${{ matrix.mirror }}
|
||||
env:
|
||||
BOTSECRET: ${{ secrets.BOTSECRET }}
|
||||
BOTSECRET_GITHUB: ${{ secrets.BOTSECRET_GITHUB }}
|
||||
CODINGBOTSECRET: ${{ secrets.CODINGBOTSECRET }}
|
||||
run: .ci/update_mirror.sh ${{ matrix.mirror }}
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,6 +32,7 @@ cscope.out
|
||||
cscope.in.out
|
||||
cscope.po.out
|
||||
build/
|
||||
public/
|
||||
.coverage.covimerage
|
||||
*.swp
|
||||
.gtm/
|
||||
|
13
.vintrc.yaml
13
.vintrc.yaml
@ -1,13 +0,0 @@
|
||||
cmdargs:
|
||||
# Checking more strictly
|
||||
severity: style_problem
|
||||
|
||||
policies:
|
||||
ProhibitImplicitScopeVariable:
|
||||
enabled: false
|
||||
ProhibitAbbreviationOption:
|
||||
enabled: false
|
||||
ProhibitSetNoCompatible:
|
||||
enabled: false
|
||||
ProhibitEqualTildeOperator:
|
||||
enabled : true
|
@ -1,68 +0,0 @@
|
||||
<!-- Copyright (c) 2016-2023 Wang Shidong & Contributors -->
|
||||
<!-- Author: Wang Shidong < wsdjeg@outlook.com > -->
|
||||
<!-- URL: https://spacevim.org -->
|
||||
<!-- License: GPLv3 -->
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment,
|
||||
we as contributors and maintainers pledge to making participation
|
||||
in our project and our community a harassment-free experience for everyone,
|
||||
regardless of age, body size, disability, ethnicity, gender identity
|
||||
and expression, level of experience, nationality, personal appearance,
|
||||
race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards
|
||||
of acceptable behavior and are expected to take appropriate
|
||||
and fair corrective action in response to any instances of
|
||||
unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove,
|
||||
edit, or reject comments, commits, code, wiki edits, issues,
|
||||
and other contributions that are not aligned to this Code of Conduct,
|
||||
or to ban temporarily or permanently any contributor for other
|
||||
behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and
|
||||
in public spaces when an individual is representing the project or
|
||||
its community. Examples of representing a project or community
|
||||
include using an official project e-mail address,
|
||||
posting via an official social media account,
|
||||
or acting as an appointed representative at an online or offline event.
|
||||
Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior
|
||||
may be reported by contacting the project team at [support@spacevim.org](mailto:support@spacevim.org).
|
||||
The project team will review and investigate all complaints,
|
||||
and will respond in a way that it deems appropriate to the circumstances.
|
||||
The project team is obligated to maintain confidentiality with regard to the
|
||||
reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith
|
||||
may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
13
Makefile
13
Makefile
@ -1,19 +1,6 @@
|
||||
test: build/vader | build
|
||||
$(VIM_BIN) -Nu test/vimrc $(VIM_Es) -c 'Vader! test/**'
|
||||
|
||||
COVIMERAGE=$(shell command -v covimerage 2>/dev/null || echo build/covimerage/bin/covimerage)
|
||||
|
||||
test_coverage: $(COVIMERAGE) build/vader | build
|
||||
$(COVIMERAGE) run --source after --source syntax --source autoload --source colors --source config --source ftplugin $(VIM_BIN) -Nu test/vimrc $(VIM_Es) -c 'Vader! test/**'
|
||||
|
||||
$(COVIMERAGE):
|
||||
$(COVIMERAGE) run --source after --source syntax --source autoload --source colors --source config --source ftplugin $(VIM_BIN) -Nu test/vimrc $(VIM_Es) -c 'Vader! test/**'
|
||||
|
||||
build/covimerage:
|
||||
virtualenv $@
|
||||
build/covimerage/bin/covimerage: | build/covimerage
|
||||
build/covimerage/bin/pip install covimerage
|
||||
|
||||
build/vader:
|
||||
git clone --depth 1 https://github.com/junegunn/vader.vim.git $@
|
||||
|
||||
|
41
README.md
41
README.md
@ -1,30 +1,25 @@
|
||||
<h1 align="center">
|
||||
<a href="https://github.com/SpaceVim/SpaceVim#readme">
|
||||
<img src="https://spacevim.org/logo.png" width="440" alt="SpaceVim"/>
|
||||
</a>
|
||||
</h1>
|
||||
# SpaceVim
|
||||
|
||||
[Quick Start Guide](https://spacevim.org/quick-start-guide/) \|
|
||||
[FAQ](https://spacevim.org/faq/)
|
||||
[![twitter](https://img.spacevim.org/twitter.svg)](https://twitter.com/SpaceVim)
|
||||
|
||||
[![build](https://img.shields.io/github/actions/workflow/status/SpaceVim/SpaceVim/check.yml?branch=master)](https://github.com/SpaceVim/SpaceVim/actions/workflows/check.yml?query=branch%3Amaster)
|
||||
[![Codecov coverage](https://img.shields.io/codecov/c/github/SpaceVim/SpaceVim.svg)](https://codecov.io/gh/SpaceVim/SpaceVim)
|
||||
[![Release](https://img.shields.io/badge/Release-2.2.0-8700FF.svg)](https://spacevim.org/SpaceVim-release-v2.2.0/)
|
||||
[![GPLv3 License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://github.com/SpaceVim/SpaceVim/blob/master/LICENSE)
|
||||
[![Docker Pulls](https://img.shields.io/docker/pulls/spacevim/spacevim)](https://hub.docker.com/r/spacevim/spacevim)
|
||||
SpaceVim is a modular configuration of Vim and Neovim.
|
||||
It's inspired by spacemacs. It manages collections of plugins in layers,
|
||||
which help to collect related packages together to provide features.
|
||||
This approach helps keep the configuration organized and reduces
|
||||
overhead for the user by keeping them from having to think about
|
||||
what packages to install.
|
||||
|
||||
SpaceVim is a (neo)vim configuration inspired by spacemacs.
|
||||
- [Quick start guide](https://spacevim.org/quick-start-guide/): installation, configuration, and learning resources for SpaceVim
|
||||
- [Documentation](https://spacevim.org/documentation/): the primary official documentation of SpaceVim
|
||||
- [Available layers](https://spacevim.org/layers/): a list of available layers which can be used in SpaceVim
|
||||
|
||||
## Features
|
||||
## Community
|
||||
|
||||
- **Modularization:** plugins and functions are organized in [layers](https://spacevim.org/layers/).
|
||||
- **Compatible api:** a series of [compatible APIs](https://spacevim.org/api/) for Vim/Neovim.
|
||||
- **Great documentation:** online [documentation](https://spacevim.org/documentation/) and `:h SpaceVim`.
|
||||
- **Better experience:** [Use lua to implement core plugins](https://spacevim.org/use-lua-to-reimplement-core-plugins/)
|
||||
- **Beautiful UI:** you'll love the awesome UI and its useful features.
|
||||
- **Mnemonic key bindings:** key binding guide will be displayed automatically
|
||||
- **Fast boot time:** Lazy-load 90% of plugins with [dein.vim](https://github.com/Shougo/dein.vim)
|
||||
- **Lower the risk of RSI:** by heavily using the space bar instead of modifiers.
|
||||
- **Consistent experience:** consistent experience between terminal and gui
|
||||
- English: [https://spacevim.org/community/](https://spacevim.org/community/)
|
||||
- Chinese: [https://spacevim.org/cn/community/](https://spacevim.org/cn/community/)
|
||||
|
||||
## Development
|
||||
|
||||
- English: [https://spacevim.org/development/](https://spacevim.org/development/)
|
||||
- Chinese: [https://spacevim.org/cn/development/](https://spacevim.org/cn/development/)
|
||||
<!-- vim:set nowrap: -->
|
||||
|
@ -11,25 +11,98 @@ scriptencoding utf-8
|
||||
" @section Introduction, intro
|
||||
" @stylized spacevim
|
||||
" @library
|
||||
" @order intro options config functions layers usage plugins api dev faq changelog
|
||||
" SpaceVim is a bundle of custom settings and plugins with a modular
|
||||
" configuration for Vim. It was inspired by Spacemacs.
|
||||
"
|
||||
" @order intro options config functions layers usage plugins api dev community faq roadmap changelog
|
||||
" SpaceVim is a modular configuration of Vim and Neovim.
|
||||
" It's inspired by spacemacs. It manages collections of plugins in layers,
|
||||
" which help to collect related packages together to provide features.
|
||||
" This approach helps keep the configuration organized and reduces
|
||||
" overhead for the user by keeping them from having to think about
|
||||
" what packages to install.
|
||||
|
||||
""
|
||||
" @section Highlighted Features, features
|
||||
" @parentsection intro
|
||||
" 1. Modularization: Plugins are organized in @section(layers).
|
||||
" 2. Compatible API: A series of @section(api) for Vim/Neovim.
|
||||
" 3. Great documentation: Everything is documented in `:h SpaceVim`.
|
||||
" 4. Better experience: Most of the core plugins have been rewritten using Lua.
|
||||
" 5. Beautiful UI: The interface has been carefully designed.
|
||||
" 6. Mnemonic key bindings: Key bindings are organized using mnemonic prefixes.
|
||||
" 7. Lower the risk of RSI: Heavily using the `<Space>` key instead of modifiers.
|
||||
|
||||
""
|
||||
" @section Options, options
|
||||
" SpaceVim uses `~/.SpaceVim.d/init.toml` as its default global config file.
|
||||
" You can set all the SpaceVim options and layers in it. `~/.SpaceVim.d/` will
|
||||
" also be added to runtimepath, so you can write your own scripts in it.
|
||||
" SpaceVim also supports local config for each project. Place local config
|
||||
" settings in `.SpaceVim.d/init.toml` in the root directory of your project.
|
||||
" `.SpaceVim.d/` will also be added to runtimepath.
|
||||
" The very first time SpaceVim starts up, it will ask you to choose a mode,
|
||||
" `basic mode` or `dark powered mode`. Then it will create a
|
||||
" `.SpaceVim.d/init.toml` file in your $HOME directory.
|
||||
" All the user configuration files are stored in ~/.SpaceVim.d/ directory.
|
||||
"
|
||||
" here is an example setting SpaceVim options:
|
||||
" `~/.SpaceVim.d/` will also be added to |'runtimepath'|.
|
||||
"
|
||||
" It is also possible to override the location of `~/.SpaceVim.d/` by
|
||||
" using the environment variable `$SPACEVIMDIR`.
|
||||
" Of course, symlinks can be used to change the location of this directory.
|
||||
"
|
||||
" SpaceVim also supports project specific configuration files.
|
||||
" The project configuration file is `.SpaceVim.d/init.toml` in the root of
|
||||
" the project. The directory `{project root}/.SpaceVim.d/` will also be
|
||||
" added to the |'runtimepath'|.
|
||||
"
|
||||
" NOTE:Please be aware that if there are errors in your init.toml,
|
||||
" all the setting in this toml file will not be applied.
|
||||
"
|
||||
" All SpaceVim options can be found in @section(options), the option name is
|
||||
" same as the old vim option, but with the `g:spacevim_` prefix removed. For example:
|
||||
" >
|
||||
" g:spacevim_enable_statusline_tag -> enable_statusline_tag
|
||||
" <
|
||||
" If the fuzzy finder layer is loaded, users can use key binding `SPC h SPC`
|
||||
" to fuzzy find the documentation of SpaceVim options.
|
||||
"
|
||||
" @subsection Add custom plugins
|
||||
"
|
||||
" If you want to add plugins from GitHub, just add the repo name to the custom_plugins section:
|
||||
" >
|
||||
" [[custom_plugins]]
|
||||
" repo = 'lilydjwg/colorizer'
|
||||
" # `on_cmd` option means this plugin will be loaded
|
||||
" # only when the specific commands are called.
|
||||
" # for example, when `:ColorHighlight` or `:ColorToggle`
|
||||
" # commands are called.
|
||||
" on_cmd = ['ColorHighlight', 'ColorToggle']
|
||||
" # `on_func` option means this plugin will be loaded
|
||||
" # only when the specific functions are called.
|
||||
" # for example, when `colorizer#ColorToggle()` function is called.
|
||||
" on_func = 'colorizer#ColorToggle'
|
||||
" # `merged` option is used for merging plugins directory.
|
||||
" # When `merged` is `true`, all files in this custom plugin
|
||||
" # will be merged into `~/.cache/vimfiles/.cache/init.vim/`
|
||||
" # for neovim or `~/.cache/vimfiles/.cache/vimrc/` for vim.
|
||||
" merged = false
|
||||
" # For more options see `:h dein-options`.
|
||||
" <
|
||||
" You can also use the url of the repository, for example:
|
||||
" >
|
||||
" [[custom_plugins]]
|
||||
" repo = "https://gitlab.com/code-stats/code-stats-vim.git"
|
||||
" merged = false
|
||||
" <
|
||||
" To add multiple custom plugins:
|
||||
" >
|
||||
" [[custom_plugins]]
|
||||
" repo = 'lilydjwg/colorizer'
|
||||
" merged = false
|
||||
"
|
||||
" [[custom_plugins]]
|
||||
" repo = 'joshdick/onedark.vim'
|
||||
" merged = false
|
||||
" <
|
||||
" If you want to disable plugins which are added by SpaceVim,
|
||||
" you can use the options: @section(options-disabled_plugins).
|
||||
" >
|
||||
" [options]
|
||||
" enable-guicolors = true
|
||||
" max-column = 120
|
||||
" # NOTE: the value should be a list, and each item is the name of the plugin.
|
||||
" disabled_plugins = ["clighter", "clighter8"]
|
||||
" <
|
||||
|
||||
|
||||
@ -51,8 +124,7 @@ let s:SYSTEM = SpaceVim#api#import('system')
|
||||
|
||||
""
|
||||
" Version of SpaceVim , this value can not be changed.
|
||||
let g:spacevim_version = '2.3.0-dev'
|
||||
lockvar g:spacevim_version
|
||||
let g:spacevim_version = '2.4.0-dev'
|
||||
|
||||
""
|
||||
" @section default_indent, options-default_indent
|
||||
@ -363,7 +435,9 @@ let g:spacevim_leader_guide_theme = 'leaderguide'
|
||||
" let g:spacevim_enable_key_frequency = 1
|
||||
" <
|
||||
let g:spacevim_enable_key_frequency = 0
|
||||
if (has('python3')
|
||||
if has('nvim-0.9.0')
|
||||
let g:spacevim_autocomplete_method = 'nvim-cmp'
|
||||
elseif (has('python3')
|
||||
\ && (SpaceVim#util#haspy3lib('neovim')
|
||||
\ || SpaceVim#util#haspy3lib('pynvim'))) &&
|
||||
\ (has('nvim') || (has('patch-8.0.0027')))
|
||||
@ -373,7 +447,9 @@ if (has('python3')
|
||||
" @parentsection options
|
||||
" Set the autocomplete engine of spacevim, the default logic is:
|
||||
" >
|
||||
" if has('python3')
|
||||
" if has('nvim-0.9.0')
|
||||
" let g:spacevim_autocomplete_method = 'nvim-cmp'
|
||||
" elseif has('python3')
|
||||
" let g:spacevim_autocomplete_method = 'deoplete'
|
||||
" elseif has('lua')
|
||||
" let g:spacevim_autocomplete_method = 'neocomplete'
|
||||
@ -393,7 +469,9 @@ if (has('python3')
|
||||
""
|
||||
" Set the autocomplete engine of spacevim, the default logic is:
|
||||
" >
|
||||
" if has('python3')
|
||||
" if has('nvim-0.9.0')
|
||||
" let g:spacevim_autocomplete_method = 'nvim-cmp'
|
||||
" elseif has('python3')
|
||||
" let g:spacevim_autocomplete_method = 'deoplete'
|
||||
" elseif has('lua')
|
||||
" let g:spacevim_autocomplete_method = 'neocomplete'
|
||||
@ -1279,6 +1357,17 @@ let g:spacevim_commandline_prompt = '>'
|
||||
" Option for setting todo labels in current project.
|
||||
let g:spacevim_todo_labels = ['fixme', 'question', 'todo', 'idea']
|
||||
|
||||
""
|
||||
" @section todo_close_list, options-close_list
|
||||
" @parentsection options
|
||||
" Option for setting todo windows behavior when open item in todo list.
|
||||
" Default is `true`, set to `false` will not close todo windows.
|
||||
|
||||
""
|
||||
" Option for setting todo windows behavior when open item in todo list.
|
||||
" Default is 1, set to 0 will not close todo windows.
|
||||
let g:spacevim_todo_close_list = 0
|
||||
|
||||
""
|
||||
" @section todo_prefix, options-todo_prefix
|
||||
" @parentsection options
|
||||
@ -1363,9 +1452,13 @@ let g:spacevim_smartcloseignoreft = [
|
||||
\ 'HelpDescribe',
|
||||
\ 'VebuggerShell',
|
||||
\ 'VebuggerTerminal',
|
||||
\ 'SpaceVimTabsManager'
|
||||
\ 'SpaceVimTabsManager',
|
||||
\ 'SpaceVimGitRemoteManager'
|
||||
\ ]
|
||||
let g:_spacevim_altmoveignoreft = ['Tagbar' , 'vimfiler']
|
||||
let g:_spacevim_mappings_space = {}
|
||||
let g:_spacevim_mappings_prefixs = {}
|
||||
let g:_spacevim_mappings_windows = {}
|
||||
let g:spacevim_enable_javacomplete2_py = 0
|
||||
""
|
||||
" @section src_root, options-src_root
|
||||
@ -1647,10 +1740,11 @@ endfunction
|
||||
" argv() return a list of files/directories
|
||||
function! s:parser_argv() abort
|
||||
if exists('v:argv')
|
||||
call SpaceVim#logger#info('v:argv is:' . string(v:argv))
|
||||
" if use embed nvim
|
||||
" for exmaple: neovim-qt
|
||||
" or only run vim/neovim without argvs
|
||||
if len(v:argv) == 1
|
||||
if len(v:argv) == 1 || (len(v:argv) == 2 && index(v:argv, '--embed') == 1)
|
||||
return [0]
|
||||
elseif index(v:argv, '--embed') !=# -1
|
||||
if v:argv[-1] =~# '/$'
|
||||
@ -1666,6 +1760,8 @@ function! s:parser_argv() abort
|
||||
return [1, fnamemodify(expand(v:argv[-1]), ':p')]
|
||||
elseif filereadable(v:argv[-1])
|
||||
return [2, get(v:, 'argv', ['failed to get v:argv'])]
|
||||
elseif v:argv[-1] == '-p' && v:argv[-2] == '--embed'
|
||||
return [0]
|
||||
elseif v:argv[-1] != '--embed' && get(v:argv, -2, '') != '--cmd'
|
||||
return [2, v:argv[-1]]
|
||||
else
|
||||
@ -1685,10 +1781,13 @@ function! s:parser_argv() abort
|
||||
return [1, getcwd()]
|
||||
elseif isdirectory(expand(v:argv[-1]))
|
||||
return [1, fnamemodify(expand(v:argv[-1]), ':p')]
|
||||
elseif len(v:argv) == 3 && v:argv[-1] == 'VIM' && v:argv[-2] == '--servername'
|
||||
return [0]
|
||||
else
|
||||
return [2, get(v:, 'argv', ['failed to get v:argv'])]
|
||||
endif
|
||||
else
|
||||
call SpaceVim#logger#info(printf('argc is %s, argv is %s, line2byte is %s', string(argc()), string(argv()), string(line2byte('$'))))
|
||||
if !argc() && line2byte('$') == -1
|
||||
return [0]
|
||||
elseif argv()[0] =~# '/$'
|
||||
@ -1767,6 +1866,7 @@ function! SpaceVim#begin() abort
|
||||
|
||||
" Before loading SpaceVim, We need to parser argvs.
|
||||
let s:status = s:parser_argv()
|
||||
call SpaceVim#logger#info('startup status:' . string(s:status))
|
||||
" If do not start Vim with filename, Define autocmd for opening welcome page
|
||||
if s:status[0] == 0
|
||||
let g:_spacevim_enter_dir = fnamemodify(getcwd(), ':~')
|
||||
@ -1884,34 +1984,6 @@ endfunction
|
||||
" `?` toggle help
|
||||
" <
|
||||
|
||||
""
|
||||
" @section windows-and-tabs, usage-windows-and-tabs
|
||||
" @parentsection usage
|
||||
" @subsection Windows related key bindings
|
||||
" Window manager key bindings can only be used in normal mode.
|
||||
" The default leader `[WIN]` is `s`, you can change it via `windows_leader`
|
||||
" option:
|
||||
" >
|
||||
" [options]
|
||||
" windows_leader = "s"
|
||||
" <
|
||||
" The following key bindings can be used to manager vim windows and tabs.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | --------------------------------------------------
|
||||
" q | Smart buffer close
|
||||
" WIN v | :split
|
||||
" WIN V | Split with previous buffer
|
||||
" WIN g | :vsplit
|
||||
" WIN G | Vertically split with previous buffer
|
||||
" WIN t | Open new tab (:tabnew)
|
||||
" WIN o | Close other windows (:only)
|
||||
" WIN x | Remove buffer, leave blank window
|
||||
" WIN q | Remove current buffer
|
||||
" WIN Q | Close current buffer (:close)
|
||||
" Shift-Tab | Switch to alternate window (switch back and forth)
|
||||
" <
|
||||
|
||||
""
|
||||
" @section search-and-replace, usage-search-and-replace
|
||||
" @parentsection usage
|
||||
@ -1968,16 +2040,108 @@ endfunction
|
||||
""
|
||||
" @section buffers-and-files, usage-buffers-and-files
|
||||
" @parentsection usage
|
||||
" All buffer related key bindings are start with `SPC b`, and all files
|
||||
" related key bindings are start with `SPC f`.
|
||||
" @subsection Buffers manipulation key bindings
|
||||
" All buffers key bindings are start with `b` prefix:
|
||||
"
|
||||
" Buffer manipulation commands (start with `b`):
|
||||
" >
|
||||
" Key Bindings Descriptions
|
||||
" SPC <Tab> switch to alternate buffer in the current window (switch back and forth)
|
||||
" SPC b . buffer transient state
|
||||
" SPC b b switch to a buffer (via denite/unite)
|
||||
" SPC b d kill the current buffer (does not delete the visited file)
|
||||
" SPC u SPC b d kill the current buffer and window (does not delete the visited file) (TODO)
|
||||
" SPC b D kill a visible buffer using vim-choosewin
|
||||
" Key Bindings | Descriptions
|
||||
" -------------------| ------------------------------------------------
|
||||
" SPC <Tab> | switch to alternate buffer in the current window
|
||||
" SPC b . | buffer transient state
|
||||
" SPC b b | switch to a buffer (need fuzzy finder layer)
|
||||
" SPC b d | kill the current buffer
|
||||
" SPC b D | kill a visible buffer using vim-choosewin
|
||||
" SPC b Ctrl-d | kill other buffers
|
||||
" SPC b Ctrl-Shift-d | kill buffers using a regular expression
|
||||
" SPC b e | erase the content of the buffer (ask for confirmation)
|
||||
" SPC b n | switch to next buffer avoiding special buffers
|
||||
" SPC b m | open Messages buffer
|
||||
" SPC b o | kill all saved buffers and windows
|
||||
" SPC b p | switch to previous buffer avoiding special buffers
|
||||
" SPC b P | copy clipboard and replace buffer
|
||||
" SPC b R | revert the current buffer (reload from disk)
|
||||
" SPC b s | switch to the scratch buffer (create it if needed)
|
||||
" SPC b w | toggle read-only (writable state)
|
||||
" SPC b Y | copy whole buffer to clipboard
|
||||
" <
|
||||
"
|
||||
" @subsection Create a new empty buffer
|
||||
"
|
||||
" The following key bindings can be used to create new buffer.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | -----------------------------------------------------
|
||||
" SPC b N h | create new empty buffer in a new window on the left
|
||||
" SPC b N j | create new empty buffer in a new window at the bottom
|
||||
" SPC b N k | create new empty buffer in a new window above
|
||||
" SPC b N l | create new empty buffer in a new window below
|
||||
" SPC b N n | create new empty buffer in current window
|
||||
" <
|
||||
" @subsection Special Buffers
|
||||
"
|
||||
" Buffers created by plugins are not normal files, and they will not be listed
|
||||
" on tabline. And also will not be listed by `SPC b b` key binding in fuzzy finder
|
||||
" layer.
|
||||
"
|
||||
" @subsection File manipulation key bindings
|
||||
"
|
||||
" Files manipulation commands (start with `f`):
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | ---------------------------------------------------------
|
||||
" SPC f / | Find files with find or fd command
|
||||
" SPC f b | go to file bookmarks
|
||||
" SPC f C d | convert file from unix to dos encoding
|
||||
" SPC f C u | convert file from dos to unix encoding
|
||||
" SPC f D | delete a file and the associated buffer with confirmation
|
||||
" SPC f W | save a file with elevated privileges (sudo layer)
|
||||
" SPC f f | fuzzy find files in buffer directory
|
||||
" SPC f F | fuzzy find cursor file in buffer directory
|
||||
" SPC f o | Find current file in file tree
|
||||
" SPC f R | rename the current file
|
||||
" SPC f s | save a file
|
||||
" SPC f a | save as new file name
|
||||
" SPC f S | save all files
|
||||
" SPC f r | open a recent file
|
||||
" SPC f t | toggle file tree side bar
|
||||
" SPC f T | show file tree side bar
|
||||
" SPC f d | toggle disk manager in Windows OS
|
||||
" SPC f y | show and copy current file absolute path in the cmdline
|
||||
" SPC f Y | show and copy remote url of current file
|
||||
" <
|
||||
" NOTE: If you are using Windows, you need to install
|
||||
" findutils(https://www.gnu.org/software/findutils/) or
|
||||
" fd(https://github.com/sharkdp/fd).
|
||||
" If you are using scoop(https://github.com/lukesampson/scoop) to install
|
||||
" packages, commands in `C:\WINDOWS\system32` will override the User `PATH`,
|
||||
" so you need to put the scoop binary path before `C:\WINDOWS\system32` in `PATH`.
|
||||
"
|
||||
" After pressing `SPC f /`, the find window will be opened.
|
||||
" It is going to run `find` or `fd` command asynchronously.
|
||||
" By default, `find` is the default tool, you can use `ctrl-e` to switch tools.
|
||||
"
|
||||
" To change the default file searching tool, you can use
|
||||
" `file_searching_tools` in the `[options]` section.
|
||||
" It is `[]` by default.
|
||||
" >
|
||||
" [options]
|
||||
" file_searching_tools = ['find', 'find -not -iwholename "*.git*" ']
|
||||
" <
|
||||
"
|
||||
" The first item is the name of the tool, the second one is the default searching command.
|
||||
"
|
||||
" @subsection Vim and SpaceVim files
|
||||
"
|
||||
" Convenient key bindings are located under the prefix `SPC f v` to quickly
|
||||
" navigate between Vim and SpaceVim specific files.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | ------------------------------------------------
|
||||
" SPC f v v | display and copy SpaceVim version
|
||||
" SPC f v d | open SpaceVim custom configuration file
|
||||
" SPC f v s | list all loaded vim scripts, like :scriptnames
|
||||
" <
|
||||
|
||||
|
||||
@ -2006,6 +2170,17 @@ endfunction
|
||||
" We encourage you to participate in SpaceVim's development.
|
||||
" We have some guidelines that we need all contributors to follow.
|
||||
|
||||
""
|
||||
" @section License, dev-license
|
||||
" @parentsection dev
|
||||
" The license is GPLv3 for all the parts of SpaceVim. This includes:
|
||||
" 1. The initialization and core files.
|
||||
" 2. All the layer files.
|
||||
" 3. The documentation
|
||||
"
|
||||
" For files not belonging to SpaceVim like bundle packages,
|
||||
" refer to the header file. Those files should not have an empty header,
|
||||
" we may not accept code without a proper header file.
|
||||
|
||||
""
|
||||
" @section commit-style-guide, dev-commit-style-guide
|
||||
@ -2054,6 +2229,86 @@ endfunction
|
||||
"
|
||||
" The footer is optional and is used to reference issue tracker IDs.
|
||||
|
||||
""
|
||||
" @section merge requese, dev-merge-request
|
||||
" @parentsection dev
|
||||
"
|
||||
" @subsection Steps
|
||||
"
|
||||
" The following steps describe how to create a new merge request using mail.
|
||||
"
|
||||
" 1. create new empty repository on github,gitlab or any other platform.
|
||||
" 2. clone your repository
|
||||
" >
|
||||
" git clone ${YOUR_OWN_REPOSITORY_URL}
|
||||
" <
|
||||
" 3. add upstream remote
|
||||
" >
|
||||
" git remote add upstream https://spacevim.org/git/repos/SpaceVim/
|
||||
" <
|
||||
" 4. create new branch based on `upstream/master`
|
||||
" >
|
||||
" git fetch upstream
|
||||
" git checkout -b new_branch upstream/master
|
||||
" <
|
||||
" 5. edit, commit and push to your own repository
|
||||
" >
|
||||
" git push -u origin
|
||||
" <
|
||||
" 6. send merge request to mail list.
|
||||
"
|
||||
" email address: `spacevim@googlegroups.com`
|
||||
"
|
||||
" email title:
|
||||
"
|
||||
" The title of the email should contain one of the following prefixes::
|
||||
"
|
||||
" `Add:` Adding new features.
|
||||
"
|
||||
" `Change:` Change default behaviors or the existing features.
|
||||
"
|
||||
" `Fix:` Fix some bugs.
|
||||
"
|
||||
" `Remove:` Remove some existing features.
|
||||
"
|
||||
" `Doc:` Update the help files.
|
||||
"
|
||||
" `Website:` Update the content of website.
|
||||
"
|
||||
" Here is an example:
|
||||
"
|
||||
" `Website: Update the lang#c layer page.`
|
||||
"
|
||||
" Email context:
|
||||
"
|
||||
" The context should contain the url of repository and the branch name.
|
||||
"
|
||||
" It is better to add some description about the changes. For example:
|
||||
" >
|
||||
" repo url: https://gitlab.com/wsdjeg/hello.git
|
||||
" branch: fix_scrollbar
|
||||
"
|
||||
" when switch windows, the highlight of scrollbar is wrong.
|
||||
" here is the reproduce steps:
|
||||
"
|
||||
" 。。。。
|
||||
" <
|
||||
"
|
||||
" @subsection Simple PRs
|
||||
"
|
||||
" 1. Branch from `master`
|
||||
" 2. One topic per PR
|
||||
" 3. One commit per PR
|
||||
" 4. If you have several commits on different topics, close the PR and create one PR per topic
|
||||
" 5. If you still have several commits, squash them into only one commit
|
||||
"
|
||||
" @subsection Complex PRs
|
||||
"
|
||||
" Squash only the commits with uninteresting changes like typos, syntax fixes, etc.
|
||||
" And keep the important and isolated steps in different commits.
|
||||
"
|
||||
" Those PRs are merged and explicitly not fast-forwarded.
|
||||
|
||||
""
|
||||
" @section alternate file, usage-alternate-file
|
||||
" @parentsection usage
|
||||
@ -2073,6 +2328,79 @@ endfunction
|
||||
" `autoload/SpaceVim/layers/lang/java.vim`,
|
||||
" you can use `:A doc` switch to `docs/layers/lang/java.md`
|
||||
|
||||
""
|
||||
" @section Toggle UI, usage-toggle-ui
|
||||
" @parentsection usage
|
||||
" Some UI indicators can be toggled on and off (toggles start with t and T):
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ----------------- | -----------------------------------------
|
||||
" SPC t 8 | highlight characters past the 80th column
|
||||
" SPC t a | toggle autocomplete
|
||||
" SPC t f | display the fill column
|
||||
" SPC t h h | toggle highlight of the current line
|
||||
" SPC t h i | toggle highlight indentation levels
|
||||
" SPC t h c | toggle highlight current column
|
||||
" SPC t h s | toggle syntax highlighting
|
||||
" SPC t i | toggle indentation guide at point
|
||||
" SPC t n | toggle line numbers
|
||||
" SPC t b | toggle background
|
||||
" SPC t c | toggle conceal
|
||||
" SPC t p | toggle paste mode
|
||||
" SPC t P | toggle auto parens mode
|
||||
" SPC t t | open tabs manager
|
||||
" SPC T ~ | display ~ in the fringe on empty lines
|
||||
" SPC T F / F11 | toggle frame fullscreen
|
||||
" SPC T f | toggle display of the fringe
|
||||
" SPC T m | toggle menu bar
|
||||
" SPC T t | toggle tool bar
|
||||
" <
|
||||
|
||||
""
|
||||
" @section Error handling, usage-error-handling
|
||||
" @parentsection usage
|
||||
" The @section(layers-checkers) and @section(layers-lsp) provide error
|
||||
" handling features. The checkers layer uses
|
||||
" neomake(https://github.com/neomake/neomake) by default.
|
||||
" The syntax checking is only performed at save time by default.
|
||||
"
|
||||
" Error management mappings (start with e):
|
||||
" >
|
||||
" Mappings | Descriptions
|
||||
" --------- | --------------------------------------------------
|
||||
" SPC t s | toggle syntax checker
|
||||
" SPC e c | clear all errors
|
||||
" SPC e h | describe a syntax checker
|
||||
" SPC e l | toggle the display of the list of errors/warnings
|
||||
" SPC e n | go to the next error
|
||||
" SPC e p | go to the previous error
|
||||
" SPC e v | verify syntax checker setup
|
||||
" SPC e . | error transient state
|
||||
" <
|
||||
" The next/previous error mappings and the error transient state can be used
|
||||
" to browse errors from syntax checkers as well as errors from location list
|
||||
" buffers, and indeed anything that supports Vim's location list. This
|
||||
" includes for example search results that have been saved to a location
|
||||
" list buffer.
|
||||
"
|
||||
" Custom sign symbol:
|
||||
" >
|
||||
" Symbol | Descriptions | Custom options
|
||||
" ------ | ------------ | ----------------
|
||||
" ✖ | Error | error_symbol
|
||||
" ➤ | warning | warning_symbol
|
||||
" ⓘ | Info | info_symbol
|
||||
" <
|
||||
" @subsection quickfix list navigation
|
||||
" >
|
||||
" Mappings | Descriptions
|
||||
" -------------- | --------------------------------------
|
||||
" <Leader> q l | Open quickfix list window
|
||||
" <Leader> q c | clear quickfix list
|
||||
" <Leader> q n | jump to next item in quickfix list
|
||||
" <Leader> q p | jump to previous item in quickfix list
|
||||
" <
|
||||
|
||||
""
|
||||
" @section FAQ, faq
|
||||
" This is a list of the frequently asked questions about SpaceVim.
|
||||
@ -2141,10 +2469,77 @@ endfunction
|
||||
" <
|
||||
|
||||
""
|
||||
" @section Changelog, changelog
|
||||
" Following HEAD: changes in master branch since last release v2.0.0
|
||||
" @section Community, community
|
||||
"
|
||||
" https://github.com/SpaceVim/SpaceVim/wiki/Following-HEAD
|
||||
" @subsection News
|
||||
"
|
||||
" The news about spacevim will be post on twitter, feel free to follow them:
|
||||
"
|
||||
" https://x.com/SpaceVim
|
||||
"
|
||||
" @subsection Asking for help
|
||||
"
|
||||
" If you have any questions about using SpaceVim, check out the following context first, which may contain the answers:
|
||||
"
|
||||
" @section(faq): Some of the most frequently asked questions are answered there.
|
||||
" @section(usage): It is the general documentation of SpaceVim.
|
||||
"
|
||||
" @subsection Feedback
|
||||
"
|
||||
" If you run into a bug, or want a new feature, please use the mail list:
|
||||
"
|
||||
" send email to spacevim@googlegroups.com
|
||||
"
|
||||
" To subscribe the maillist, send anything to:spacevim+subscribe@googlegroups.com
|
||||
"
|
||||
" @subsection Chatroom
|
||||
"
|
||||
" - Matrix room: #spacevim:matrix.org
|
||||
"
|
||||
" @subsection Forum
|
||||
"
|
||||
" - Reddit: https://www.reddit.com/r/SpaceVim/
|
||||
"
|
||||
" @subsection Others
|
||||
"
|
||||
" The messages from matrix also bridged to telegram, discord and slack. Please
|
||||
" checkout the community page for more info:
|
||||
"
|
||||
" https://spacevim.org/community/
|
||||
|
||||
""
|
||||
" @section Roadmap, roadmap
|
||||
" The roadmap defines the project direction and priorities. If you have any
|
||||
" suggestions , please checkout @section(community).
|
||||
"
|
||||
" @subsection To-Do List
|
||||
"
|
||||
" - [x] rewrite statusline plugin with lua
|
||||
" - [x] rewrite tabline plugin with lua
|
||||
" - [ ] merge website context into :h SpaceVim
|
||||
"
|
||||
" @subsection Completed
|
||||
"
|
||||
" All completed functions can be found in @section(changelog)
|
||||
|
||||
|
||||
""
|
||||
" @section Changelog, changelog
|
||||
" Following HEAD: changes in master branch since last release v2.2.0
|
||||
"
|
||||
" https://spacevim.org/following-head/
|
||||
"
|
||||
" 2024-03-24: v2.3.0
|
||||
"
|
||||
" https://spacevim.org/SpaceVim-release-v2.3.0/
|
||||
"
|
||||
" 2023-07-05: v2.2.0
|
||||
"
|
||||
" https://spacevim.org/SpaceVim-release-v2.2.0/
|
||||
"
|
||||
" 2023-03-30: v2.1.0
|
||||
"
|
||||
" https://spacevim.org/SpaceVim-release-v2.1.0/
|
||||
"
|
||||
" 2022-07-02: v2.0.0
|
||||
"
|
||||
@ -2229,6 +2624,5 @@ endfunction
|
||||
" 2017-01-26: v0.1.0
|
||||
"
|
||||
" https://spacevim.org/SpaceVim-release-v0.1.0/
|
||||
"
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -120,7 +120,10 @@ endfunction
|
||||
|
||||
|
||||
" note: this function only works when encoding is utf-8
|
||||
" ref: https://github.com/SpaceVim/SpaceVim/pull/2515
|
||||
" old vim always add ^@ after chinese char.
|
||||
" and it is fixed in 8.1.2269 ~ 8.2.3395
|
||||
" and I do not know which patch fix it.
|
||||
" @bug find the patch for split-\zs
|
||||
function! s:self.string2chars(str) abort
|
||||
let save_enc = &encoding
|
||||
let &encoding = 'utf-8'
|
||||
|
@ -45,6 +45,117 @@ else
|
||||
let s:self.pathSeparator = ':'
|
||||
endif
|
||||
|
||||
let s:gui_colors = {
|
||||
\ 'brown' : '#905532',
|
||||
\ 'aqua' : '#3AFFDB',
|
||||
\ 'blue' : '#689FB6',
|
||||
\ 'darkBlue' : '#44788E',
|
||||
\ 'purple' : '#834F79',
|
||||
\ 'lightPurple' : '#834F79',
|
||||
\ 'red' : '#AE403F',
|
||||
\ 'beige' : '#F5C06F',
|
||||
\ 'yellow' : '#F09F17',
|
||||
\ 'orange' : '#D4843E',
|
||||
\ 'darkOrange' : '#F16529',
|
||||
\ 'pink' : '#CB6F6F',
|
||||
\ 'salmon' : '#EE6E73',
|
||||
\ 'green' : '#8FAA54',
|
||||
\ 'lightGreen' : '#31B53E',
|
||||
\ 'default': '#abb2bf',
|
||||
\ }
|
||||
|
||||
let s:term_colors = {
|
||||
\ 'brown' : 130,
|
||||
\ 'aqua' : 66,
|
||||
\ 'blue' : 67,
|
||||
\ 'darkBlue' : 57,
|
||||
\ 'purple' : 60,
|
||||
\ 'lightPurple' : 103,
|
||||
\ 'red' : 131,
|
||||
\ 'beige' : 137,
|
||||
\ 'yellow' : 229,
|
||||
\ 'orange' : 208,
|
||||
\ 'darkOrange' : 166,
|
||||
\ 'pink' : 205,
|
||||
\ 'salmon' : 209,
|
||||
\ 'green' : 65,
|
||||
\ 'lightGreen' : 108,
|
||||
\ 'default' : 231,
|
||||
\ }
|
||||
let s:icons_color = {
|
||||
\ 'jpg' : {'icon': '', 'color': s:gui_colors.aqua, 'term_color': s:term_colors.aqua},
|
||||
\ 'json' : {'icon': '', 'color': s:gui_colors.beige, 'term_color': s:term_colors.beige},
|
||||
\ 'mjs' : {'icon': '', 'color': s:gui_colors.beige, 'term_color': s:term_colors.beige},
|
||||
\ 'hs' : {'icon': '', 'color': s:gui_colors.beige, 'term_color': s:term_colors.beige},
|
||||
\ 'go' : {'icon': '', 'color': s:gui_colors.beige, 'term_color': s:term_colors.beige},
|
||||
\ 'css' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'jsx' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'c' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'db' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'pl' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'fsscript' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'ts' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'tsx' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'cs' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'hh' : {'icon': '', 'color': s:gui_colors.blue, 'term_color': s:term_colors.blue},
|
||||
\ 'coffee' : {'icon': '', 'color': s:gui_colors.brown, 'term_color': s:term_colors.brown},
|
||||
\ 'less' : {'icon': '', 'color': s:gui_colors.darkBlue, 'term_color': s:term_colors.darkBlue},
|
||||
\ 'sql' : {'icon': '', 'color': s:gui_colors.darkBlue, 'term_color': s:term_colors.darkBlue},
|
||||
\ 'psd' : {'icon': '', 'color': s:gui_colors.darkBlue, 'term_color': s:term_colors.darkBlue},
|
||||
\ 'fsharp' : {'icon': '', 'color': s:gui_colors.darkBlue, 'term_color': s:term_colors.darkBlue},
|
||||
\ 'html' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'xul' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'rss' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'rs' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'rlib' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'ai' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'svelte' : {'icon': '', 'color': s:gui_colors.darkOrange, 'term_color': s:term_colors.darkOrange},
|
||||
\ 'sass' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'rmd' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'conf' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'h' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'bash' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'diff' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'dart' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'pp' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'key' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'elm' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'gemspec' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'haml' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'leex' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'rake' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'tex' : {'icon': 'ﭨ', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'webmanifest' : {'icon': '', 'color': s:gui_colors.default, 'term_color': s:term_colors.default},
|
||||
\ 'styl' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'twig' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'fish' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'clj' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'cljc' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'cljs' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'edn' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'vim' : {'icon': '', 'color': s:gui_colors.green, 'term_color': s:term_colors.green},
|
||||
\ 'sh' : {'icon': '', 'color': s:gui_colors.lightPurple, 'term_color': s:term_colors.lightPurple},
|
||||
\ 'erl' : {'icon': '', 'color': s:gui_colors.lightPurple, 'term_color': s:term_colors.lightPurple},
|
||||
\ 'ex' : {'icon': '', 'color': s:gui_colors.lightPurple, 'term_color': s:term_colors.lightPurple},
|
||||
\ 'slim' : {'icon': '', 'color': s:gui_colors.orange, 'term_color': s:term_colors.orange},
|
||||
\ 'mustache' : {'icon': '', 'color': s:gui_colors.orange, 'term_color': s:term_colors.orange},
|
||||
\ 'swift' : {'icon': '', 'color': s:gui_colors.orange, 'term_color': s:term_colors.orange},
|
||||
\ 'scss' : {'icon': '', 'color': s:gui_colors.pink, 'term_color': s:term_colors.pink},
|
||||
\ 'hrl' : {'icon': '', 'color': s:gui_colors.pink, 'term_color': s:term_colors.pink},
|
||||
\ 'php' : {'icon': '', 'color': s:gui_colors.purple, 'term_color': s:term_colors.purple},
|
||||
\ 'lua' : {'icon': '', 'color': s:gui_colors.purple, 'term_color': s:term_colors.purple},
|
||||
\ 'java' : {'icon': '', 'color': s:gui_colors.purple, 'term_color': s:term_colors.purple},
|
||||
\ 'sln' : {'icon': '', 'color': s:gui_colors.purple, 'term_color': s:term_colors.purple},
|
||||
\ 'jl' : {'icon': '', 'color': s:gui_colors.purple, 'term_color': s:term_colors.purple},
|
||||
\ 'rb' : {'icon': '', 'color': s:gui_colors.red, 'term_color': s:term_colors.red},
|
||||
\ 'scala' : {'icon': '', 'color': s:gui_colors.red, 'term_color': s:term_colors.red},
|
||||
\ 'd' : {'icon': '', 'color': s:gui_colors.red, 'term_color': s:term_colors.red},
|
||||
\ 'ejs' : {'icon': '', 'color': s:gui_colors.yellow, 'term_color': s:term_colors.yellow},
|
||||
\ 'md' : {'icon': '', 'color': s:gui_colors.yellow, 'term_color': s:term_colors.yellow},
|
||||
\ 'py' : {'icon': '', 'color': s:gui_colors.yellow, 'term_color': s:term_colors.yellow},
|
||||
\ 'ml' : {'icon': 'λ', 'color': s:gui_colors.yellow, 'term_color': s:term_colors.yellow},
|
||||
\}
|
||||
|
||||
let s:file_node_extensions = {
|
||||
\ 'styl' : '',
|
||||
\ 'scss' : '',
|
||||
@ -57,12 +168,12 @@ let s:file_node_extensions = {
|
||||
\ 'css' : '',
|
||||
\ 'less' : '',
|
||||
\ 'wxss' : '',
|
||||
\ 'md' : '',
|
||||
\ 'md' : '',
|
||||
\ 'doc' : '',
|
||||
\ 'help' : '',
|
||||
\ 'txt' : '',
|
||||
\ 'toml' : '',
|
||||
\ 'markdown' : '',
|
||||
\ 'markdown' : '',
|
||||
\ 'json' : '',
|
||||
\ 'js' : '',
|
||||
\ 'jsx' : '',
|
||||
@ -128,7 +239,7 @@ let s:file_node_extensions = {
|
||||
\ 'd' : '',
|
||||
\ 'erl' : '',
|
||||
\ 'hrl' : '',
|
||||
\ 'vim' : '',
|
||||
\ 'vim' : '',
|
||||
\ 'ai' : '',
|
||||
\ 'psd' : '',
|
||||
\ 'psb' : '',
|
||||
@ -154,6 +265,9 @@ let s:file_node_exact_matches = {
|
||||
\ '.ds_store' : '',
|
||||
\ '.gitconfig' : '',
|
||||
\ '.gitignore' : '',
|
||||
\ 'config' : '',
|
||||
\ 'muttrc' : '',
|
||||
\ 'Makefile' : '',
|
||||
\ '.bashrc' : '',
|
||||
\ '.bashprofile' : '',
|
||||
\ 'favicon.ico' : '',
|
||||
@ -161,7 +275,8 @@ let s:file_node_exact_matches = {
|
||||
\ 'node_modules' : '',
|
||||
\ 'react.jsx' : '',
|
||||
\ 'Procfile' : '',
|
||||
\ '.vimrc' : '',
|
||||
\ '.vimrc' : '',
|
||||
\ 'vimrc' : '',
|
||||
\ 'mix.lock' : '',
|
||||
\}
|
||||
|
||||
@ -187,12 +302,24 @@ function! s:self.fticon(path) abort
|
||||
endif
|
||||
endfor
|
||||
let ext = fnamemodify(file, ':e')
|
||||
if has_key(g:spacevim_filetype_icons, ext)
|
||||
if has_key(get(g:, 'spacevim_filetype_icons', {}), ext)
|
||||
return g:spacevim_filetype_icons[ext]
|
||||
elseif has_key(s:file_node_extensions, ext)
|
||||
return s:file_node_extensions[ext]
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:self.hi_icons() abort
|
||||
for [name, icon] in items(s:icons_color)
|
||||
call execute(printf('hi! SpaceVim_API_FILE_%s guifg=%s ctermfg=%s', name, icon.color, icon.term_color))
|
||||
call execute(printf('call matchadd("SpaceVim_API_FILE_%s", "%s", 2)', name, icon.icon))
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:self.clear_icons() abort
|
||||
|
||||
call clearmatches()
|
||||
|
||||
endfunction
|
||||
|
||||
|
@ -29,6 +29,12 @@ scriptencoding utf-8
|
||||
|
||||
let s:notifications = {}
|
||||
|
||||
function! SpaceVim#api#notify#shared_notifys() abort
|
||||
|
||||
return s:notifications
|
||||
|
||||
endfunction
|
||||
|
||||
" dictionary values and functions
|
||||
|
||||
let s:self = {}
|
||||
@ -294,6 +300,10 @@ function! s:self.redraw_windows() abort
|
||||
call self.__buffer.buf_set_lines(self.border.bufnr, 0 , -1, 0,
|
||||
\ self.draw_border(self.title, self.notification_width, s:msg_real_len(self.message)))
|
||||
call self.__buffer.buf_set_lines(self.bufnr, 0 , -1, 0, s:message_body(self.message))
|
||||
if exists('*nvim_win_set_option')
|
||||
call nvim_win_set_cursor(self.winid, [1, 0])
|
||||
call nvim_win_set_cursor(self.border.winid, [1, 0])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -32,6 +32,14 @@
|
||||
" initfunc: the function which will be call after creating buffer
|
||||
"
|
||||
" cmd: the ex command which will be run after the new buffer is created
|
||||
"
|
||||
" get_option(bufnr, name)
|
||||
"
|
||||
" Gets a buffer option value.
|
||||
"
|
||||
" set_option(buf, opt, value)
|
||||
"
|
||||
" Set a buffer option value.
|
||||
|
||||
|
||||
let s:self = {}
|
||||
@ -67,6 +75,19 @@ function! s:self.bufnr(...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" bufname needs atleast one argv before patch-8.1.1924 has('patch-8.1.1924')
|
||||
function! s:self.bufname(...) abort
|
||||
if has('patch-8.1.1924')
|
||||
return call('bufname', a:000)
|
||||
else
|
||||
if a:0 ==# 0
|
||||
return bufname('%')
|
||||
else
|
||||
return call('bufname', a:000)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:self.bufadd(name) abort
|
||||
if exists('*bufadd')
|
||||
|
@ -200,7 +200,7 @@ endif
|
||||
if has('nvim')
|
||||
function! s:self.version() abort
|
||||
let v = api_info().version
|
||||
return v.major . '.' . v.minor . '.' . v.patch
|
||||
return v.major . '.' . v.minor . '.' . v.patch . (v.prerelease ? '(Prerelease)' : '(Release)')
|
||||
endfunction
|
||||
else
|
||||
function! s:self.version() abort
|
||||
|
@ -6,70 +6,190 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
|
||||
let s:VIM = SpaceVim#api#import('vim')
|
||||
|
||||
if has('nvim-0.10.0')
|
||||
"autocmds
|
||||
function! SpaceVim#autocmds#VimEnter() abort
|
||||
call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
|
||||
call s:apply_custom_space_keybindings()
|
||||
call s:apply_custom_leader_keybindings()
|
||||
if SpaceVim#layers#isLoaded('core#statusline')
|
||||
set laststatus=2
|
||||
call SpaceVim#layers#core#statusline#def_colors()
|
||||
setlocal statusline=%!SpaceVim#layers#core#statusline#get(1)
|
||||
endif
|
||||
if SpaceVim#layers#isLoaded('core#tabline')
|
||||
call SpaceVim#layers#core#tabline#def_colors()
|
||||
set showtabline=2
|
||||
endif
|
||||
call SpaceVim#logger#info('run root changed callback on VimEnter!')
|
||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
if !empty(get(g:, '_spacevim_bootstrap_after', ''))
|
||||
try
|
||||
call call(g:_spacevim_bootstrap_after, [])
|
||||
let g:_spacevim_bootstrap_after_success = 1
|
||||
catch
|
||||
call SpaceVim#logger#error('failed to call bootstrap_after function: ' . g:_spacevim_bootstrap_after)
|
||||
call SpaceVim#logger#error(' exception: ' . v:exception)
|
||||
call SpaceVim#logger#error(' throwpoint: ' . v:throwpoint)
|
||||
let g:_spacevim_bootstrap_after_success = 0
|
||||
endtry
|
||||
endif
|
||||
|
||||
"autocmds
|
||||
function! SpaceVim#autocmds#init() abort
|
||||
call SpaceVim#logger#debug('init SpaceVim_core autocmd group')
|
||||
augroup SpaceVim_core
|
||||
au!
|
||||
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
|
||||
\ q :call <SID>close_quickfix()<cr>
|
||||
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
|
||||
\ bd|
|
||||
\ q | endif
|
||||
autocmd QuitPre * call SpaceVim#plugins#windowsmanager#UpdateRestoreWinInfo()
|
||||
autocmd WinEnter * call SpaceVim#plugins#windowsmanager#MarkBaseWin()
|
||||
if g:spacevim_relativenumber
|
||||
autocmd BufEnter,WinEnter * if &nu | set rnu | endif
|
||||
autocmd BufLeave,WinLeave * if &nu | set nornu | endif
|
||||
if !get(g:, '_spacevim_bootstrap_before_success', 1)
|
||||
echohl Error
|
||||
echom 'bootstrap_before function failed to execute. Check `SPC h L` for errors.'
|
||||
echohl None
|
||||
endif
|
||||
if g:spacevim_enable_cursorline == 1
|
||||
autocmd BufEnter,WinEnter,InsertLeave * call s:enable_cursorline()
|
||||
autocmd BufLeave,WinLeave,InsertEnter * call s:disable_cursorline()
|
||||
if !get(g:, '_spacevim_bootstrap_after_success', 1)
|
||||
echohl Error
|
||||
echom 'bootstrap_after function failed to execute. Check `SPC h L` for errors.'
|
||||
echohl None
|
||||
endif
|
||||
if g:spacevim_enable_cursorcolumn == 1
|
||||
autocmd BufEnter,WinEnter,InsertLeave * setl cursorcolumn
|
||||
autocmd BufLeave,WinLeave,InsertEnter * setl nocursorcolumn
|
||||
|
||||
if !filereadable('.SpaceVim.d/init.toml') && filereadable('.SpaceVim.d/init.vim')
|
||||
call SpaceVim#logger#info('loading local conf: .SpaceVim.d/init.vim')
|
||||
try
|
||||
exe 'source .SpaceVim.d/init.vim'
|
||||
catch
|
||||
call SpaceVim#logger#error('Error occurred while loading the local configuration')
|
||||
call SpaceVim#logger#error(' exception: ' . v:exception)
|
||||
call SpaceVim#logger#error(' throwpoint: ' . v:throwpoint)
|
||||
endtry
|
||||
call SpaceVim#logger#info('finished loading local conf')
|
||||
endif
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file
|
||||
autocmd BufWinLeave * let b:_winview = winsaveview()
|
||||
autocmd BufWinEnter * if(exists('b:_winview')) | call winrestview(b:_winview) | endif
|
||||
autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
|
||||
autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file.
|
||||
autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
|
||||
autocmd Filetype qf setlocal nobuflisted
|
||||
au StdinReadPost * call s:disable_welcome()
|
||||
if !has('nvim-0.5.0')
|
||||
autocmd InsertEnter * call s:fixindentline()
|
||||
let g:_spacevim_after_vimenter = 1
|
||||
endfunction
|
||||
function! SpaceVim#autocmds#init() abort
|
||||
lua require('spacevim.autocmds').init()
|
||||
augroup SpaceVim_core
|
||||
au!
|
||||
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
|
||||
\ q :call <SID>close_quickfix()<cr>
|
||||
if !has('nvim-0.5.0')
|
||||
autocmd InsertEnter * call s:fixindentline()
|
||||
endif
|
||||
autocmd ColorScheme gruvbox,jellybeans,nord,srcery,NeoSolarized,one,SpaceVim call s:fix_colorschem_in_SpaceVim()
|
||||
augroup END
|
||||
endfunction
|
||||
else
|
||||
"autocmds
|
||||
function! SpaceVim#autocmds#VimEnter() abort
|
||||
call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
|
||||
call s:apply_custom_space_keybindings()
|
||||
call s:apply_custom_leader_keybindings()
|
||||
if SpaceVim#layers#isLoaded('core#statusline')
|
||||
set laststatus=2
|
||||
call SpaceVim#layers#core#statusline#def_colors()
|
||||
setlocal statusline=%!SpaceVim#layers#core#statusline#get(1)
|
||||
endif
|
||||
autocmd BufEnter,FileType * call SpaceVim#mapping#space#refrashLSPC()
|
||||
if executable('synclient') && g:spacevim_auto_disable_touchpad
|
||||
let s:touchpadoff = 0
|
||||
autocmd InsertEnter * call s:disable_touchpad()
|
||||
autocmd InsertLeave * call s:enable_touchpad()
|
||||
autocmd FocusLost * call system('synclient touchpadoff=0')
|
||||
autocmd FocusGained * call s:reload_touchpad_status()
|
||||
if SpaceVim#layers#isLoaded('core#tabline')
|
||||
call SpaceVim#layers#core#tabline#def_colors()
|
||||
set showtabline=2
|
||||
endif
|
||||
autocmd BufWritePre * call SpaceVim#plugins#mkdir#CreateCurrent()
|
||||
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
|
||||
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('StartifyEndOfBuffer')
|
||||
autocmd ColorScheme gruvbox,jellybeans,nord,srcery,NeoSolarized,one,SpaceVim call s:fix_colorschem_in_SpaceVim()
|
||||
autocmd VimEnter * call SpaceVim#autocmds#VimEnter()
|
||||
autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '')
|
||||
autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1
|
||||
autocmd VimLeavePre * call SpaceVim#plugins#manager#terminal()
|
||||
if has('nvim')
|
||||
autocmd CursorHold,FocusGained,FocusLost * rshada|wshada
|
||||
call SpaceVim#logger#info('run root changed callback on VimEnter!')
|
||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
if !empty(get(g:, '_spacevim_bootstrap_after', ''))
|
||||
try
|
||||
call call(g:_spacevim_bootstrap_after, [])
|
||||
let g:_spacevim_bootstrap_after_success = 1
|
||||
catch
|
||||
call SpaceVim#logger#error('failed to call bootstrap_after function: ' . g:_spacevim_bootstrap_after)
|
||||
call SpaceVim#logger#error(' exception: ' . v:exception)
|
||||
call SpaceVim#logger#error(' throwpoint: ' . v:throwpoint)
|
||||
let g:_spacevim_bootstrap_after_success = 0
|
||||
endtry
|
||||
endif
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
if !get(g:, '_spacevim_bootstrap_before_success', 1)
|
||||
echohl Error
|
||||
echom 'bootstrap_before function failed to execute. Check `SPC h L` for errors.'
|
||||
echohl None
|
||||
endif
|
||||
if !get(g:, '_spacevim_bootstrap_after_success', 1)
|
||||
echohl Error
|
||||
echom 'bootstrap_after function failed to execute. Check `SPC h L` for errors.'
|
||||
echohl None
|
||||
endif
|
||||
|
||||
if !filereadable('.SpaceVim.d/init.toml') && filereadable('.SpaceVim.d/init.vim')
|
||||
call SpaceVim#logger#info('loading local conf: .SpaceVim.d/init.vim')
|
||||
try
|
||||
exe 'source .SpaceVim.d/init.vim'
|
||||
catch
|
||||
call SpaceVim#logger#error('Error occurred while loading the local configuration')
|
||||
call SpaceVim#logger#error(' exception: ' . v:exception)
|
||||
call SpaceVim#logger#error(' throwpoint: ' . v:throwpoint)
|
||||
endtry
|
||||
call SpaceVim#logger#info('finished loading local conf')
|
||||
endif
|
||||
endfunction
|
||||
function! SpaceVim#autocmds#init() abort
|
||||
call SpaceVim#logger#debug('init SpaceVim_core autocmd group')
|
||||
augroup SpaceVim_core
|
||||
au!
|
||||
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
|
||||
\ q :call <SID>close_quickfix()<cr>
|
||||
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
|
||||
\ bd|
|
||||
\ q | endif
|
||||
autocmd QuitPre * call SpaceVim#plugins#windowsmanager#UpdateRestoreWinInfo()
|
||||
autocmd WinEnter * call SpaceVim#plugins#windowsmanager#MarkBaseWin()
|
||||
if g:spacevim_relativenumber
|
||||
autocmd BufEnter,WinEnter * if &nu | set rnu | endif
|
||||
autocmd BufLeave,WinLeave * if &nu | set nornu | endif
|
||||
endif
|
||||
if g:spacevim_enable_cursorline == 1
|
||||
autocmd BufEnter,WinEnter,InsertLeave * call s:enable_cursorline()
|
||||
autocmd BufLeave,WinLeave,InsertEnter * call s:disable_cursorline()
|
||||
endif
|
||||
if g:spacevim_enable_cursorcolumn == 1
|
||||
autocmd BufEnter,WinEnter,InsertLeave * setl cursorcolumn
|
||||
autocmd BufLeave,WinLeave,InsertEnter * setl nocursorcolumn
|
||||
endif
|
||||
autocmd BufLeave * call SpaceVim#plugins#history#savepos()
|
||||
autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file
|
||||
autocmd BufWinLeave * let b:_winview = winsaveview()
|
||||
autocmd BufWinEnter * if(exists('b:_winview')) | call winrestview(b:_winview) | endif
|
||||
autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
|
||||
autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file.
|
||||
autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
|
||||
autocmd Filetype qf setlocal nobuflisted
|
||||
au StdinReadPost * call s:disable_welcome()
|
||||
if !has('nvim-0.5.0')
|
||||
autocmd InsertEnter * call s:fixindentline()
|
||||
endif
|
||||
autocmd BufEnter,FileType * call SpaceVim#mapping#space#refrashLSPC()
|
||||
if executable('synclient') && g:spacevim_auto_disable_touchpad
|
||||
let s:touchpadoff = 0
|
||||
autocmd InsertEnter * call s:disable_touchpad()
|
||||
autocmd InsertLeave * call s:enable_touchpad()
|
||||
autocmd FocusLost * call system('synclient touchpadoff=0')
|
||||
autocmd FocusGained * call s:reload_touchpad_status()
|
||||
endif
|
||||
autocmd BufWritePre * call SpaceVim#plugins#mkdir#CreateCurrent()
|
||||
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
|
||||
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('StartifyEndOfBuffer')
|
||||
autocmd ColorScheme gruvbox,jellybeans,nord,srcery,NeoSolarized,one,SpaceVim call s:fix_colorschem_in_SpaceVim()
|
||||
autocmd VimEnter * call SpaceVim#autocmds#VimEnter()
|
||||
autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '')
|
||||
autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1
|
||||
autocmd VimLeavePre * call SpaceVim#plugins#manager#terminal()
|
||||
if has('nvim')
|
||||
autocmd VimEnter,FocusGained * call SpaceVim#plugins#history#readcache()
|
||||
autocmd FocusLost,VimLeave * call SpaceVim#plugins#history#writecache()
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ call SpaceVim#plugins#history#jumppos() |
|
||||
\ endif
|
||||
endif
|
||||
augroup END
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
let g:_spacevim_cursorline_flag = -1
|
||||
function! s:enable_cursorline() abort
|
||||
@ -89,7 +209,7 @@ function! s:reload_touchpad_status() abort
|
||||
if s:touchpadoff
|
||||
call s:disable_touchpad()
|
||||
endif
|
||||
endf
|
||||
endfunction
|
||||
function! s:disable_touchpad() abort
|
||||
let s:touchpadoff = 1
|
||||
call system('synclient touchpadoff=1')
|
||||
@ -118,8 +238,14 @@ function! s:fix_colorschem_in_SpaceVim() abort
|
||||
if &background ==# 'dark'
|
||||
if g:colors_name ==# 'gruvbox'
|
||||
hi VertSplit guibg=#282828 guifg=#181A1F
|
||||
hi clear NormalFloat
|
||||
hi link NormalFloat PMenu
|
||||
elseif g:colors_name ==# 'one'
|
||||
hi VertSplit guibg=#282c34 guifg=#181A1F
|
||||
hi SPCFloatBorder guibg=#282c34 guifg=#181A1F
|
||||
hi SPCNormalFloat guifg=#abb2bf guibg=#282c34
|
||||
hi clear StatusLineNC
|
||||
hi link StatusLineNC Normal
|
||||
elseif g:colors_name ==# 'jellybeans'
|
||||
hi VertSplit guibg=#151515 guifg=#080808
|
||||
elseif g:colors_name ==# 'nord'
|
||||
@ -141,6 +267,7 @@ function! s:fix_colorschem_in_SpaceVim() abort
|
||||
endif
|
||||
endif
|
||||
hi SpaceVimLeaderGuiderGroupName cterm=bold ctermfg=175 gui=bold guifg=#d3869b
|
||||
hi link WinSeparator VertSplit
|
||||
endfunction
|
||||
|
||||
function! s:apply_custom_space_keybindings() abort
|
||||
@ -190,57 +317,6 @@ function! s:apply_custom_leader_keybindings() abort
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#autocmds#VimEnter() abort
|
||||
call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
|
||||
call s:apply_custom_space_keybindings()
|
||||
call s:apply_custom_leader_keybindings()
|
||||
if SpaceVim#layers#isLoaded('core#statusline')
|
||||
set laststatus=2
|
||||
call SpaceVim#layers#core#statusline#def_colors()
|
||||
setlocal statusline=%!SpaceVim#layers#core#statusline#get(1)
|
||||
endif
|
||||
if SpaceVim#layers#isLoaded('core#tabline')
|
||||
call SpaceVim#layers#core#tabline#def_colors()
|
||||
set showtabline=2
|
||||
endif
|
||||
call SpaceVim#logger#info('run root changed callback on VimEnter!')
|
||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
if !empty(get(g:, '_spacevim_bootstrap_after', ''))
|
||||
try
|
||||
call call(g:_spacevim_bootstrap_after, [])
|
||||
let g:_spacevim_bootstrap_after_success = 1
|
||||
catch
|
||||
call SpaceVim#logger#error('failed to call bootstrap_after function: ' . g:_spacevim_bootstrap_after)
|
||||
call SpaceVim#logger#error(' exception: ' . v:exception)
|
||||
call SpaceVim#logger#error(' throwpoint: ' . v:throwpoint)
|
||||
let g:_spacevim_bootstrap_after_success = 0
|
||||
endtry
|
||||
endif
|
||||
|
||||
if !get(g:, '_spacevim_bootstrap_before_success', 1)
|
||||
echohl Error
|
||||
echom 'bootstrap_before function failed to execute. Check `SPC h L` for errors.'
|
||||
echohl None
|
||||
endif
|
||||
if !get(g:, '_spacevim_bootstrap_after_success', 1)
|
||||
echohl Error
|
||||
echom 'bootstrap_after function failed to execute. Check `SPC h L` for errors.'
|
||||
echohl None
|
||||
endif
|
||||
|
||||
if !filereadable('.SpaceVim.d/init.toml') && filereadable('.SpaceVim.d/init.vim')
|
||||
call SpaceVim#logger#info('loading local conf: .SpaceVim.d/init.vim')
|
||||
try
|
||||
exe 'source .SpaceVim.d/init.vim'
|
||||
catch
|
||||
call SpaceVim#logger#error('Error occurred while loading the local configuration')
|
||||
call SpaceVim#logger#error(' exception: ' . v:exception)
|
||||
call SpaceVim#logger#error(' throwpoint: ' . v:throwpoint)
|
||||
endtry
|
||||
call SpaceVim#logger#info('finished loading local conf')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:disable_welcome() abort
|
||||
augroup SPwelcome
|
||||
au!
|
||||
|
@ -159,6 +159,9 @@ function! s:apply(config, type) abort
|
||||
if value ==# 'defx' && !has('python3')
|
||||
call SpaceVim#logger#warn('defx requires +python3!')
|
||||
continue
|
||||
elseif value ==# 'defx' && has('nvim') && !has('nvim-0.4.0')
|
||||
call SpaceVim#logger#warn('defx requires nvim 0.4.0+!')
|
||||
continue
|
||||
elseif value ==# 'neo-tree' && !has('nvim')
|
||||
call SpaceVim#logger#warn('neo-tree requires neovim')
|
||||
continue
|
||||
@ -174,8 +177,10 @@ function! s:apply(config, type) abort
|
||||
call SpaceVim#logger#warn('deoplete requires +python3!')
|
||||
continue
|
||||
endif
|
||||
elseif value ==# 'nvim-cmp' && !has('nvim')
|
||||
call SpaceVim#logger#warn('nvim-cmp requires neovim')
|
||||
elseif value ==# 'nvim-cmp' && !has('nvim-0.7.0')
|
||||
" https://github.com/hrsh7th/nvim-cmp/issues/231
|
||||
" nvim-cmp Breaking changes
|
||||
call SpaceVim#logger#warn('nvim-cmp will only work on nvim v0.7.x or higher')
|
||||
continue
|
||||
endif
|
||||
elseif name ==# 'statusline_right_sections'
|
||||
|
@ -146,7 +146,7 @@ endfunction
|
||||
"}}}
|
||||
|
||||
function! SpaceVim#default#layers() abort
|
||||
call SpaceVim#logger#debug('init default layer list.')
|
||||
call SpaceVim#logger#info('init default layer list.')
|
||||
call SpaceVim#layers#load('autocomplete')
|
||||
call SpaceVim#layers#load('checkers')
|
||||
call SpaceVim#layers#load('format')
|
||||
@ -156,10 +156,11 @@ function! SpaceVim#default#layers() abort
|
||||
call SpaceVim#layers#load('core#banner')
|
||||
call SpaceVim#layers#load('core#statusline')
|
||||
call SpaceVim#layers#load('core#tabline')
|
||||
call SpaceVim#logger#info('layer list init done')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#default#keyBindings() abort
|
||||
call SpaceVim#logger#debug('init default key bindings.')
|
||||
call SpaceVim#logger#info('init default key bindings.')
|
||||
xnoremap <silent> <Leader>y :<C-u>call clipboard#yank()<cr>
|
||||
nnoremap <expr> <Leader>p clipboard#paste('p')
|
||||
nnoremap <expr> <Leader>P clipboard#paste('P')
|
||||
@ -271,10 +272,14 @@ function! SpaceVim#default#keyBindings() abort
|
||||
nnoremap <silent><M-5> :<C-u>call <SID>tobur(5)<CR>
|
||||
nnoremap <silent><M-Right> :<C-U>call <SID>tobur("next")<CR>
|
||||
nnoremap <silent><M-Left> :<C-U>call <SID>tobur("prev")<CR>
|
||||
|
||||
call SpaceVim#logger#info('default key binding init done')
|
||||
endfunction
|
||||
|
||||
fu! s:tobur(num) abort
|
||||
if has('nvim-0.9.5')
|
||||
lua require('spacevim.plugin.tabline').jump(vim.api.nvim_eval('a:num'))
|
||||
return
|
||||
endif
|
||||
if index(get(g:,'_spacevim_altmoveignoreft',[]), &filetype) == -1
|
||||
if a:num ==# 'next'
|
||||
if tabpagenr('$') > 1
|
||||
@ -301,42 +306,42 @@ fu! s:tobur(num) abort
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endf
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#default#UseSimpleMode() abort
|
||||
function! SpaceVim#default#UseSimpleMode() abort
|
||||
|
||||
endfunction
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#default#Customfoldtext() abort
|
||||
"get first non-blank line
|
||||
let fs = v:foldstart
|
||||
while getline(fs) =~# '^\s*$' | let fs = nextnonblank(fs + 1)
|
||||
endwhile
|
||||
if fs > v:foldend
|
||||
let line = getline(v:foldstart)
|
||||
else
|
||||
let line = substitute(getline(fs), '\t', repeat(' ', &tabstop), 'g')
|
||||
endif
|
||||
function! SpaceVim#default#Customfoldtext() abort
|
||||
"get first non-blank line
|
||||
let fs = v:foldstart
|
||||
while getline(fs) =~# '^\s*$' | let fs = nextnonblank(fs + 1)
|
||||
endwhile
|
||||
if fs > v:foldend
|
||||
let line = getline(v:foldstart)
|
||||
else
|
||||
let line = substitute(getline(fs), '\t', repeat(' ', &tabstop), 'g')
|
||||
endif
|
||||
|
||||
let foldsymbol='+'
|
||||
let repeatsymbol='-'
|
||||
let prefix = foldsymbol . ' '
|
||||
let foldsymbol='+'
|
||||
let repeatsymbol='-'
|
||||
let prefix = foldsymbol . ' '
|
||||
|
||||
let w = winwidth(0) - &foldcolumn - (&number ? 8 : 0)
|
||||
let foldSize = 1 + v:foldend - v:foldstart
|
||||
let foldSizeStr = ' ' . foldSize . ' lines '
|
||||
let foldLevelStr = repeat('+--', v:foldlevel)
|
||||
let lineCount = line('$')
|
||||
let foldPercentage = printf('[%.1f', (foldSize*1.0)/lineCount*100) . '%] '
|
||||
let expansionString = repeat(repeatsymbol, w - strwidth(prefix.foldSizeStr.line.foldLevelStr.foldPercentage))
|
||||
return prefix . line . expansionString . foldSizeStr . foldPercentage . foldLevelStr
|
||||
endfunction
|
||||
let w = winwidth(0) - &foldcolumn - (&number ? 8 : 0)
|
||||
let foldSize = 1 + v:foldend - v:foldstart
|
||||
let foldSizeStr = ' ' . foldSize . ' lines '
|
||||
let foldLevelStr = repeat('+--', v:foldlevel)
|
||||
let lineCount = line('$')
|
||||
let foldPercentage = printf('[%.1f', (foldSize*1.0)/lineCount*100) . '%] '
|
||||
let expansionString = repeat(repeatsymbol, w - strwidth(prefix.foldSizeStr.line.foldLevelStr.foldPercentage))
|
||||
return prefix . line . expansionString . foldSizeStr . foldPercentage . foldLevelStr
|
||||
endfunction
|
||||
|
||||
function! s:switch_tabs() abort
|
||||
let previous_tab = s:TAB.previous_tabpagenr()
|
||||
if previous_tab > 0
|
||||
exe 'tabnext ' . previous_tab
|
||||
endif
|
||||
endfunction
|
||||
function! s:switch_tabs() abort
|
||||
let previous_tab = s:TAB.previous_tabpagenr()
|
||||
if previous_tab > 0
|
||||
exe 'tabnext ' . previous_tab
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
" vim:set et sw=2:
|
||||
|
@ -74,10 +74,12 @@ function! SpaceVim#layers#load(layer, ...) abort
|
||||
elseif empty(a:layer) || type(a:layer) !=# type('')
|
||||
return
|
||||
endif
|
||||
call SpaceVim#logger#info('load layer:' . a:layer)
|
||||
let loadable = 1
|
||||
try
|
||||
let loadable = SpaceVim#layers#{a:layer}#loadable()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
call SpaceVim#logger#info(a:layer . ' layer do not implement loadable function')
|
||||
endtry
|
||||
if index(s:enabled_layers, a:layer) == -1
|
||||
if loadable
|
||||
@ -94,6 +96,7 @@ function! SpaceVim#layers#load(layer, ...) abort
|
||||
call SpaceVim#layers#{a:layer}#set_variable(a:1)
|
||||
let s:layers_vars[a:layer] = a:1
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
call SpaceVim#logger#info(a:layer . ' layer do not implement set_variable function')
|
||||
endtry
|
||||
endif
|
||||
if a:0 > 0 && type(a:1) == 1
|
||||
@ -101,6 +104,7 @@ function! SpaceVim#layers#load(layer, ...) abort
|
||||
call SpaceVim#layers#load(l)
|
||||
endfor
|
||||
endif
|
||||
call SpaceVim#logger#info('layer loaded.')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#disable(layer) abort
|
||||
|
@ -21,6 +21,10 @@ scriptencoding utf-8
|
||||
" SPC g . version control transient state
|
||||
" <
|
||||
|
||||
if exists('s:CMP')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:CMP = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
let s:enable_gtm_status = 0
|
||||
@ -89,7 +93,7 @@ function! s:git_branch() abort
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
elseif exists('g:loaded_git')
|
||||
else
|
||||
let prefix = g:spacevim_statusline_unicode ? '' : ''
|
||||
return printf('%%{git#branch#current("%s")}', prefix)
|
||||
endif
|
||||
@ -512,6 +516,12 @@ function! s:git_transient_state() abort
|
||||
call state.open()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#VersionControl#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
" function() wrapper {{{
|
||||
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||
function! s:_function(fstr) abort
|
||||
|
@ -92,28 +92,32 @@ function! SpaceVim#layers#autocomplete#plugins() abort
|
||||
" use bundle nvim-cmp
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-cmp', {
|
||||
\ 'merged' : 0,
|
||||
\ 'loadconf' : 1,
|
||||
\ 'loadconf' : 1, 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/cmp-buffer', {
|
||||
\ 'merged' : 0,
|
||||
\ 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/cmp-path', {
|
||||
\ 'merged' : 0,
|
||||
\ 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/cmp-cmdline', {
|
||||
\ 'merged' : 0,
|
||||
\ 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/lspkind-nvim', {
|
||||
\ 'merged' : 0,
|
||||
\ 'loadconf' : 1,
|
||||
\ 'loadconf' : 1, 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/cmp-dictionary', {
|
||||
\ 'merged' : 0,
|
||||
\ 'loadconf' : 1,
|
||||
\ 'loadconf' : 1, 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/cmp-neosnippet', {
|
||||
\ 'merged' : 0,
|
||||
\ 'on_event' : ['InsertEnter'],
|
||||
\ }])
|
||||
endif
|
||||
elseif g:spacevim_autocomplete_method ==# 'asyncomplete'
|
||||
@ -145,7 +149,7 @@ function! SpaceVim#layers#autocomplete#plugins() abort
|
||||
" both echodoc and CompleteParameter requires
|
||||
" vim patch-7.4.744
|
||||
" v:completed_item
|
||||
call add(plugins, ['Shougo/echodoc.vim', {
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/echodoc.vim', {
|
||||
\ 'on_cmd' : ['EchoDocEnable', 'EchoDocDisable'],
|
||||
\ 'on_event' : 'CompleteDone',
|
||||
\ 'loadconf_before' : 1,
|
||||
@ -313,5 +317,9 @@ endfunction
|
||||
function! s:restore_sequence_delay() abort
|
||||
let &timeoutlen = s:timeoutlen
|
||||
endfunction
|
||||
function! SpaceVim#layers#autocomplete#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -67,3 +67,9 @@ function! SpaceVim#layers#chat#health() abort
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#chat#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -64,6 +64,12 @@ function! SpaceVim#layers#checkers#plugins() abort
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#checkers#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#checkers#set_variable(var) abort
|
||||
|
||||
let s:show_cursor_error = get(a:var, 'show_cursor_error', 1)
|
||||
@ -206,6 +212,7 @@ function! s:toggle_show_error(...) abort
|
||||
" if buf_server_ready return false, the language server loclist
|
||||
" should be cleared.
|
||||
if get(getloclist(0, {'title': 0}), 'title', '') ==# 'Language Server'
|
||||
\ || get(getloclist(0, {'title': 0}), 'title', '') ==# 'Diagnostics'
|
||||
call setloclist(0, [], 'r')
|
||||
endif
|
||||
let llist = getloclist(0, {'size' : 1, 'winid' : 1})
|
||||
|
@ -1,6 +1,6 @@
|
||||
"=============================================================================
|
||||
" chinese.vim --- SpaceVim chinese layer
|
||||
" Copyright (c) 2016-2023 Wang Shidong & Contributors
|
||||
" Copyright (c) 2016-2024 Wang Shidong & Contributors
|
||||
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
@ -30,9 +30,10 @@
|
||||
function! SpaceVim#layers#chinese#plugins() abort
|
||||
let plugins = [
|
||||
\ ['yianwillis/vimcdoc' , {'merged' : 0}],
|
||||
\ ['NamelessUzer/Vim-Natural-Language-Number-Translator' , {'merged' : 0}],
|
||||
\ ['voldikss/vim-translator' , {'merged' : 0, 'on_cmd' : ['Translate', 'TranslateW', 'TranslateR', 'TranslateX']}],
|
||||
\ ['wsdjeg/ChineseLinter.vim' , {'merged' : 0, 'on_cmd' : 'CheckChinese', 'on_ft' : ['markdown', 'text']}],
|
||||
\ ]
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/ChineseLinter.vim' , {'merged' : 0, 'on_cmd' : 'CheckChinese', 'on_ft' : ['markdown', 'text']}])
|
||||
if SpaceVim#layers#isLoaded('ctrlp')
|
||||
call add(plugins, ['vimcn/ctrlp.cnx', {'merged' : 0}])
|
||||
endif
|
||||
@ -52,6 +53,8 @@ function! SpaceVim#layers#chinese#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 'c'] , 'CheckChinese', 'check-with-ChineseLinter', 1)
|
||||
let g:_spacevim_mappings_space.n.c = {'name' : '+Convert'}
|
||||
call SpaceVim#mapping#space#def('nmap', ['n', 'c', 'd'], '<Plug>ConvertChineseNumberToDigit', 'convert Chinese number to digit', 0, 1)
|
||||
call SpaceVim#mapping#space#def('nmap', ['n', 'c', 'z'], '<Plug>ConvertDigitToChineseNumberLower', 'convert digit to Lower Chinese number', 0, 1)
|
||||
call SpaceVim#mapping#space#def('nmap', ['n', 'c', 'Z'], '<Plug>ConvertDigitToChineseNumberUpper', 'convert digit to Upper Chinese number', 0, 1)
|
||||
" do not load vimcdoc plugin
|
||||
let g:loaded_vimcdoc = 1
|
||||
endfunction
|
||||
@ -62,102 +65,120 @@ function! SpaceVim#layers#chinese#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
command! -nargs=0 -range ConvertChineseNumberToDigit :<line1>,<line2>call s:ConvertChineseNumberToDigit()
|
||||
nnoremap <silent> <Plug>ConvertChineseNumberToDigit :ConvertChineseNumberToDigit<cr>
|
||||
vnoremap <silent> <Plug>ConvertChineseNumberToDigit :ConvertChineseNumberToDigit<cr>
|
||||
function! s:ConvertChineseNumberToDigit() range
|
||||
|
||||
" 定义快捷键映射
|
||||
nnoremap <silent> <Plug>ConvertChineseNumberToDigit :call <sid>ConvertChineseNumberToDigit('normal')<cr>
|
||||
vnoremap <silent> <Plug>ConvertChineseNumberToDigit :call <sid>ConvertChineseNumberToDigit('visual')<cr>
|
||||
|
||||
" 函数定义
|
||||
function! s:ConvertChineseNumberToDigit(mode) range
|
||||
let save_cursor = getcurpos()
|
||||
let ChineseNumberPattern = '[〇一二三四五六七八九十百千万亿兆零壹贰叁肆伍陆柒捌玖拾佰仟萬億两点]\+'
|
||||
if mode() ==? 'n' && a:firstline == a:lastline
|
||||
let save_register = @k
|
||||
if a:mode == 'normal'
|
||||
" 正常模式处理
|
||||
let cword = expand('<cword>')
|
||||
let cword = substitute(cword, ChineseNumberPattern, '\=s:Chinese2Digit(submatch(0))', "g")
|
||||
let save_register_k = getreg("k")
|
||||
call setreg("k", cword)
|
||||
normal! viw"kp
|
||||
call setreg("k", save_register_k)
|
||||
let rst = substitute(cword, Zh2Num#getZhNumPattern(), '\=Zh2Num#Translator(submatch(0))', "g")
|
||||
if rst != cword
|
||||
let @k = rst
|
||||
normal! viw"kp
|
||||
endif
|
||||
else
|
||||
silent execute a:firstline . "," . a:lastline . 'substitute/' . ChineseNumberPattern . '/\=s:Chinese2Digit(submatch(0))/g'
|
||||
" 可视模式处理
|
||||
normal! gv
|
||||
if mode() == "\<C-V>"
|
||||
" 块选择模式
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
if column_end < column_start
|
||||
let [column_start, column_end] = [column_end, column_start]
|
||||
endif
|
||||
for line_num in range(line_start, line_end)
|
||||
let line = getline(line_num)
|
||||
let line_utf8 = iconv(line, &encoding, 'UTF-8')
|
||||
let selectedText = line_utf8[column_start - 1: column_end - 1]
|
||||
let translatedText = substitute(selectedText, Zh2Num#getZhNumPattern(), '\=Zh2Num#Translator(submatch(0))', 'g')
|
||||
let newLine = line[:column_start - 2] . translatedText . line[column_end:]
|
||||
call setline(line_num, newLine)
|
||||
endfor
|
||||
else
|
||||
" 其他可视模式
|
||||
normal! "ky
|
||||
let selectedText = iconv(@k, &encoding, 'UTF-8')
|
||||
let translatedText = substitute(selectedText, Zh2Num#getZhNumPattern(), '\=Zh2Num#Translator(submatch(0))', 'g')
|
||||
if translatedText != selectedText
|
||||
call setreg('k', translatedText)
|
||||
normal! gv"kp
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
call setpos('.', save_cursor)
|
||||
let @k = save_register
|
||||
endfunction
|
||||
|
||||
function! s:Chinese2Digit(cnDigitString)
|
||||
let CN_NUM = {
|
||||
\ '〇': 0, '一': 1, '二': 2, '三': 3, '四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9,
|
||||
\ '零': 0, '壹': 1, '贰': 2, '叁': 3, '肆': 4, '伍': 5, '陆': 6, '柒': 7, '捌': 8, '玖': 9,
|
||||
\ '貮': 2, '两': 2, '点': '.'
|
||||
\ }
|
||||
let CN_UNIT = {
|
||||
\ '十': 10, '拾': 10, '百': 100, '佰': 100, '千': 1000, '仟': 1000, '万': 10000, '萬': 10000,
|
||||
\ '亿': 100000000, '億': 100000000, '兆': 1000000000000
|
||||
\ }
|
||||
nnoremap <silent> <Plug>ConvertDigitToChineseNumberLower :call <sid>ConvertDigitToChineseNumber('normal', "lower")<cr>
|
||||
vnoremap <silent> <Plug>ConvertDigitToChineseNumberLower :call <sid>ConvertDigitToChineseNumber('visual', "lower")<cr>
|
||||
|
||||
if a:cnDigitString =~ '^[点两貮〇一二三四五六七八九零壹贰叁肆伍陆柒捌玖]\+$'
|
||||
let result = substitute(a:cnDigitString, ".", {m -> CN_NUM[m[0]]}, 'g')
|
||||
else
|
||||
let cnList = split(a:cnDigitString, "点")
|
||||
let integer = map(str2list(cnList[0]), 'nr2char(v:val)') " 整数部分
|
||||
let decimal = len(cnList) == 2 ? cnList[1] : [] " 小数部分
|
||||
let unit = 0 " 当前单位
|
||||
let parse = [] " 解析数组
|
||||
while !empty(integer)
|
||||
let x = remove(integer, -1)
|
||||
if has_key(CN_UNIT, x)
|
||||
" 当前字符是单位
|
||||
let unit = CN_UNIT[x]
|
||||
if unit == 10000 " 万位
|
||||
call add(parse, "w")
|
||||
let unit = 1
|
||||
elseif unit == 100000000 " 亿位
|
||||
call add(parse, "y")
|
||||
let unit = 1
|
||||
elseif unit == 1000000000000 " 兆位
|
||||
call add (parse, "z")
|
||||
let unit = 1
|
||||
endif
|
||||
continue
|
||||
else
|
||||
" 当前字符是数字
|
||||
let dig = CN_NUM[x]
|
||||
if unit
|
||||
let dig *= unit
|
||||
let unit = 0
|
||||
endif
|
||||
call add(parse, dig)
|
||||
nnoremap <silent> <Plug>ConvertDigitToChineseNumberUpper :call <sid>ConvertDigitToChineseNumber('normal', "upper")<cr>
|
||||
vnoremap <silent> <Plug>ConvertDigitToChineseNumberUpper :call <sid>ConvertDigitToChineseNumber('visual', "upper")<cr>
|
||||
|
||||
function! s:ConvertDigitToChineseNumber(mode, caseType) abort
|
||||
let save_cursor = getcurpos()
|
||||
let save_register = @k
|
||||
let cword = expand('<cword>')
|
||||
if a:mode == 'normal'
|
||||
if !empty(cword)
|
||||
let rst = substitute(cword, Num2Zh#getNumberPattern(), '\=Num2Zh#Translator(submatch(0), "'. a:caseType .'")', "g")
|
||||
if rst != cword
|
||||
let @k = rst
|
||||
normal! viw"kp
|
||||
endif
|
||||
endwhile
|
||||
if unit == 10 " 处理10-19的数字
|
||||
call add(parse, 10)
|
||||
endif
|
||||
let result = 0
|
||||
let tmp = 0
|
||||
while !empty(parse)
|
||||
let x = remove(parse, -1)
|
||||
if type(x) == type("")
|
||||
if x == 'w'
|
||||
let tmp *= 10000
|
||||
let result += tmp
|
||||
let tmp = 0
|
||||
elseif x == 'y'
|
||||
let tmp *= 100000000
|
||||
let result += tmp
|
||||
let tmp = 0
|
||||
elseif x == 'z'
|
||||
let tmp *= 1000000000000
|
||||
let result += tmp
|
||||
let tmp = 0
|
||||
" 如果是block模式,则特别处理
|
||||
elseif a:mode == 'visual'
|
||||
normal! gv
|
||||
if mode() == "\<C-V>"
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
if column_end < column_start
|
||||
let [column_start, column_end] = [column_end, column_start]
|
||||
endif
|
||||
for line_num in range(line_start, line_end)
|
||||
let line = getline(line_num)
|
||||
" 将行文本转换为UTF-8编码
|
||||
let line_utf8 = iconv(line, &encoding, 'UTF-8')
|
||||
let selectedText = line_utf8[column_start - 1: column_end - 1]
|
||||
let translatedText = substitute(selectedText, Num2Zh#getNumberPattern(), '\=Num2Zh#Translator(submatch(0), "' . a:caseType . '")', 'g')
|
||||
let newLine = line[:column_start - 2] . translatedText . line[column_end:]
|
||||
call setline(line_num, newLine)
|
||||
endfor
|
||||
else
|
||||
" 对其他模式的处理
|
||||
if mode() == 'line'
|
||||
normal! '[V']
|
||||
elseif mode() == 'char'
|
||||
normal! `[v`]
|
||||
elseif mode() ==? 'v'
|
||||
normal! gv
|
||||
else
|
||||
normal! '[v']
|
||||
endif
|
||||
|
||||
" 获取选择的文本,将其保存在寄存器t中
|
||||
normal! "ky
|
||||
let selectedText = iconv(@k, &encoding, 'UTF-8')
|
||||
|
||||
" 转换文本
|
||||
let translatedText = substitute(selectedText, Num2Zh#getNumberPattern(), '\=Num2Zh#Translator(submatch(0), "' . a:caseType . '")', 'g')
|
||||
|
||||
if translatedText != selectedText
|
||||
" 替换原文本
|
||||
call setreg('k', translatedText)
|
||||
normal! gv"kp
|
||||
endif
|
||||
else
|
||||
let tmp += x
|
||||
endif
|
||||
endwhile
|
||||
let result += tmp
|
||||
if !empty(decimal)
|
||||
let decimal = substitute(decimal, ".", {m -> CN_NUM[m[0]]}, 'g')
|
||||
let result .= "." . decimal
|
||||
endif
|
||||
endif
|
||||
return result
|
||||
call setpos('.', save_cursor)
|
||||
let @k = save_register
|
||||
endfunction
|
||||
|
||||
" function() wrapper
|
||||
|
@ -41,6 +41,10 @@
|
||||
"
|
||||
" SpaceVim is not gonna fix them since these should be in charge of each author.
|
||||
|
||||
if exists('s:JSON')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:JSON = SpaceVim#api#import('data#json')
|
||||
|
||||
function! SpaceVim#layers#colorscheme#plugins() abort
|
||||
@ -170,6 +174,12 @@ function! SpaceVim#layers#colorscheme#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#colorscheme#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
" function() wrapper
|
||||
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||
function! s:_function(fstr) abort
|
||||
|
@ -14,13 +14,13 @@ scriptencoding utf-8
|
||||
" and it provides filetree, comment key bindings etc.
|
||||
"
|
||||
" @subsection options
|
||||
" - `filetree_show_hidden`: option for showing hidden file in filetree,
|
||||
" 1. `filetree_show_hidden`: option for showing hidden file in filetree,
|
||||
" disabled by default.
|
||||
" - `enable_smooth_scrolling`: enable/disabled smooth scrolling key bindings,
|
||||
" 2. `enable_smooth_scrolling`: enable/disabled smooth scrolling key bindings,
|
||||
" enabled by default.
|
||||
" - `enable_filetree_gitstatus`: enable/disable git status column in filetree.
|
||||
" - `enable_filetree_filetypeicon`: enable/disable filetype icons in filetree.
|
||||
" - `enable_netrw`: enable/disable netrw, disabled by default.
|
||||
" 3. `enable_filetree_gitstatus`: enable/disable git status column in filetree.
|
||||
" 4. `enable_filetree_filetypeicon`: enable/disable filetype icons in filetree.
|
||||
" 5. `enable_netrw`: enable/disable netrw, disabled by default.
|
||||
"
|
||||
" NOTE: the `enable_vimfiler_gitstatus` and `enable_filetree_gitstatus` option
|
||||
" has been deprecated. Use layer option instead.
|
||||
@ -34,6 +34,122 @@ if exists('s:string_hi')
|
||||
finish
|
||||
endif
|
||||
|
||||
""
|
||||
" @section File Tree, usage-file-tree
|
||||
" @parentsection usage
|
||||
" The default filetree is `nerdtree`, and the default key binding is `<F3>`.
|
||||
" SpaceVim also provides `SPC f t` and `SPC f T` to open the file tree.
|
||||
"
|
||||
" The option @section(options-filemanager) can be used to change file
|
||||
" manager plugin. For example:
|
||||
" >
|
||||
" [options]
|
||||
" # file manager plugins supported in SpaceVim:
|
||||
" # - nerdtree (default)
|
||||
" # - vimfiler: you need to build the vimproc.vim in bundle/vimproc.vim directory
|
||||
" # - defx: requires +py3 feature
|
||||
" # - neo-tree: require neovim 0.7.0
|
||||
" filemanager = "nerdtree"
|
||||
" <
|
||||
"
|
||||
" VCS integration is also supported, there will be a column status,
|
||||
" this feature may make filetree slow, so it is not enabled by default.
|
||||
" To enable this feature, add the layer option `enable_filetree_gitstatus = true`
|
||||
" to core layer.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'core'
|
||||
" enable_filetree_gitstatus = true
|
||||
" <
|
||||
"
|
||||
" There is also an option to configure whether open filetree when startup.
|
||||
" This is enabled by defaul, To disable this feature, you can set the
|
||||
" @section(options-enable_vimfiler_welcome) to false:
|
||||
" >
|
||||
" [options]
|
||||
" enable_vimfiler_welcome = false
|
||||
" <
|
||||
"
|
||||
" There is also an option to configure the side of the file tree,
|
||||
" by default it is right. To move the file tree to the left,
|
||||
" you can use the option: @section(options-filetree_direction).
|
||||
" >
|
||||
" [options]
|
||||
" filetree_direction = "left"
|
||||
" <
|
||||
"
|
||||
" @subsection File tree navigation
|
||||
"
|
||||
" Navigation is centered on the `hjkl` keys with the hope of providing
|
||||
" a fast navigation experience like in vifm(https://github.com/vifm):
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" --------------------- | -------------------------------------------------
|
||||
" <F3> | Toggle file explorer
|
||||
" SPC f t | Toggle file explorer
|
||||
" SPC f T | Show file explorer
|
||||
" <
|
||||
" Key bindings in filetree windows:
|
||||
" >
|
||||
" <Left> / h | go to parent node and collapse expanded directory
|
||||
" <Down> / j | select next file or directory
|
||||
" <Up> / k | select previous file or directory
|
||||
" <Right> / l | open selected file or expand directory
|
||||
" <Enter> | open file or switch to directory
|
||||
" N | Create new file under cursor
|
||||
" r | Rename the file under cursor
|
||||
" d | Delete the file under cursor
|
||||
" K | Create new directory under cursor
|
||||
" y y | Copy file full path to system clipboard
|
||||
" y Y | Copy file to system clipboard
|
||||
" P | Paste file to the position under the cursor
|
||||
" . | Toggle hidden files
|
||||
" s v | Split edit
|
||||
" s g | Vertical split edit
|
||||
" p | Preview
|
||||
" i | Switch to directory history
|
||||
" v | Quick look
|
||||
" g x | Execute with vimfiler associated
|
||||
" ' | Toggle mark current line
|
||||
" V | Clear all marks
|
||||
" > | increase filetree screenwidth
|
||||
" < | decrease filetree screenwidth
|
||||
" <Home> | Jump to first line
|
||||
" <End> | Jump to last line
|
||||
" Ctrl-h | Switch to project root directory
|
||||
" Ctrl-r | Redraw
|
||||
" <
|
||||
"
|
||||
" @subsection Open file with file tree.
|
||||
"
|
||||
" If only one file buffer is opened, a file is opened in the active window,
|
||||
" otherwise we need to use vim-choosewin to select a window to open the file.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" --------------- | ----------------------------------------
|
||||
" l / <Enter> | open file in one window
|
||||
" s g | open file in a vertically split window
|
||||
" s v | open file in a horizontally split window
|
||||
" <
|
||||
" @subsection Override filetree key bindings
|
||||
"
|
||||
" If you want to override the default key bindings in filetree windows.
|
||||
" You can use User autocmd in bootstrap function. for examples:
|
||||
" >
|
||||
" function! myspacevim#before() abort
|
||||
" autocmd User NerdTreeInit
|
||||
" \ nnoremap <silent><buffer> <CR> :<C-u>call
|
||||
" \ g:NERDTreeKeyMap.Invoke('o')<CR>
|
||||
" endfunction
|
||||
" <
|
||||
"
|
||||
" Here is all the autocmd for filetree:
|
||||
"
|
||||
" - nerdtree: `User NerdTreeInit`
|
||||
" - defx: `User DefxInit`
|
||||
" - vimfiler: `User VimfilerInit`
|
||||
|
||||
|
||||
let s:enable_smooth_scrolling = 1
|
||||
let s:enable_netrw = 0
|
||||
|
||||
@ -80,7 +196,7 @@ function! SpaceVim#layers#core#plugins() abort
|
||||
\ }])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vimproc.vim', {'build' : [(executable('gmake') ? 'gmake' : 'make')]}])
|
||||
elseif g:spacevim_filemanager ==# 'defx'
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx.nvim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx.nvim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1, 'on_cmd' : 'Defx'}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx-git',{'merged' : 0, 'loadconf' : 1}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx-icons',{'merged' : 0}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx-sftp',{'merged' : 0}])
|
||||
@ -269,7 +385,6 @@ function! SpaceVim#layers#core#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call('
|
||||
\ . string(s:_function('s:safe_erase_buffer')) . ', [])',
|
||||
\ 'safe-erase-buffer', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'open-welcome-screen', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call('
|
||||
\ . string(s:_function('s:open_message_buffer')) . ', [])',
|
||||
\ 'open-message-buffer', 1)
|
||||
@ -319,7 +434,9 @@ function! SpaceVim#layers#core#config() abort
|
||||
" TODO: fix all these command
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'Defx', 'toggle-file-tree', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'Defx -no-toggle', 'show-file-tree', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'o'], "Defx -no-toggle -search=`expand('%:p')` `stridx(expand('%:p'), getcwd()) < 0? expand('%:p:h'): getcwd()`", 'open-file-tree', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'o'], 'call call('
|
||||
\ . string(s:_function('s:defx_find_current_file')) . ', [])',
|
||||
\ 'open-file-tree', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 't'], 'exe "Defx -no-toggle " . fnameescape(expand("%:p:h"))', 'show-file-tree-at-buffer-dir', 1)
|
||||
elseif g:spacevim_filemanager ==# 'nvim-tree'
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NvimTreeToggle', 'toggle-file-tree', 1)
|
||||
@ -1067,6 +1184,21 @@ function! SpaceVim#layers#core#set_variable(var) abort
|
||||
\ 0)
|
||||
endfunction
|
||||
|
||||
function! s:defx_find_current_file() abort
|
||||
let current_file = s:FILE.unify_path(expand('%'), ':p')
|
||||
let current_dir = s:FILE.unify_path(getcwd())
|
||||
|
||||
let command = "Defx -no-toggle -search=`expand('%:p')` "
|
||||
if stridx(current_file, current_dir) < 0
|
||||
let command .= expand('%:p:h')
|
||||
else
|
||||
let command .= getcwd()
|
||||
endif
|
||||
|
||||
call execute(command)
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#get_options() abort
|
||||
|
||||
return [
|
||||
@ -1091,4 +1223,10 @@ function! s:close_current_tab() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -242,4 +242,16 @@ function! SpaceVim#layers#core#banner#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#banner#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#banner#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -21,13 +21,132 @@
|
||||
" - `major_mode_cache`: Enable/disable major mode cache, enabled by default.
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if exists('g:_spacevim_statusline_loaded')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:_spacevim_statusline_loaded = 1
|
||||
|
||||
|
||||
if has('nvim-0.10.0')
|
||||
|
||||
" 核心逻辑移至 lua,兼容 VIML 函数接口
|
||||
|
||||
function! SpaceVim#layers#core#statusline#winnr(id) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').winnr(a:id)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
if a:0 > 0
|
||||
return v:lua.require('spacevim.plugin.statusline').get(a:1)
|
||||
else
|
||||
return v:lua.require('spacevim.plugin.statusline').get()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#init() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').init()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#def_colors() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').def_colors()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#register_mode(mode) abort
|
||||
if has_key(a:mode, 'func') && type(a:mode.func) == 2
|
||||
let mode = a:mode
|
||||
let mode.func = string(a:mode.func)[10:-3]
|
||||
return v:lua.require('spacevim.plugin.statusline').register_mode(mode)
|
||||
else
|
||||
return v:lua.require('spacevim.plugin.statusline').register_mode(a:mode)
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#toggle_mode(name) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').toggle_mode(a:name)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#toggle_section(name) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').toggle_section(a:name)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#rsep() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').rsep()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#set_variable(var) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').set_variable(a:var)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#config() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').config()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#ctrlp(focus, byfname, regex, prev, item, next, marked) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').ctrlp(a:focus, a:byfname, a:regex, a:prev, a:item, a:next, a:marked)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').ctrlp_status(a:str)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#jump(i) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').jump(a:i)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#mode(mode) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').mode(a:mode)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#mode_text(mode) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').mode_text(a:mode)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#denite_status(argv) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').denite_status(a:argv)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#denite_mode() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').denite_mode()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#unite_mode() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').unite_mode()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#register_sections(name, func) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').register_sections(a:name, string(a:func)[10:-3])
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#check_section(name) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').check_section(a:name)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#remove_section(name) abort
|
||||
return v:lua.require('spacevim.plugin.statusline').remove_section(a:name)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#health() abort
|
||||
return v:lua.require('spacevim.plugin.statusline').health()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
" APIs
|
||||
let s:MESSLETTERS = SpaceVim#api#import('messletters')
|
||||
let s:TIME = SpaceVim#api#import('time')
|
||||
@ -59,6 +178,7 @@ let s:separators = {
|
||||
\ }
|
||||
let s:i_separators = {
|
||||
\ 'arrow' : ["\ue0b1", "\ue0b3"],
|
||||
\ 'curve' : ["\ue0b5", "\ue0b7"],
|
||||
\ 'slant' : ["\ue0b9", "\ue0bb"],
|
||||
\ 'bar' : ['|', '|'],
|
||||
\ 'nil' : ['', ''],
|
||||
@ -165,7 +285,7 @@ function! s:fileformat() abort
|
||||
else
|
||||
let g:_spacevim_statusline_fileformat = &ff
|
||||
endif
|
||||
return '%{" " . g:_spacevim_statusline_fileformat . " | " . (&fenc!=""?&fenc:&enc) . " "}'
|
||||
return '%{" " . g:_spacevim_statusline_fileformat . " ' . s:irsep . ' " . (&fenc!=""?&fenc:&enc) . " "}'
|
||||
endfunction
|
||||
|
||||
function! s:major_mode() abort
|
||||
@ -255,7 +375,23 @@ endfunction
|
||||
|
||||
|
||||
function! s:syntax_checking() abort
|
||||
if g:spacevim_lint_engine ==# 'neomake'
|
||||
if SpaceVim#lsp#buf_server_ready()
|
||||
let counts = v:lua.require('spacevim.lsp').lsp_diagnostic_count()
|
||||
let errors = get(counts, 0, 0)
|
||||
let warnings = get(counts, 1, 0)
|
||||
let infos = get(counts, 2, 0)
|
||||
let hints = get(counts, 3, 0)
|
||||
let errors_l = errors ? '%#SpaceVim_statusline_error#● ' . errors : ''
|
||||
let warnings_l = warnings ? '%#SpaceVim_statusline_warn#● ' . warnings : ''
|
||||
let infos_l = infos ? '%#SpaceVim_statusline_info#● ' . infos : ''
|
||||
let hints_l = hints ? '%#SpaceVim_statusline_hint#● ' . hints : ''
|
||||
let l = join(filter([errors_l, warnings_l, infos_l, hints_l], 'v:val != ""'), ' ')
|
||||
if !empty(l)
|
||||
return ' ' . l . ' '
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
elseif g:spacevim_lint_engine ==# 'neomake'
|
||||
if !exists('g:loaded_neomake')
|
||||
return ''
|
||||
endif
|
||||
@ -397,7 +533,6 @@ function! s:filesize() abort
|
||||
return printf('%.1f', l:size/1024.0/1024.0/1024.0) . 'g '
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
for nr in range(1, winnr('$'))
|
||||
call setwinvar(nr, 'winwidth', winwidth(nr))
|
||||
@ -574,11 +709,13 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
elseif &filetype ==# 'SpaceVimWinDiskManager'
|
||||
return '%#SpaceVim_statusline_a# WinDisk %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
|
||||
elseif &filetype ==# 'SpaceVimTodoManager'
|
||||
return '%#SpaceVim_statusline_a# TODO manager %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
|
||||
return '%#SpaceVim_statusline_ia# TODO manager %#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
elseif &filetype ==# 'SpaceVimTasksInfo'
|
||||
return '%#SpaceVim_statusline_a# Tasks manager %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
|
||||
elseif &filetype ==# 'SpaceVimGitBranchManager'
|
||||
return '%#SpaceVim_statusline_a# Branch manager %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
|
||||
return '%#SpaceVim_statusline_ia# Branch manager %#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
elseif &filetype ==# 'SpaceVimGitRemoteManager'
|
||||
return '%#SpaceVim_statusline_ia# Remote manager %#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
elseif &filetype ==# 'SpaceVimPlugManager'
|
||||
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
|
||||
@ -610,19 +747,19 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
\ . '%#SpaceVim_statusline_c# %{getcwd()} %#SpaceVim_statusline_c_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# %{SpaceVim#plugins#flygrep#lineNr()} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' '
|
||||
elseif &filetype ==# 'TransientState'
|
||||
return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
return '%#SpaceVim_statusline_ia# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'SpaceVimLog'
|
||||
return '%#SpaceVim_statusline_a# SpaceVim Runtime log %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
return '%#SpaceVim_statusline_ia# SpaceVim Runtime log %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'SpaceVimTomlViewer'
|
||||
return '%#SpaceVim_statusline_a# Toml Json Viewer %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
return '%#SpaceVim_statusline_ia# Toml Json Viewer %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'vimcalc'
|
||||
return '%#SpaceVim_statusline_a#' . s:winnr() . ' VimCalc %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'HelpDescribe'
|
||||
return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'SpaceVimRunner'
|
||||
return '%#SpaceVim_statusline_a# Runner %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{SpaceVim#plugins#runner#status()}'
|
||||
return '%#SpaceVim_statusline_ia# Runner %#SpaceVim_statusline_ia_SpaceVim_statusline_b# %{SpaceVim#plugins#runner#status()}'
|
||||
elseif &filetype ==# 'SpaceVimREPL'
|
||||
return '%#SpaceVim_statusline_a#'
|
||||
return '%#SpaceVim_statusline_ia#'
|
||||
\ . ' REPL '
|
||||
\ . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
\ . s:lsep
|
||||
@ -679,7 +816,7 @@ function! s:inactive() abort
|
||||
let l .= '%{ get(w:, "winwidth", 150) < ' . base . ' ? "" : (" ' . s:STATUSLINE.eval(sec) . ' ' . s:ilsep . '")}'
|
||||
endfor
|
||||
if get(w:, 'winwidth', 150) > base + 10
|
||||
let l .= join(['%=', '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep)
|
||||
let l .= join(['%=', '%{" " . g:_spacevim_statusline_fileformat . " "}', '%{" " . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep)
|
||||
endif
|
||||
return l
|
||||
endfunction
|
||||
@ -726,8 +863,10 @@ function! SpaceVim#layers#core#statusline#def_colors() abort
|
||||
exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
|
||||
exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0]
|
||||
exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[2][2] . ' guibg=' . t[3][0] . ' guifg=' . t[2][0]
|
||||
exe 'hi! SpaceVim_statusline_error ctermbg=' . t[1][2] . ' ctermfg=Black guibg=' . t[1][1] . ' guifg=#fb4934 gui=bold'
|
||||
exe 'hi! SpaceVim_statusline_warn ctermbg=' . t[1][2] . ' ctermfg=Black guibg=' . t[1][1] . ' guifg=#fabd2f gui=bold'
|
||||
exe 'hi! SpaceVim_statusline_error ctermbg=' . t[1][2] . ' ctermfg=Black guibg=' . t[1][1] . ' guifg=#ffc0b9 gui=bold'
|
||||
exe 'hi! SpaceVim_statusline_warn ctermbg=' . t[1][2] . ' ctermfg=Black guibg=' . t[1][1] . ' guifg=#fce094 gui=bold'
|
||||
exe 'hi! SpaceVim_statusline_info ctermbg=' . t[1][2] . ' ctermfg=Black guibg=' . t[1][1] . ' guifg=#8cf8f7 gui=bold'
|
||||
exe 'hi! SpaceVim_statusline_hint ctermbg=' . t[1][2] . ' ctermfg=Black guibg=' . t[1][1] . ' guifg=#a6dbff gui=bold'
|
||||
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')
|
||||
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
|
||||
call s:HI.hi_separator('SpaceVim_statusline_ia', 'SpaceVim_statusline_b')
|
||||
|
@ -22,10 +22,63 @@
|
||||
" enabled by default.
|
||||
"
|
||||
" @subsection Key bindings
|
||||
"
|
||||
" The following two key bindings require neovim v0.10.0+.
|
||||
" >
|
||||
" Key binding Description
|
||||
" Ctrl-Shift-Right Move current tabpage to the right
|
||||
" Ctrl-Shift-Left Move current tabpage to the left
|
||||
" Key binding | Description
|
||||
" ----------------- | -----------------------------------------------
|
||||
" Ctrl-Shift-Right | Move current tabpage to the right
|
||||
" Ctrl-Shift-Left | Move current tabpage to the left
|
||||
" <
|
||||
" @subsection Use Tabline
|
||||
"
|
||||
" Buffers will be listed on the tabline if there is only one tab, each item contains
|
||||
" the index, buffer name and the filetype icon. If there is more than one tab, all
|
||||
" of them will be listed on the tabline. Each item can be quickly accessed by using
|
||||
" `<Leader> number`. Default `<Leader>` is `\`.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | -----------------------------------------------
|
||||
" <Leader> 1 | Jump to index 1 on tabline
|
||||
" <Leader> 2 | Jump to index 2 on tabline
|
||||
" <Leader> 3 | Jump to index 3 on tabline
|
||||
" <Leader> 4 | Jump to index 4 on tabline
|
||||
" <Leader> 5 | Jump to index 5 on tabline
|
||||
" <Leader> 6 | Jump to index 6 on tabline
|
||||
" <Leader> 7 | Jump to index 7 on tabline
|
||||
" <Leader> 8 | Jump to index 8 on tabline
|
||||
" <Leader> 9 | Jump to index 9 on tabline
|
||||
" g r | Switch to alternate tab (switch back and forth)
|
||||
" <
|
||||
" NOTE: `SPC Tab` is the key binding for switching to alternate buffer.
|
||||
" Read [Buffers and Files](#buffers-and-files) section for more info.
|
||||
"
|
||||
" SpaceVim tabline also supports mouse click, the left mouse button will switch to the buffer,
|
||||
" while the middle mouse button will delete the buffer.
|
||||
"
|
||||
" NOTE: This feature is only supported in Neovim with `has('tablineat')`.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ---------------- | --------------------
|
||||
" <Mouse-left> | Switch to the buffer
|
||||
" <Mouse-middle> | Delete the buffer
|
||||
" <
|
||||
" @subsection Tab manager
|
||||
"
|
||||
" You can also use `SPC t t` to open the tab manager window.
|
||||
"
|
||||
" Key bindings within the tab manager window:
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ----------------- | -----------------------------------------
|
||||
" o | Close or expand tab windows.
|
||||
" r | Rename the tab under the cursor.
|
||||
" n | Create new named tab below the cursor tab
|
||||
" N | Create new tab below the cursor tab
|
||||
" x | Delete the tab
|
||||
" Ctrl-Shift-Up | Move tab backward
|
||||
" Ctrl-Shift-Down | Move tab forward
|
||||
" <Enter> | Switch to the window under the cursor.
|
||||
" <
|
||||
|
||||
scriptencoding utf-8
|
||||
@ -36,6 +89,91 @@ endif
|
||||
|
||||
let g:_spacevim_tabline_loaded = 1
|
||||
|
||||
let s:enable_default_mappings = 1
|
||||
|
||||
if has('nvim-0.9.0')
|
||||
function! SpaceVim#layers#core#tabline#get() abort
|
||||
return v:lua.require('spacevim.plugin.tabline').get()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#config() abort
|
||||
lua require('spacevim.plugin.tabline').enable()
|
||||
set tabline=%!v:lua.require('spacevim.plugin.tabline').get()
|
||||
augroup SpaceVim_tabline
|
||||
autocmd!
|
||||
autocmd ColorScheme * lua require('spacevim.plugin.tabline').def_colors()
|
||||
augroup END
|
||||
if s:enable_default_mappings
|
||||
nnoremap <silent> <C-S-Left> <cmd>lua require('spacevim.plugin.tabline').move_to_previous()<CR>
|
||||
nnoremap <silent> <C-S-Right> <cmd>lua require('spacevim.plugin.tabline').move_to_next()<CR>
|
||||
endif
|
||||
let shift_keys = {
|
||||
\ '1': '!',
|
||||
\ '2': '@',
|
||||
\ '3': '#',
|
||||
\ '4': '$',
|
||||
\ '5': '%',
|
||||
\ '6': '^',
|
||||
\ '7': '&',
|
||||
\ '8': '*',
|
||||
\ '9': '(',
|
||||
\ '0': ')'
|
||||
\}
|
||||
|
||||
for i in range(1, 20)
|
||||
let key = i % 10
|
||||
|
||||
if i > 10
|
||||
let key = shift_keys[string(key)]
|
||||
endif
|
||||
|
||||
exe "call SpaceVim#mapping#def('nmap <silent>', '<leader>" . key
|
||||
\ . "', ':call SpaceVim#layers#core#tabline#jump("
|
||||
\ . i . ")<cr>', 'Switch to airline tab " . i
|
||||
\ . "', '', 'tabline index " . i . "')"
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#jump(id, ...) abort
|
||||
call SpaceVim#logger#info(a:id)
|
||||
call SpaceVim#logger#info(string(a:000))
|
||||
lua require('spacevim.plugin.tabline').jump(vim.api.nvim_eval('a:id'))
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#def_colors() abort
|
||||
call v:lua.require('spacevim.plugin.tabline').def_colors()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#health() abort
|
||||
call SpaceVim#layers#core#tabline#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#set_variable(var) abort
|
||||
let s:enable_default_mappings = get(a:var, 'enable_default_mappings', s:enable_default_mappings)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#get_options() abort
|
||||
|
||||
return ['enable_default_mappings']
|
||||
|
||||
endfunction
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
" loadding APIs {{{
|
||||
let s:MESSLETTERS = SpaceVim#api#import('messletters')
|
||||
let s:FILE = SpaceVim#api#import('file')
|
||||
@ -69,7 +207,6 @@ let [s:lsep , s:rsep] = ['', '']
|
||||
|
||||
let [s:ilsep , s:irsep] = ['', '']
|
||||
|
||||
let s:enable_default_mappings = 1
|
||||
|
||||
function! s:get_no_empty(a, b) abort
|
||||
if empty(a:a)
|
||||
@ -513,18 +650,18 @@ function! SpaceVim#layers#core#tabline#get() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#config() abort
|
||||
let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
|
||||
let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_iseparator, s:separators['arrow'])
|
||||
set tabline=%!SpaceVim#layers#core#tabline#get()
|
||||
augroup SpaceVim_tabline
|
||||
autocmd!
|
||||
autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors()
|
||||
augroup END
|
||||
let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
|
||||
let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_iseparator, s:separators['arrow'])
|
||||
set tabline=%!SpaceVim#layers#core#tabline#get()
|
||||
augroup SpaceVim_tabline
|
||||
autocmd!
|
||||
autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors()
|
||||
augroup END
|
||||
|
||||
if s:enable_default_mappings
|
||||
nnoremap <silent> <C-S-Left> :call <SID>move_tabpage(-1)<CR>
|
||||
nnoremap <silent> <C-S-Right> :call <SID>move_tabpage(1)<CR>
|
||||
endif
|
||||
if s:enable_default_mappings
|
||||
nnoremap <silent> <C-S-Left> :call <SID>move_tabpage(-1)<CR>
|
||||
nnoremap <silent> <C-S-Right> :call <SID>move_tabpage(1)<CR>
|
||||
endif
|
||||
|
||||
let shift_keys = {
|
||||
\ '1': '!',
|
||||
@ -554,6 +691,8 @@ function! SpaceVim#layers#core#tabline#config() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#jump(id, ...) abort
|
||||
call SpaceVim#logger#info(a:id)
|
||||
call SpaceVim#logger#info(string(a:000))
|
||||
if len(s:shown_items) >= a:id
|
||||
let item = s:shown_items[a:id - 1]
|
||||
let mouse = get(a:000, 1, '')
|
||||
@ -611,6 +750,18 @@ function! SpaceVim#layers#core#tabline#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#set_variable(var) abort
|
||||
let s:enable_default_mappings = get(a:var, 'enable_default_mappings', s:enable_default_mappings)
|
||||
endfunction
|
||||
|
@ -99,7 +99,6 @@ endfunction
|
||||
|
||||
function! SpaceVim#layers#edit#plugins() abort
|
||||
let plugins = [
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-surround'],
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-repeat'],
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-emoji'],
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-grammarous', {'merged' : 0}],
|
||||
@ -115,8 +114,13 @@ function! SpaceVim#layers#edit#plugins() abort
|
||||
\ [g:_spacevim_root_dir . 'bundle/tabular', { 'merged' : 0}],
|
||||
\ ['andrewradev/splitjoin.vim',{ 'on_cmd':['SplitjoinJoin', 'SplitjoinSplit'],'merged' : 0, 'loadconf' : 1}],
|
||||
\ ]
|
||||
if has('nvim-0.8.0')
|
||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/nvim-surround', { 'merged' : 0, 'loadconf' : 1, 'on_event' : ['BufReadPost']}])
|
||||
else
|
||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/vim-surround', { 'merged' : 0, 'loadconf' : 1}])
|
||||
endif
|
||||
if has('nvim-0.6.0') && s:enable_hop
|
||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/hop.nvim', { 'merged' : 0, 'loadconf' : 1}])
|
||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/hop.nvim', { 'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['HopChar1', 'HopChar2', 'HopWord', 'HopLine']}])
|
||||
else
|
||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/vim-easymotion', { 'merged' : 0}])
|
||||
call add(plugins,[g:_spacevim_root_dir . 'bundle/vim-easyoperator-line', { 'merged' : 0}])
|
||||
@ -217,7 +221,6 @@ function! SpaceVim#layers#edit#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '¦'], 'Tabularize /¦', 'align-region-at-¦', 1, 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '<Bar>'], 'Tabularize /[||]', 'align-region-at-|', 1, 1)
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'a', '[SPC]'], 'Tabularize /\s\ze\S/l0', 'align-region-at-space', 1, 1)
|
||||
" @fixme SPC x a SPC make vim flick
|
||||
nmap <Space>xa<Space> [SPC]xa[SPC]
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', 'r'], 'call call('
|
||||
\ . string(s:_function('s:align_at_regular_expression')) . ', [])',
|
||||
@ -271,6 +274,11 @@ function! SpaceVim#layers#edit#config() abort
|
||||
call SpaceVim#mapping#space#def('nmap' , ['x' , 'U'] , '<Plug>Uppercase' , 'uppercase-text' , 0, 1)
|
||||
call SpaceVim#mapping#space#def('nmap' , ['x' , '~'] , '<Plug>ToggleCase' , 'toggle-case-text' , 0, 1)
|
||||
|
||||
" 定义 SpaceVim 键映射
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'H'], '<Plug>ConvertToFullWidth', 'convert to fullWidth', 0, 1)
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'h'], '<Plug>ConvertToHalfWidth', 'convert to halfWidth', 0, 1)
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'W'], '<Plug>ToggleFullHalfWidth', 'toggle fullWidth and halfWidth', 0, 1)
|
||||
|
||||
" word
|
||||
let g:_spacevim_mappings_space.x.w = {'name' : '+Word'}
|
||||
call SpaceVim#mapping#space#def('vnoremap', ['x', 'w', 'c'], 'normal! ' . ":'<,'>s/\\\w\\+//gn" . "\<cr>", 'count the words in the select region', 1)
|
||||
@ -993,6 +1001,77 @@ function! s:parse(line) abort
|
||||
return s:VIM.parse_string(a:line)
|
||||
endfunction
|
||||
|
||||
" 为插件定义普通模式和视觉模式映射
|
||||
nnoremap <silent> <Plug>ConvertToFullWidth :call <sid>ConvertFullHalfWidth('normal', 'fullWidth')<cr>
|
||||
vnoremap <silent> <Plug>ConvertToFullWidth :call <sid>ConvertFullHalfWidth('visual', 'fullWidth')<cr>
|
||||
|
||||
nnoremap <silent> <Plug>ConvertToHalfWidth :call <sid>ConvertFullHalfWidth('normal', 'halfWidth')<cr>
|
||||
vnoremap <silent> <Plug>ConvertToHalfWidth :call <sid>ConvertFullHalfWidth('visual', 'halfWidth')<cr>
|
||||
|
||||
nnoremap <silent> <Plug>ToggleFullHalfWidth :call <sid>ConvertFullHalfWidth('normal', 'toggleWidth')<cr>
|
||||
vnoremap <silent> <Plug>ToggleFullHalfWidth :call <sid>ConvertFullHalfWidth('visual', 'toggleWidth')<cr>
|
||||
|
||||
" 定义转换函数
|
||||
function! s:ConvertFullHalfWidth(mode, widthType) abort
|
||||
let save_cursor = getcurpos()
|
||||
let save_register = getreg("k")
|
||||
if a:mode == 'normal'
|
||||
let cword = expand('<cword>')
|
||||
if !empty(cword)
|
||||
let rst = FullHalfWidthTranslator#Translate(cword, a:widthType)
|
||||
if rst != cword
|
||||
let @k = rst
|
||||
normal! viw"kp
|
||||
endif
|
||||
endif
|
||||
elseif a:mode == 'visual'
|
||||
normal! gv
|
||||
if mode() == "\<C-V>" " 块选择模式
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
if column_end < column_start
|
||||
let [column_start, column_end] = [column_end, column_start]
|
||||
endif
|
||||
for line_num in range(line_start, line_end)
|
||||
let line = getline(line_num)
|
||||
" 将行文本转换为UTF-8编码
|
||||
let line_utf8 = iconv(line, &encoding, 'UTF-8')
|
||||
let selectedText = line_utf8[column_start - 1: column_end - 1]
|
||||
let translatedText = FullHalfWidthTranslator#Translate(selectedText, a:widthType)
|
||||
let newLine = line[:column_start - 2] . translatedText . line[column_end:]
|
||||
call setline(line_num, newLine)
|
||||
endfor
|
||||
else
|
||||
" 对其他模式的处理
|
||||
if mode() == 'line'
|
||||
normal! '[V']
|
||||
elseif mode() == 'char'
|
||||
normal! `[v`]
|
||||
elseif mode() ==? 'v'
|
||||
normal! gv
|
||||
else
|
||||
normal! '[v']
|
||||
endif
|
||||
" 行选择或字符选择模式的处理
|
||||
normal! "ky
|
||||
let selectedText = @k
|
||||
let translatedText = FullHalfWidthTranslator#Translate(selectedText, a:widthType)
|
||||
if translatedText != selectedText
|
||||
call setreg('k', translatedText)
|
||||
normal! gv"kp
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
call setpos('.', save_cursor)
|
||||
call setreg("k", save_register)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#edit#add_ft_head_tamplate(ft, tamp) abort
|
||||
call extend(s:ft_head_tp, {a:ft : a:tamp})
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#edit#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -40,6 +40,30 @@ function! SpaceVim#layers#foldsearch#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#foldsearch#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#foldsearch#set_variable(var) abort
|
||||
|
||||
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#foldsearch#get_options() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#foldsearch#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
let s:filename = expand('<sfile>:~')
|
||||
let s:lnum = expand('<slnum>') + 2
|
||||
function! SpaceVim#layers#foldsearch#config()
|
||||
|
@ -16,8 +16,12 @@
|
||||
"
|
||||
" 1. `format_on_save`: disabled by default.
|
||||
" 2. `format_method`: set the format plugin, default plugin is `neoformat`.
|
||||
" You can also use `vim-codefmt`.
|
||||
" You can also use `vim-codefmt` or `format.nvim`, `format.nvim` requires
|
||||
" neovim 0.9.0+.
|
||||
" 3. `silent_format`: Runs the formatter without any messages.
|
||||
" 4. `format_notify_width`: set the neoformat notify window width.
|
||||
" 5. `format_notify_timeout`: set the neoformat notify clear timeout. default
|
||||
" is 5000 milliseconds.
|
||||
"
|
||||
" @subsection key bindings
|
||||
" >
|
||||
@ -33,6 +37,8 @@ else
|
||||
let s:format_on_save = 0
|
||||
let s:silent_format = 0
|
||||
let s:format_ft = []
|
||||
let s:format_notify_timeout = 5000
|
||||
let s:format_notify_width = &columns * 0.50
|
||||
endif
|
||||
|
||||
function! SpaceVim#layers#format#health() abort
|
||||
@ -52,6 +58,10 @@ function! SpaceVim#layers#format#plugins() abort
|
||||
\ ['google/vim-glaive', {'merged' : 0, 'loadconf' : 1}],
|
||||
\ ['google/vim-codefmt', {'merged' : 0}],
|
||||
\ ]
|
||||
elseif s:format_method ==# 'format.nvim'
|
||||
return [
|
||||
\ [g:_spacevim_root_dir . 'bundle/format.nvim', {'merged' : 0, 'loadconf' : 1, 'loadconf_before' : 1}],
|
||||
\ ]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -61,6 +71,8 @@ function! SpaceVim#layers#format#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'Neoformat', 'format-code', 1)
|
||||
elseif s:format_method ==# 'codefmt'
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'FormatCode', 'format-code', 1)
|
||||
elseif s:format_method ==# 'format.nvim'
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'Format', 'format-code', 1)
|
||||
endif
|
||||
augroup spacevim_layer_format
|
||||
autocmd!
|
||||
@ -73,9 +85,24 @@ function! SpaceVim#layers#format#config() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#format#set_variable(var) abort
|
||||
let s:format_method = get(a:var, 'format_method', s:format_method)
|
||||
if has_key(a:var, 'format_method') && a:var.format_method ==# 'format.nvim' && !has('nvim-0.9.0')
|
||||
call SpaceVim#logger#info('format.nvim requires neovim 0.9.0+')
|
||||
else
|
||||
let s:format_method = get(a:var, 'format_method', s:format_method)
|
||||
endif
|
||||
let s:format_on_save = get(a:var, 'format_on_save', s:format_on_save)
|
||||
let s:silent_format = get(a:var, 'silent_format', s:silent_format)
|
||||
let s:format_notify_width = get(a:var, 'format_notify_width', s:format_notify_width)
|
||||
let s:format_notify_timeout = get(a:var, 'format_notify_timeout', s:format_notify_timeout)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#format#get_format_option() abort
|
||||
|
||||
return {
|
||||
\ 'format_notify_width' : s:format_notify_width,
|
||||
\ 'format_notify_timeout' : s:format_notify_timeout,
|
||||
\ }
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#format#get_options() abort
|
||||
@ -102,6 +129,14 @@ function! s:format() abort
|
||||
undojoin | Neoformat
|
||||
elseif s:format_method ==# 'codefmt'
|
||||
undojoin | FormatCode
|
||||
elseif s:format_method ==# 'format.nvim'
|
||||
undojoin | Format
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#format#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -47,6 +47,11 @@
|
||||
" SPC g h r undo cursor hunk
|
||||
" SPC g h v preview cursor hunk
|
||||
" <
|
||||
" @subsection commit omni function
|
||||
" This layer also provides an omnifunc for git commit messages. It supports:
|
||||
" 1. complete commit title, `fix:`, `doc:` etc.
|
||||
" 2. complete github issue list
|
||||
" 3. complete co-author info
|
||||
|
||||
|
||||
if exists('s:git_plugin')
|
||||
@ -60,7 +65,7 @@ let s:git_plugin = 'git'
|
||||
function! SpaceVim#layers#git#plugins() abort
|
||||
let plugins = [
|
||||
\ ]
|
||||
call add(plugins, ['airblade/vim-gitgutter', { 'merged' : 0}])
|
||||
call add(plugins, ['airblade/vim-gitgutter', { 'merged' : 0, 'on_event' : ['BufReadPost']}])
|
||||
if s:git_plugin ==# 'gina'
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/gina.vim', { 'merged' : 0}])
|
||||
elseif s:git_plugin ==# 'fugitive'
|
||||
@ -69,7 +74,7 @@ function! SpaceVim#layers#git#plugins() abort
|
||||
elseif s:git_plugin ==# 'gita'
|
||||
call add(plugins, ['lambdalisue/vim-gita', { 'on_cmd' : 'Gita'}])
|
||||
else
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/git.vim', { 'merged' : 0}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/git.vim', { 'merged' : 0, 'on_event' : 'Git', 'on_func' : 'git#branch#current'}])
|
||||
endif
|
||||
return plugins
|
||||
endfunction
|
||||
@ -129,6 +134,7 @@ function! SpaceVim#layers#git#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['g', 'V'], 'Git log %', 'git-log-of-current-file', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['g', 'v'], 'Git log', 'git-log-of-current-repo', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['g', 'm'], 'Git branch', 'branch-manager', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['g', 'r'], 'Git remote', 'remote-manager', 1)
|
||||
endif
|
||||
augroup spacevim_layer_git
|
||||
autocmd!
|
||||
@ -188,4 +194,10 @@ function! SpaceVim#layers#git#health() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#git#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -37,16 +37,16 @@ function! SpaceVim#layers#github#plugins() abort
|
||||
return [
|
||||
\ [g:_spacevim_root_dir . 'bundle/github-issues.vim', {'merged' : 0, 'if' : has('python')}],
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-github-dashboard', {
|
||||
\ 'merged' : 0,
|
||||
\ 'if' : has('ruby'),
|
||||
\ }],
|
||||
\ ['tyru/open-browser-github.vim', {
|
||||
\ 'depends': 'open-browser.vim',
|
||||
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
|
||||
\ }],
|
||||
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
|
||||
\ ['lambdalisue/vim-gista', {'merged' : 0}],
|
||||
\ ]
|
||||
\ 'merged' : 0,
|
||||
\ 'if' : has('ruby'),
|
||||
\ }],
|
||||
\ ['tyru/open-browser-github.vim', {
|
||||
\ 'depends': 'open-browser.vim',
|
||||
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
|
||||
\ }],
|
||||
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
|
||||
\ ['lambdalisue/vim-gista', {'merged' : 0}],
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#github#config() abort
|
||||
@ -127,4 +127,15 @@ function! s:update_stared_repo_list() abort
|
||||
call add(g:unite_source_menu_menus.MyStarredrepos.command_candidates, [description,cmd])
|
||||
endfor
|
||||
return 1
|
||||
endf
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#github#set_variable(var) abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#github#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -45,7 +45,11 @@ let g:gtags_open_list = 2
|
||||
|
||||
function! SpaceVim#layers#gtags#plugins() abort
|
||||
return [
|
||||
\ [g:_spacevim_root_dir . 'bundle/gtags.vim', { 'merged' : 0}]
|
||||
\ [g:_spacevim_root_dir . 'bundle/gtags.vim',
|
||||
\ { 'merged' : 0,
|
||||
\ 'on_cmd' : ['Gtags', 'GtagsGenerate'],
|
||||
\ 'on_func' : ['gtags#update', 'ctags#update'],
|
||||
\ }]
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
@ -58,6 +62,7 @@ function! SpaceVim#layers#gtags#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'r'], 'exe "Gtags -r " . expand("<cword>")', 'find-references', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 's'], 'exe "Gtags -s " . expand("<cword>")', 'find-cursor-symbol', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'g'], 'exe "Gtags -g " . expand("<cword>")', 'find-cursor-string', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'j'], 'exe "Gtags -d " . input("Jump to the symbol: ")', 'Input a symbol and find the definitions', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'f'], 'Gtags -f %', 'list of objects', 1)
|
||||
let g:gtags_gtagslabel = s:gtagslabel
|
||||
call SpaceVim#plugins#projectmanager#reg_callback(function('s:update_ctags_option'))
|
||||
@ -109,6 +114,12 @@ function! SpaceVim#layers#gtags#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#gtags#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#gtags#get_options() abort
|
||||
|
||||
return ['gtagslabel', 'ctags_bin']
|
||||
|
@ -524,3 +524,9 @@ function! SpaceVim#layers#lang#c#health() abort
|
||||
call SpaceVim#layers#lang#c#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#c#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -167,3 +167,9 @@ function! SpaceVim#layers#lang#clojure#health() abort
|
||||
call SpaceVim#layers#lang#clojure#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#clojure#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -15,10 +15,34 @@
|
||||
" [[layers]]
|
||||
" name = 'go'
|
||||
" <
|
||||
" @subsection Language server
|
||||
"
|
||||
" There are two ways to setup the golang language server protocol.
|
||||
"
|
||||
" neovim(`>=0.5.0`)
|
||||
"
|
||||
" If you are using `nvim(>=0.5.0)`. You need to use `enabled_clients` option of `lsp` layer to specific the language servers.
|
||||
" for example:
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'lsp'
|
||||
" enabled_clients = ['gopls']
|
||||
" <
|
||||
" vim or neovim(`<0.5.0`)
|
||||
"
|
||||
" To enable language server protocol support, you may need to enable lsp layer.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = "lsp"
|
||||
" filetypes = [
|
||||
" "go"
|
||||
" ]
|
||||
" <
|
||||
" @subsection layer options
|
||||
"
|
||||
" 1. `enabled_linters`: set a list of enabled lint for golang. by default this
|
||||
" option is `['golint']`. The available linters includes: `go`,
|
||||
" `gometalinter`
|
||||
" option is `['golangci_lint']`. The available linters includes: `go`,
|
||||
" `gometalinter`, etc.
|
||||
" 2. go_file_head: the default file head for golang source code.
|
||||
" >
|
||||
" [[layers]]
|
||||
@ -89,7 +113,7 @@ if exists('s:enabled_linters')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:enabled_linters = ['golint']
|
||||
let s:enabled_linters = ['golangci_lint']
|
||||
let s:format_on_save = 0
|
||||
let s:go_file_head = [
|
||||
\ '// @Title',
|
||||
|
@ -393,3 +393,9 @@ function! SpaceVim#layers#lang#java#health() abort
|
||||
call SpaceVim#layers#lang#java#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#java#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -30,8 +30,6 @@
|
||||
" 3. enable_json5: Enable/Disable json5 support. Enabled by default.
|
||||
|
||||
if exists('s:conceal')
|
||||
" @bug s:conceal always return 0
|
||||
"
|
||||
" because this script will be loaded twice. This is the feature of vim,
|
||||
" when call an autoload func, vim will try to load the script again
|
||||
finish
|
||||
|
@ -15,6 +15,10 @@
|
||||
" [[layers]]
|
||||
" name = 'lang#kotlin'
|
||||
" <
|
||||
" If you want to use lsp layer for kotlin, you need to install the
|
||||
" kotlin_language_server.
|
||||
"
|
||||
" https://github.com/fwcd/kotlin-language-server
|
||||
"
|
||||
" @subsection Key bindings
|
||||
" >
|
||||
@ -32,6 +36,20 @@
|
||||
" SPC l s l send current line
|
||||
" SPC l s s send selection text
|
||||
" <
|
||||
" If the lsp layer is enabled for kotlin, the following key bindings can
|
||||
" be used:
|
||||
" >
|
||||
" key binding Description
|
||||
" g D jump to type definition
|
||||
" SPC l e rename symbol
|
||||
" SPC l x show references
|
||||
" SPC l h show line diagnostics
|
||||
" SPC l d show document
|
||||
" K show document
|
||||
" SPC l w l list workspace folder
|
||||
" SPC l w a add workspace folder
|
||||
" SPC l w r remove workspace folder
|
||||
" <
|
||||
"
|
||||
|
||||
|
||||
@ -93,12 +111,25 @@ endfunction
|
||||
|
||||
function! s:language_specified_mappings() abort
|
||||
if SpaceVim#layers#lsp#check_filetype('kotlin')
|
||||
\ || SpaceVim#layers#lsp#check_server('kotlin_language_server')
|
||||
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
||||
nnoremap <silent><buffer> gD :<C-u>call SpaceVim#lsp#go_to_typedef()<Cr>
|
||||
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
||||
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
|
||||
\ 'call SpaceVim#lsp#show_doc()', 'show-document', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'x'],
|
||||
\ 'call SpaceVim#lsp#references()', 'show-references', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
|
||||
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
|
||||
\ 'call SpaceVim#lsp#rename()', 'rename-symbol', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'h'],
|
||||
\ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1)
|
||||
let g:_spacevim_mappings_space.l.w = {'name' : '+Workspace'}
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'l'],
|
||||
\ 'call SpaceVim#lsp#list_workspace_folder()', 'list-workspace-folder', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'a'],
|
||||
\ 'call SpaceVim#lsp#add_workspace_folder()', 'add-workspace-folder', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'r'],
|
||||
\ 'call SpaceVim#lsp#remove_workspace_folder()', 'remove-workspace-folder', 1)
|
||||
endif
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
|
||||
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
|
||||
|
@ -174,3 +174,9 @@ function! SpaceVim#layers#lang#lua#health() abort
|
||||
call SpaceVim#layers#lang#lua#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#lua#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -20,7 +20,7 @@
|
||||
"
|
||||
" The following layer options are supported in this layer:
|
||||
"
|
||||
" 1. `enabled_formater`: Set the enabled formater, by default it is
|
||||
" 1. `enabled_formatters`: Set the enabled formatters, by default it is
|
||||
" `['remark']`. To use `prettier`, you need to install `prettier` via:
|
||||
" >
|
||||
" npm install --global prettier
|
||||
@ -36,7 +36,7 @@
|
||||
" name = 'lang#markdown'
|
||||
" enableWcwidth = 1
|
||||
" listItemIndent = 1
|
||||
" enabled_formater = ['prettier']
|
||||
" enabled_formatters = ['prettier']
|
||||
" <
|
||||
" @subsection key bindings
|
||||
"
|
||||
@ -58,12 +58,13 @@ let s:md_listItemIndent = 1
|
||||
let s:md_enableWcwidth = 0
|
||||
let s:md_listItemChar = '-'
|
||||
let g:vmt_list_indent_text = ' '
|
||||
let s:md_enabled_formater = ['remark']
|
||||
let s:md_enabled_formatters = ['remark']
|
||||
function! SpaceVim#layers#lang#markdown#set_variable(var) abort
|
||||
let s:md_listItemIndent = get(a:var, 'listItemIndent', s:md_listItemIndent)
|
||||
let s:md_enableWcwidth = get(a:var, 'enableWcwidth', s:md_enableWcwidth)
|
||||
let s:md_listItemChar = get(a:var, 'listItemChar', s:md_listItemChar)
|
||||
let s:md_enabled_formater = get(a:var, 'enabled_formater', s:md_enabled_formater)
|
||||
" old option name is enabled_formater, just keep backword compatibility
|
||||
let s:md_enabled_formatters = get(a:var, 'enabled_formatters', get(a:var, 'enabled_formater', s:md_enabled_formatters))
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#markdown#plugins() abort
|
||||
@ -115,7 +116,7 @@ function! SpaceVim#layers#lang#markdown#config() abort
|
||||
\},
|
||||
\}
|
||||
let remarkrc = s:generate_remarkrc()
|
||||
let g:neoformat_enabled_markdown = s:md_enabled_formater
|
||||
let g:neoformat_enabled_markdown = s:md_enabled_formatters
|
||||
let g:neoformat_markdown_remark = {
|
||||
\ 'exe': 'remark',
|
||||
\ 'args': ['--no-color', '--silent'] + (empty(remarkrc) ? [] : ['-r', remarkrc]),
|
||||
@ -224,3 +225,9 @@ function! SpaceVim#layers#lang#markdown#health() abort
|
||||
call SpaceVim#layers#lang#markdown#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#markdown#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -6,6 +6,37 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section lang#powershell, layers-lang-powershell
|
||||
" @parentsection layers
|
||||
" This layer is for powershell development, disabled by default, to enable this
|
||||
" layer, add following snippet to your SpaceVim configuration file.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'lang#powershell'
|
||||
" <
|
||||
"
|
||||
" @subsection Layer Options
|
||||
" 1. `enabled_formatters`: set the default formatters of powershell, default is
|
||||
" `['PowerShellBeautifier']`. you can also add `PSScriptAnalyzer` into the list.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'lang#powershell'
|
||||
" enabled_formatters = ['PowerShellBeautifier']
|
||||
" <
|
||||
"
|
||||
" @subsection Key bindings
|
||||
" >
|
||||
" Mode Key Function
|
||||
" ---------------------------------------------
|
||||
" normal SPC l r run current file
|
||||
" <
|
||||
|
||||
if exists('s:enabled_formatters')
|
||||
finish
|
||||
else
|
||||
let s:enabled_formatters = ['']
|
||||
endif
|
||||
|
||||
function! SpaceVim#layers#lang#powershell#plugins() abort
|
||||
let plugins = []
|
||||
@ -18,6 +49,11 @@ function! SpaceVim#layers#lang#powershell#config() abort
|
||||
call SpaceVim#plugins#repl#reg('powershell', 'powershell -NoLogo -NoProfile -NonInteractive')
|
||||
call SpaceVim#plugins#runner#reg_runner('powershell', 'powershell %s')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('powershell', function('s:language_specified_mappings'))
|
||||
let g:neoformat_enabled_powershell = s:enabled_formatters
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#powershell#set_variable(opt) abort
|
||||
let s:enabled_formatters = get(a:opt, 'enabled_formatters', s:enabled_formatters)
|
||||
endfunction
|
||||
|
||||
function! s:language_specified_mappings() abort
|
||||
|
@ -126,11 +126,11 @@ function! SpaceVim#layers#lang#python#plugins() abort
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-pythonsense',
|
||||
\ { 'on_ft' : 'python'}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/coveragepy.vim',
|
||||
\ { 'merged' : 0}])
|
||||
\ { 'merged' : 0, 'on_ft' : 'python'}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/python-imports.vim',
|
||||
\ { 'merged' : 0}])
|
||||
\ { 'merged' : 0, 'on_ft' : 'python'}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-virtualenv',
|
||||
\ { 'merged' : 0}])
|
||||
\ { 'merged' : 0, 'on_ft' : 'python'}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
@ -282,6 +282,9 @@ endfunction
|
||||
|
||||
function! s:Shebang_to_cmd(line) abort
|
||||
let executable = matchstr(a:line, '#!\s*\zs[^ ]*')
|
||||
if empty(executable)
|
||||
return []
|
||||
endif
|
||||
let argvs = split(matchstr(a:line, '#!\s*[^ ]\+\s*\zs.*'))
|
||||
return [executable] + argvs
|
||||
endfunction
|
||||
@ -289,7 +292,14 @@ endfunction
|
||||
func! s:getexe() abort
|
||||
let line = getline(1)
|
||||
if line =~# '^#!'
|
||||
return s:Shebang_to_cmd(line)
|
||||
let cmd = s:Shebang_to_cmd(line)
|
||||
if empty(cmd)
|
||||
call SpaceVim#logger#debug('failed to parse shebang')
|
||||
elseif !executable(cmd[0])
|
||||
call SpaceVim#logger#debug('shebang is not executable')
|
||||
else
|
||||
return cmd
|
||||
endif
|
||||
endif
|
||||
return [s:python_interpreter]
|
||||
endf
|
||||
@ -334,3 +344,8 @@ function! SpaceVim#layers#lang#python#health() abort
|
||||
call SpaceVim#layers#lang#python#config()
|
||||
return 1
|
||||
endfunction
|
||||
function! SpaceVim#layers#lang#python#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -101,7 +101,7 @@ endif
|
||||
|
||||
function! SpaceVim#layers#lang#ruby#plugins() abort
|
||||
return [
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-ruby', {'merged' : 0}]
|
||||
\ [g:_spacevim_root_dir . 'bundle/vim-ruby', {'merged' : 0, 'on_ft' : ['ruby']}]
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
|
@ -165,7 +165,12 @@ function! SpaceVim#layers#lang#scala#config() abort
|
||||
autocmd BufRead,BufNewFile *.sbt set filetype=scala
|
||||
augroup END
|
||||
|
||||
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
|
||||
try
|
||||
|
||||
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
|
||||
catch
|
||||
let g:neoformat_enabled_scala = []
|
||||
endtry
|
||||
let g:neoformat_scala_scalariform = {
|
||||
\ 'exe': 'java',
|
||||
\ 'args': ['-jar', s:scalariform_jar, '-'],
|
||||
|
@ -48,6 +48,13 @@ endif
|
||||
" <
|
||||
"
|
||||
|
||||
function! SpaceVim#layers#lang#scheme#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#lang#scheme#config() abort
|
||||
if s:scheme_dialect ==# 'mit-scheme'
|
||||
if has('win32')
|
||||
@ -106,3 +113,9 @@ function! SpaceVim#layers#lang#scheme#health() abort
|
||||
call SpaceVim#layers#lang#scheme#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#scheme#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -92,3 +92,9 @@ function! SpaceVim#layers#lang#sh#health() abort
|
||||
call SpaceVim#layers#lang#sh#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#sh#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -6,13 +6,85 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section lang#sql, layers-lang-sql
|
||||
" @parentsection layers
|
||||
" This layer is for sql development, disabled by default, to enable this
|
||||
" layer, add following snippet to your @section(options) file.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'lang#sql'
|
||||
" <
|
||||
"
|
||||
" @subsection Options
|
||||
"
|
||||
" 1. `enabled_formatters`: set the default formatters for sql, default is ['sqlfmtorg']
|
||||
" https://github.com/sql-formatter-org/sql-formatter
|
||||
" you can also use `sqlformat` which is from https://github.com/andialbrecht/sqlparse
|
||||
" 2. `sql_formatter_command`: Set the command of sql-formatter.
|
||||
" 3. `sql_dialect`: set the SQL dialect, default is basic sql.
|
||||
" 4. `sql_formatter_config`: set the path of config path. default is empty
|
||||
" string.
|
||||
" 5. `sqlformat_cmd`: set the command for sqlformat.
|
||||
" 6. `sqlformat_output_encode`: set the output encoding of sqlformat, default
|
||||
" is `utf-8`. If you are using window, maybe need to change this option to
|
||||
" `cp936`.
|
||||
"
|
||||
"
|
||||
|
||||
if exists('s:enabled_formatters')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:enabled_formatters = ['sqlfmtorg']
|
||||
let s:sql_formatter_command = 'sql-formatter'
|
||||
let s:sql_dialect = 'sql'
|
||||
let s:sql_formatter_config = ''
|
||||
let s:sqlformat_cmd = 'sqlformat'
|
||||
let s:sqlformat_output_encode = 'utf-8'
|
||||
|
||||
function! SpaceVim#layers#lang#sql#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['tpope/vim-dadbod', {'merged' : 0}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#sql#set_variable(opt) abort
|
||||
" keep compatibility with enabled_formater
|
||||
let s:enabled_formatters = get(a:opt, 'enabled_formatters', get(a:opt, 'enabled_formater', s:enabled_formatters))
|
||||
let s:sql_formatter_command = get(a:opt, 'sql_formatter_command', s:sql_formatter_command)
|
||||
let s:sql_dialect = get(a:opt, 'sql_dialect', s:sql_dialect)
|
||||
let s:sql_formatter_config = get(a:opt, 'sql_formatter_config', s:sql_formatter_config)
|
||||
let s:sqlformat_cmd = get(a:opt, 'sqlformat_cmd', s:sqlformat_cmd)
|
||||
let s:sqlformat_output_encode = get(a:opt, 'sqlformat_output_encode', s:sqlformat_output_encode)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#sql#config() abort
|
||||
|
||||
let g:neoformat_enabled_sql = s:enabled_formatters
|
||||
let argv = []
|
||||
if !empty(s:sql_formatter_config)
|
||||
let argv = ['-c', s:sql_formatter_config]
|
||||
endif
|
||||
let g:neoformat_sql_sqlfmtorg = {
|
||||
\ 'exe': s:sql_formatter_command,
|
||||
\ 'args': ['-l', s:sql_dialect,] + argv,
|
||||
\ 'stdin': 1,
|
||||
\ }
|
||||
let g:neoformat_sql_sqlformat = {
|
||||
\ 'exe': s:sqlformat_cmd,
|
||||
\ 'args': ['--reindent', '-'],
|
||||
\ 'output_encode': s:sqlformat_output_encode,
|
||||
\ 'stdin': 1,
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#sql#health() abort
|
||||
call SpaceVim#layers#lang#sql#plugins()
|
||||
return 1
|
||||
endfunction
|
||||
function! SpaceVim#layers#lang#sql#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -33,3 +33,15 @@ function! SpaceVim#layers#lang#toml#health() abort
|
||||
call SpaceVim#layers#lang#toml#plugins()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#toml#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#toml#set_variable(var) abort
|
||||
|
||||
|
||||
|
||||
endfunction
|
||||
|
@ -218,3 +218,9 @@ function! SpaceVim#layers#lang#vim#health() abort
|
||||
call SpaceVim#layers#lang#vim#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#vim#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -39,6 +39,10 @@ endif
|
||||
" ---------------------------------------------------
|
||||
" vimls vim-language-server
|
||||
" <
|
||||
" @subsection User autocmd
|
||||
"
|
||||
" 1. SpaceVimLspSetup: This User autocmd will be triggered after lsp setup
|
||||
" function.
|
||||
|
||||
let s:NVIM_VERSION = SpaceVim#api#import('neovim#version')
|
||||
let s:FILE = SpaceVim#api#import('file')
|
||||
@ -52,18 +56,25 @@ function! SpaceVim#layers#lsp#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lsp#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#lsp#setup() abort
|
||||
lua require("spacevim.lsp").setup(
|
||||
\ require("spacevim").eval("s:enabled_clients"),
|
||||
\ require("spacevim").eval("s:override_client_cmds")
|
||||
\ )
|
||||
doautocmd User SpaceVimLspSetup
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lsp#plugins() abort
|
||||
let plugins = []
|
||||
if has('nvim-0.9.1')
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-lspconfig-latest', {'merged' : 0, 'loadconf' : 1}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-lspconfig-latest', {'merged' : 0, 'loadconf' : 1, 'on_event' : ['BufReadPost']}])
|
||||
if g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/deoplete-lsp', {'merged' : 0}])
|
||||
elseif g:spacevim_autocomplete_method ==# 'nvim-cmp'
|
||||
@ -89,7 +100,9 @@ function! SpaceVim#layers#lsp#plugins() abort
|
||||
\ 'merged' : 0,
|
||||
\ }])
|
||||
endif
|
||||
elseif s:use_nvim_lsp
|
||||
" this is the laste commit support nvim-0.5.0
|
||||
" https://github.com/neovim/nvim-lspconfig/tree/4569e14e59bed1d18a91db76fe3261628f60e3f0
|
||||
elseif has('nvim-0.5.0')
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-lspconfig', {'merged' : 0, 'loadconf' : 1}])
|
||||
if g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/deoplete-lsp', {'merged' : 0}])
|
||||
|
@ -304,3 +304,9 @@ function! SpaceVim#layers#shell#health() abort
|
||||
call SpaceVim#layers#shell#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#shell#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -45,7 +45,13 @@ endfunction
|
||||
|
||||
function! SpaceVim#layers#telescope#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim', {'merged' : 0, 'loadconf' : 1}])
|
||||
if has('nvim-0.10.0')
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.8', {'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['Telescope']}])
|
||||
elseif has('nvim-0.7.2')
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.5', {'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['Telescope']}])
|
||||
elseif has('nvim-0.7.0')
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.2', {'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['Telescope']}])
|
||||
endif
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/plenary.nvim', {'merged' : 0}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope-menu', {'merged' : 0}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope-ctags-outline.nvim', {'merged' : 0}])
|
||||
@ -66,24 +72,24 @@ function! SpaceVim#layers#telescope#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['?'], 'Telescope menu menu=CustomKeyMaps default_text=[SPC]',
|
||||
\ ['show-mappings',
|
||||
\ [
|
||||
\ 'SPC ? is to show mappings',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ 'SPC ? is to show mappings',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'call call('
|
||||
\ . string(s:_function('s:get_help')) . ', ["SpaceVim"])',
|
||||
\ ['find-SpaceVim-help',
|
||||
\ [
|
||||
\ 'SPC h SPC is to find SpaceVim help',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ 'SPC h SPC is to find SpaceVim help',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
" @fixme SPC h SPC make vim flick
|
||||
exe printf('nmap %sh%s [SPC]h[SPC]', g:spacevim_default_custom_leader, g:spacevim_default_custom_leader)
|
||||
|
||||
@ -91,69 +97,69 @@ function! SpaceVim#layers#telescope#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'b'], 'Telescope buffers',
|
||||
\ ['list-buffer',
|
||||
\ [
|
||||
\ 'SPC b b is to open buffer list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ 'SPC b b is to open buffer list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Telescope oldfiles',
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Telescope neomru',
|
||||
\ ['open-recent-file',
|
||||
\ [
|
||||
\ 'SPC f r is to open recent file list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ 'SPC f r is to open recent file list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'i'], 'Telescope ctags_outline outline',
|
||||
\ ['jump-to-definition-in-buffer',
|
||||
\ [
|
||||
\ 'SPC j i is to jump to a definition in buffer',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ 'SPC j i is to jump to a definition in buffer',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['T', 's'], 'Telescope colorscheme',
|
||||
\ ['fuzzy-find-colorschemes',
|
||||
\ [
|
||||
\ 'SPC T s is to fuzzy find colorschemes',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ 'SPC T s is to fuzzy find colorschemes',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'],
|
||||
\ "exe 'Telescope find_files cwd=' . fnamemodify(bufname('%'), ':p:h')",
|
||||
\ ['find-files-in-buffer-directory',
|
||||
\ [
|
||||
\ '[SPC f f] is to find files in the directory of the current buffer',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ , 1)
|
||||
\ '[SPC f f] is to find files in the directory of the current buffer',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ , 1)
|
||||
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'],
|
||||
\ 'Telescope find_files',
|
||||
\ ['find-files-in-project',
|
||||
\ [
|
||||
\ '[SPC p f] is to find files in the root of the current project',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ , 1)
|
||||
\ '[SPC p f] is to find files in the root of the current project',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ , 1)
|
||||
|
||||
nnoremap <silent> <C-p> :<C-u>Telescope find_files<cr>
|
||||
|
||||
@ -162,22 +168,27 @@ function! SpaceVim#layers#telescope#config() abort
|
||||
\ . string(s:_function('s:get_help_with_cursor_symbol')) . ', [])',
|
||||
\ ['get-help-for-cursor-symbol',
|
||||
\ [
|
||||
\ '[SPC h i] is to get help with the symbol at point',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
\ '[SPC h i] is to get help with the symbol at point',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:filename . ':' . lnum,
|
||||
\ ]
|
||||
\ ],
|
||||
\ 1)
|
||||
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 't', 'f'],
|
||||
\ 'Telescope task', 'fuzzy-find-tasks', 1)
|
||||
let g:_spacevim_mappings.f = {'name' : '+Fuzzy Finder'}
|
||||
call s:defind_fuzzy_finder()
|
||||
|
||||
" this autocmd should only be called when using deoplete
|
||||
augroup spacevim_telescope_layer
|
||||
autocmd!
|
||||
" https://github.com/nvim-telescope/telescope.nvim/issues/161
|
||||
autocmd FileType TelescopePrompt call deoplete#custom#buffer_option('auto_complete', v:false)
|
||||
if g:spacevim_autocomplete_method == 'deoplete'
|
||||
" https://github.com/nvim-telescope/telescope.nvim/issues/161
|
||||
autocmd FileType TelescopePrompt call deoplete#custom#buffer_option('auto_complete', v:false)
|
||||
endif
|
||||
" @fixme 无法移除 jk 映射
|
||||
" autocmd FileType TelescopePrompt iunmap <buffer> jk
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
@ -206,44 +217,44 @@ function! s:defind_fuzzy_finder() abort
|
||||
let g:_spacevim_mappings.f.e = ['Telescope registers',
|
||||
\ 'fuzzy find registers',
|
||||
\ [
|
||||
\ '[Leader f e ] is to fuzzy find registers',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f e ] is to fuzzy find registers',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
nnoremap <silent> <Leader>fr
|
||||
\ :<C-u>Telescope resume<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f.r = ['Telescope resume',
|
||||
\ 'resume telescope window',
|
||||
\ [
|
||||
\ '[Leader f r ] is to resume telescope window',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f r ] is to resume telescope window',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
nnoremap <silent> <Leader>fh
|
||||
\ :<C-u>Telescope neoyank<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f.h = ['Telescope neoyank',
|
||||
\ 'fuzzy find yank history',
|
||||
\ [
|
||||
\ '[Leader f h] is to fuzzy find history and yank content',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f h] is to fuzzy find history and yank content',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
nnoremap <silent> <Leader>fj
|
||||
\ :<C-u>Telescope jumplist<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f.j = ['Telescope jumplist',
|
||||
\ 'fuzzy find jump list',
|
||||
\ [
|
||||
\ '[Leader f j] is to fuzzy find jump list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f j] is to fuzzy find jump list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
nnoremap <silent> <Leader>fl
|
||||
\ :<C-u>Telescope loclist<CR>
|
||||
@ -251,11 +262,11 @@ function! s:defind_fuzzy_finder() abort
|
||||
let g:_spacevim_mappings.f.l = ['Telescope loclist',
|
||||
\ 'fuzzy find local list',
|
||||
\ [
|
||||
\ '[Leader f q] is to fuzzy find local list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f q] is to fuzzy find local list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
nnoremap <silent> <Leader>fm
|
||||
\ :<C-u>Telescope messages<CR>
|
||||
@ -263,11 +274,11 @@ function! s:defind_fuzzy_finder() abort
|
||||
let g:_spacevim_mappings.f.m = ['Telescope messages',
|
||||
\ 'fuzzy find and yank message history',
|
||||
\ [
|
||||
\ '[Leader f m] is to fuzzy find and yank message history',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f m] is to fuzzy find and yank message history',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
nnoremap <silent> <Leader>fq
|
||||
\ :<C-u>Telescope quickfix<CR>
|
||||
@ -275,44 +286,44 @@ function! s:defind_fuzzy_finder() abort
|
||||
let g:_spacevim_mappings.f.q = ['Telescope quickfix',
|
||||
\ 'fuzzy find quickfix list',
|
||||
\ [
|
||||
\ '[Leader f q] is to fuzzy find quickfix list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f q] is to fuzzy find quickfix list',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
nnoremap <silent> <Leader>fo :<C-u>Telescope ctags_outline outline<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f.o = ['Telescope ctags_outline outline',
|
||||
\ 'fuzzy find outline',
|
||||
\ [
|
||||
\ '[Leader f o] is to fuzzy find outline',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f o] is to fuzzy find outline',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
nnoremap <silent> <Leader>f<Space> :Telescope menu menu=CustomKeyMaps<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f['[SPC]'] = ['Telescope menu menu=CustomKeyMaps',
|
||||
\ 'fuzzy find custom key bindings',
|
||||
\ [
|
||||
\ '[Leader f SPC] is to fuzzy find custom key bindings',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f SPC] is to fuzzy find custom key bindings',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
nnoremap <silent> <Leader>fp :<C-u>Telescope menu menu=AddedPlugins<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f.p = ['Telescope menu menu=AddedPlugins',
|
||||
\ 'fuzzy find vim packages',
|
||||
\ [
|
||||
\ '[Leader f p] is to fuzzy find vim packages installed in SpaceVim',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f p] is to fuzzy find vim packages installed in SpaceVim',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
|
||||
if g:spacevim_snippet_engine ==# 'ultisnips'
|
||||
nnoremap <silent> <Leader>fs :<C-u>Telescope ultisnips<CR>
|
||||
@ -320,11 +331,25 @@ function! s:defind_fuzzy_finder() abort
|
||||
let g:_spacevim_mappings.f.s = ['Telescope ultisnips',
|
||||
\ 'fuzzy find ultisnips snippets',
|
||||
\ [
|
||||
\ '[Leader f s] is to fuzzy find ultisnips snippets',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ '[Leader f s] is to fuzzy find ultisnips snippets',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
endif
|
||||
|
||||
|
||||
if SpaceVim#layers#isLoaded('tools')
|
||||
nnoremap <silent> <Leader>fb :<C-u>Telescope bookmarks<CR>
|
||||
let lnum = expand('<slnum>') + s:unite_lnum - 4
|
||||
let g:_spacevim_mappings.f.b = ['Telescope bookmarks',
|
||||
\ 'fuzzy find bookmarks',
|
||||
\ [
|
||||
\ '[Leader f b] is to fuzzy find bookmarks',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
endif
|
||||
|
||||
|
||||
@ -332,12 +357,12 @@ function! s:defind_fuzzy_finder() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 's'], 'Telescope scriptnames',
|
||||
\ ['open-custom-configuration',
|
||||
\ [
|
||||
\ '[SPC f v d] is to open the custom configuration file for SpaceVim',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ , 1)
|
||||
\ '[SPC f v d] is to open the custom configuration file for SpaceVim',
|
||||
\ '',
|
||||
\ 'Definition: ' . s:file . ':' . lnum,
|
||||
\ ]
|
||||
\ ]
|
||||
\ , 1)
|
||||
|
||||
endfunction
|
||||
|
||||
@ -362,3 +387,15 @@ function! SpaceVim#layers#telescope#health() abort
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#telescope#set_variable(var) abort
|
||||
|
||||
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#telescope#get_options() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
@ -26,7 +26,7 @@ function! SpaceVim#layers#tools#plugins() abort
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/calendar.vim',{ 'on_cmd' : 'Calendar'}])
|
||||
call add(plugins, ['junegunn/limelight.vim', { 'on_cmd' : 'Limelight'}])
|
||||
call add(plugins, ['junegunn/goyo.vim', { 'on_cmd' : 'Goyo', 'loadconf' : 1}])
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-bookmarks',
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/bookmarks.vim',
|
||||
\ {'merged': 0,
|
||||
\ 'loadconf_before' : 1}])
|
||||
if s:CMP.has('python3')
|
||||
@ -62,6 +62,10 @@ function! SpaceVim#layers#tools#config() abort
|
||||
nnoremap <silent> <C-_> <Esc>:Ydc<CR>
|
||||
endif
|
||||
endfunction
|
||||
function! SpaceVim#layers#tools#set_variable(var) abort
|
||||
let g:bookmarks_sign_text = get(a:var, 'bookmarks_sign_text', '=>')
|
||||
let g:bookmarks_sign_highlight = get(a:var, 'bookmarks_sign_highlight', 'Normal')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#tools#health() abort
|
||||
call SpaceVim#layers#tools#plugins()
|
||||
@ -69,4 +73,10 @@ function! SpaceVim#layers#tools#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#tools#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -106,6 +106,24 @@ function! SpaceVim#layers#tools#mpv#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#tools#mpv#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#tools#mpv#plugins() abort
|
||||
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#tools#mpv#get_options() abort
|
||||
|
||||
return ['musics_directory', 'mpv_interpreter']
|
||||
|
||||
endfunction
|
||||
|
||||
let s:playId = 0
|
||||
fu! s:handler(id, data, event) abort
|
||||
if a:event ==# 'exit'
|
||||
|
@ -13,7 +13,12 @@
|
||||
|
||||
function! SpaceVim#layers#treesitter#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-treesitter',
|
||||
if has('nvim-0.8.0')
|
||||
let l:version = '-0.9.1'
|
||||
else
|
||||
let l:version = ''
|
||||
endif
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-treesitter' . l:version,
|
||||
\ {
|
||||
\ 'merged' : 0,
|
||||
\ 'loadconf' : 1 ,
|
||||
@ -28,6 +33,12 @@ function! SpaceVim#layers#treesitter#health() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#treesitter#setup() abort
|
||||
|
||||
lua require('spacevim.treesitter').setup()
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#treesitter#loadable() abort
|
||||
|
||||
return has('nvim')
|
||||
|
@ -97,6 +97,7 @@ function! SpaceVim#layers#ui#plugins() abort
|
||||
\ 'EnableWhitespace'
|
||||
\ ]}],
|
||||
\ ]
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/neomru.vim', {'merged' : 0}])
|
||||
if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version())
|
||||
\ || has('nvim-0.6.0')
|
||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/indent-blankline.nvim',
|
||||
@ -720,3 +721,9 @@ function! s:reduce_font() abort
|
||||
let &guifont = substitute(&guifont, ':h\d\+', ':h' . font_size, '')
|
||||
sleep 100m
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#ui#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -26,3 +26,9 @@ function! SpaceVim#layers#vim#health() abort
|
||||
call SpaceVim#layers#vim#config()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#vim#loadable() abort
|
||||
|
||||
return 1
|
||||
|
||||
endfunction
|
||||
|
@ -6,6 +6,15 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section Runtime Log, runtime-log
|
||||
" @parentsection dev
|
||||
" The runtime log of SpaceVim can be obtained via the key binding `SPC h L`.
|
||||
" To get the debug information about the current SpaceVim environment,
|
||||
" Use the command `:SPDebugInfo!`. This command will open a new buffer where default information will be shown.
|
||||
" You can also use `SPC h I` to open a buffer with SpaceVim's issue template.
|
||||
|
||||
|
||||
if has('nvim-0.5.0')
|
||||
""
|
||||
" write message to SpaceVim runtime log with `info` level.
|
||||
|
@ -66,7 +66,7 @@ if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0
|
||||
lua vim.lsp.buf.remove_workspace_folder()
|
||||
endfunction
|
||||
function! SpaceVim#lsp#buf_server_ready() abort
|
||||
return v:lua.vim.lsp.buf.server_ready()
|
||||
return luaeval('require("spacevim.lsp").server_ready()')
|
||||
endfunction
|
||||
function! SpaceVim#lsp#diagnostic_set_loclist() abort
|
||||
lua require('spacevim.diagnostic').set_loclist()
|
||||
|
@ -188,6 +188,10 @@ function! SpaceVim#mapping#vertical_split_previous_buffer(...) abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#close_current_buffer(...) abort
|
||||
if has('nvim-0.9.5')
|
||||
lua require('spacevim.plugin.tabline').close_current_buffer()
|
||||
return
|
||||
endif
|
||||
if index(
|
||||
\ ['startify', 'defx'],
|
||||
\ &filetype) !=# -1
|
||||
|
@ -12,8 +12,88 @@ endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
""
|
||||
" @section Mapping Guide, plugins-mapping-guide
|
||||
" @parentsection plugins
|
||||
" The mapping guide windows will be opened each time the prefix key is pressed
|
||||
" in normal/visual mode. It will list all available key bindings and the short
|
||||
" descriptions. The prefix can be `[SPC]`, `[WIN]` or `<Leader>`.
|
||||
"
|
||||
" The prefixes are mapped to the following key bindings by default:
|
||||
" >
|
||||
" Prefix | Custom options and default values | Descriptions
|
||||
" ---------------------------------------------------------------------
|
||||
" [SPC]` | NONE / `<Space>` | default mapping prefix
|
||||
" [WIN]` | `windows_leader` / `s` | window mapping prefix
|
||||
" <Leader>` | default vim leader | default leader prefix
|
||||
" <
|
||||
"
|
||||
" The default value of `<Leader>` is `\`, if you want to change this key,
|
||||
" you need to use the bootstrap function. For example, to use `,`
|
||||
" as the `<Leader>` key:
|
||||
" >
|
||||
" function! myspacevim#before() abort
|
||||
" let g:mapleader = ','
|
||||
" endfunction
|
||||
" <
|
||||
"
|
||||
" NOTE: When modifying the variable `g:mapleader` in a function.
|
||||
" you can not omit the variable's scope. Because the default scope
|
||||
" of a variable in function is `l:`. It is different from what you
|
||||
" see in vim help |mapleader|.
|
||||
"
|
||||
" By default the guide buffer will be displayed 1000ms after the keys being pressed.
|
||||
" You can change the delay by adding vim option `'timeoutlen'` to your bootstrap function.
|
||||
"
|
||||
" For example, after pressing `<Space>` in normal mode, you will see all the
|
||||
" key bindings start with `SPC` in mapping guide windows.
|
||||
" you can type `b` for all the buffer mappings, `p` for project mappings, etc.
|
||||
"
|
||||
" After pressing `Ctrl-h` in guide buffer, you will get paging and help info in the statusline.
|
||||
" >
|
||||
" | Keys | Descriptions |
|
||||
" | ---- | ----------------------------- |
|
||||
" | `u` | undo pressing |
|
||||
" | `n` | next page of guide buffer |
|
||||
" | `p` | previous page of guide buffer |
|
||||
" <
|
||||
" Use `SpaceVim#custom#SPC()` to define custom SPC mappings. For example:
|
||||
" >
|
||||
" call SpaceVim#custom#SPC('nnoremap',
|
||||
" \ ['f', 't'],
|
||||
" \ 'echom "hello world"', 'test custom SPC', 1)
|
||||
" <
|
||||
"
|
||||
" The first parameter sets the type of shortcut key,
|
||||
" which can be `nnoremap` or `nmap`, the second parameter is a list of keys,
|
||||
" and the third parameter is an ex command or key binding,
|
||||
" depending on whether the last parameter is true.
|
||||
" The fourth parameter is a short description of this custom key binding.
|
||||
"
|
||||
" @subsection Fuzzy find key bindings
|
||||
"
|
||||
" It is possible to search for specific key bindings by pressing `?`
|
||||
" in the root of the guide buffer.
|
||||
"
|
||||
" To narrow the list down, just insert the mapping keys or descriptions of
|
||||
" what mappings you want, the fuzzy finder will get the mappings.
|
||||
"
|
||||
" Then use `<Tab>` or `<Up>` and `<Down>` to select the mapping,
|
||||
" press `<Enter>` to execute that command.
|
||||
"
|
||||
" @subsection Mapping guide theme
|
||||
"
|
||||
" The default mapping guide theme is `leaderguide`,
|
||||
" which is same as vim-leaderguide(https://github.com/hecal3/vim-leader-guide),
|
||||
" there is another available theme called `whichkey`.
|
||||
" To set the mapping guide theme, use following snippet:
|
||||
" >
|
||||
" [options]
|
||||
" # the value can be `leaderguide` or `whichkey`
|
||||
" leader_guide_theme = 'whichkey'
|
||||
" <
|
||||
|
||||
if has('nvim-0.9.0')
|
||||
if has('nvim-0.8.0')
|
||||
|
||||
function! SpaceVim#mapping#guide#parse_mappings() abort " {{{
|
||||
lua require("spacevim.plugin.guide").parse_mappings()
|
||||
|
@ -6,6 +6,103 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
|
||||
""
|
||||
" @section windows-and-tabs, usage-windows-and-tabs
|
||||
" @parentsection usage
|
||||
" Window manager key bindings can only be used in normal mode.
|
||||
" The default leader `[WIN]` is `s`, you can change it via `windows_leader`
|
||||
" in the `[options]` section:
|
||||
" >
|
||||
" [options]
|
||||
" windows_leader = "s"
|
||||
" <
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | --------------------------------------------------
|
||||
" q | Smart buffer close
|
||||
" WIN v | :split
|
||||
" WIN V | Split with previous buffer
|
||||
" WIN g | :vsplit
|
||||
" WIN G | Vertically split with previous buffer
|
||||
" WIN t | Open new tab (:tabnew)
|
||||
" WIN o | Close other windows (:only)
|
||||
" WIN x | Remove buffer, leave blank window
|
||||
" WIN q | Remove current buffer
|
||||
" WIN Q | Close current buffer (:close)
|
||||
" Shift-Tab | Switch to alternate window (switch back and forth)
|
||||
" <
|
||||
" SpaceVim has mapped normal `q` (record a macro) as smart buffer close,
|
||||
" and record a macro (vim's `q`) has been mapped to `<Leader> q r`,
|
||||
" if you want to disable this feature, you can use `vimcompatible` mode.
|
||||
"
|
||||
" @subsection General Editor windows
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | --------------------------------
|
||||
" <F2> | Toggle tagbar
|
||||
" <F3> | Toggle Vimfiler
|
||||
" Ctrl-Down | Move to split below ( Ctrl-w j )
|
||||
" Ctrl-Up | Move to upper split ( Ctrl-w k )
|
||||
" Ctrl-Left | Move to left split ( Ctrl-w h )
|
||||
" Ctrl-Right | Move to right split ( Ctrl-w l )
|
||||
" <
|
||||
" @subsection Window manipulation key bindings
|
||||
"
|
||||
" Every window has a number displayed at the start of the statusline
|
||||
" and can be quickly accessed using `SPC number`.
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | ---------------------
|
||||
" SPC 1 | go to window number 1
|
||||
" SPC 2 | go to window number 2
|
||||
" SPC 3 | go to window number 3
|
||||
" SPC 4 | go to window number 4
|
||||
" SPC 5 | go to window number 5
|
||||
" SPC 6 | go to window number 6
|
||||
" SPC 7 | go to window number 7
|
||||
" SPC 8 | go to window number 8
|
||||
" SPC 9 | go to window number 9
|
||||
" <
|
||||
" Windows manipulation commands (start with `w`):
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" --------------------- | --------------------------------------------------
|
||||
" SPC w . | windows transient state
|
||||
" SPC w <Tab> | switch to alternate window in the current frame
|
||||
" SPC w = | balance split windows
|
||||
" SPC w c | Distraction-free reading current window
|
||||
" SPC w C | Distraction-free reading other windows
|
||||
" SPC w d | delete a window
|
||||
" SPC w D | delete another window using vim-choosewin
|
||||
" SPC w f | toggle follow mode
|
||||
" SPC w F | create new tab
|
||||
" SPC w h | move to window on the left
|
||||
" SPC w H | move window to the left
|
||||
" SPC w j | move to window below
|
||||
" SPC w J | move window to the bottom
|
||||
" SPC w k | move to window above
|
||||
" SPC w K | move window to the top
|
||||
" SPC w l | move to window on the right
|
||||
" SPC w L | move window to the right
|
||||
" SPC w m | maximize/minimize a window
|
||||
" SPC w M | swap windows using vim-choosewin
|
||||
" SPC w o | cycle and focus between tabs
|
||||
" SPC w r | rotate windows forward
|
||||
" SPC w R | rotate windows backward
|
||||
" SPC w s / SPC w - | horizontal split
|
||||
" SPC w S | horizontal split and focus new window
|
||||
" SPC w u | undo window layout
|
||||
" SPC w U | redo window layout
|
||||
" SPC w v / SPC w / | vertical split
|
||||
" SPC w V | vertical split and focus new window
|
||||
" SPC w w | cycle and focus between windows
|
||||
" SPC w W | select window using vim-choosewin
|
||||
" SPC w x | exchange current window with next one
|
||||
" <
|
||||
|
||||
|
||||
|
||||
let s:file = expand('<sfile>:~')
|
||||
let s:lnum = expand('<slnum>') + 3
|
||||
function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort
|
||||
@ -13,7 +110,6 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort
|
||||
exe 'nnoremap <silent><nowait> [Window] :<c-u>LeaderGuide "' .
|
||||
\ a:key . '"<CR>'
|
||||
exe 'nmap ' .a:key . ' [Window]'
|
||||
let g:_spacevim_mappings_windows = {}
|
||||
nnoremap <silent> [Window]v
|
||||
\ :<C-u>split<CR>
|
||||
let lnum = expand('<slnum>') + s:lnum - 4
|
||||
@ -200,7 +296,6 @@ endfunction
|
||||
|
||||
function! SpaceVim#mapping#leader#defindKEYs() abort
|
||||
call SpaceVim#logger#debug('defind SPC h k prefixs')
|
||||
let g:_spacevim_mappings_prefixs = {}
|
||||
if !g:spacevim_vimcompatible && !empty(g:spacevim_windows_leader)
|
||||
let g:_spacevim_mappings_prefixs[g:spacevim_windows_leader] = {'name' : '+Window prefix'}
|
||||
call extend(g:_spacevim_mappings_prefixs[g:spacevim_windows_leader], g:_spacevim_mappings_windows)
|
||||
|
@ -14,7 +14,6 @@ let s:file = expand('<sfile>:~')
|
||||
let s:funcbeginline = expand('<slnum>') + 1
|
||||
function! SpaceVim#mapping#space#init() abort
|
||||
call SpaceVim#logger#debug('init SPC key bindings')
|
||||
let g:_spacevim_mappings_space = {}
|
||||
let g:_spacevim_mappings_prefixs['[SPC]'] = {'name' : '+SPC prefix'}
|
||||
let g:_spacevim_mappings_space.t = {'name' : '+Toggles'}
|
||||
let g:_spacevim_mappings_space.t.h = {'name' : '+Toggles highlight'}
|
||||
@ -702,6 +701,10 @@ function! SpaceVim#mapping#space#init() abort
|
||||
else
|
||||
call SpaceVim#custom#SPC('nnoremap', ['a', 'o'], 'call SpaceVim#plugins#todo#list()', 'open-todo-manager', 1)
|
||||
endif
|
||||
|
||||
if has('nvim-0.9.5')
|
||||
call SpaceVim#custom#SPC('nnoremap', ['a', 'r'], 'lua require("spacevim.plugin.record-key").toggle()', 'toggle-record-keyboard', 1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd, ...) abort
|
||||
|
@ -58,6 +58,7 @@ function! s:getLayerPlugins(layer) abort
|
||||
try
|
||||
let p = SpaceVim#layers#{a:layer}#plugins()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
call SpaceVim#logger#info(a:layer . ' layer do not implement plugins function')
|
||||
endtry
|
||||
return p
|
||||
endfunction
|
||||
@ -67,6 +68,7 @@ function! s:loadLayerConfig(layer) abort
|
||||
try
|
||||
call SpaceVim#layers#{a:layer}#config()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
call SpaceVim#logger#info(a:layer . ' layer do not implement config function')
|
||||
endtry
|
||||
|
||||
endfunction
|
||||
|
@ -186,7 +186,7 @@ else
|
||||
call s:LOGGER.info(' > type: ' . get(a:000, 0, 'alternate'))
|
||||
call s:LOGGER.info(' > parse: ' . a:request_parse)
|
||||
call s:LOGGER.info(' > config: ' . a:conf_path)
|
||||
" @question when should the cache be loaded?
|
||||
" when should the cache be loaded?
|
||||
" if the local value s:project_config do not has the key a:conf_path
|
||||
" and the file a:conf_path has not been updated since last cache
|
||||
" and no request_parse specified
|
||||
@ -232,12 +232,11 @@ else
|
||||
function! s:parse(alt_config_json) abort
|
||||
call s:LOGGER.info('Start to parse alternate files for: ' . a:alt_config_json.root)
|
||||
let s:project_config[a:alt_config_json.root] = {}
|
||||
" @question why need sory()
|
||||
" if we have two key docs/*.md and docs/cn/*.md
|
||||
" if we have two keys docs/*.md and docs/cn/*.md
|
||||
" with the first key, we can also find files in
|
||||
" docs/cn/ directory, for example docs/cn/index.md
|
||||
" and the alt file will be
|
||||
" docs/cn/cn/index.md. this should be overrided by login in
|
||||
" docs/cn/cn/index.md. this should be overrided by
|
||||
" docs/cn/*.md
|
||||
"
|
||||
" so we need to use sort, and make sure `docs/cn/*.md` is parsed after
|
||||
|
@ -26,7 +26,7 @@ function! SpaceVim#plugins#ctrlg#display() abort
|
||||
let project_name = ''
|
||||
endif
|
||||
|
||||
let file = fnamemodify(expand('%'), '.')
|
||||
let file = fnamemodify(expand('%'), ':.')
|
||||
|
||||
if !empty(project_name)
|
||||
echohl Constant | echo project_name
|
||||
@ -35,6 +35,7 @@ function! SpaceVim#plugins#ctrlg#display() abort
|
||||
echohl Special | echon pwd
|
||||
echohl WarningMsg | echon " >> "
|
||||
echohl Directory | echon file
|
||||
echohl NONE
|
||||
endfun
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
@ -6,6 +6,7 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
let s:list = SpaceVim#api#import('data#list')
|
||||
|
||||
let s:pr_kind = g:spacevim_gitcommit_pr_icon
|
||||
let s:issue_kind = g:spacevim_gitcommit_issue_icon
|
||||
@ -62,19 +63,56 @@ let s:commit_types = [
|
||||
\ ]
|
||||
|
||||
|
||||
" https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors
|
||||
" https://stackoverflow.com/questions/58525836/git-magic-keywords-in-commit-messages-signed-off-by-co-authored-by-fixes
|
||||
" https://www.reddit.com/r/git/comments/13d565i/git_trailers_what_are_they_for/
|
||||
" https://alchemists.io/articles/git_trailers
|
||||
" https://git-scm.com/docs/git-interpret-trailers
|
||||
" https://gitlab.com/gitlab-org/gitlab-foss/-/issues/31640
|
||||
" https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/CommitMessageConventions.html
|
||||
let s:git_trailers = [
|
||||
\ {
|
||||
\ 'word' : 'Co-Authored-By:',
|
||||
\ 'menu' : 'multiple commit author'
|
||||
\ },
|
||||
\ ]
|
||||
|
||||
function! s:find_last_branch() abort
|
||||
let reflog = systemlist('git reflog')
|
||||
for log in reflog
|
||||
" e059b76ca HEAD@{15}: checkout: moving from doc-help to master
|
||||
if log =~# 'HEAD@{\d\+}: checkout: '
|
||||
return matchstr(log, 'HEAD@{\d\+}: checkout: moving from \zs\S*')
|
||||
endif
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:generate_co_author() abort
|
||||
let last_branch = s:find_last_branch()
|
||||
call SpaceVim#logger#info('last branch:' . last_branch)
|
||||
return s:list.uniq(systemlist('git log -n 5 --format="%aN <%aE>" ' . last_branch))
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#gitcommit#complete(findstart, base) abort
|
||||
if a:findstart
|
||||
let s:complete_ol = 0
|
||||
let s:complete_type = 0
|
||||
let s:complete_trailers = 0
|
||||
let s:complete_co_author = 0
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
while start > 0 && line[start - 1] !=# ' ' && line[start - 1] !=# '#'
|
||||
while start > 0 && line[start - 1] !=# ' ' && line[start - 1] !=# '#' && line[start - 1] !=# ':'
|
||||
let start -= 1
|
||||
endwhile
|
||||
if line[start - 1] ==# '#'
|
||||
let s:complete_ol = 1
|
||||
elseif line('.') ==# 1 && start ==# 0
|
||||
let s:complete_type = 1
|
||||
elseif line('.') !=# 1 && start ==# 0
|
||||
let s:complete_trailers = 1
|
||||
elseif getline('.') =~# '^Co-Authored-By:' && start >= 14
|
||||
let s:complete_co_author = 1
|
||||
endif
|
||||
return start
|
||||
else
|
||||
@ -82,6 +120,10 @@ function! SpaceVim#plugins#gitcommit#complete(findstart, base) abort
|
||||
return s:complete_pr(a:base)
|
||||
elseif s:complete_type == 1
|
||||
return s:complete('types')
|
||||
elseif s:complete_trailers == 1
|
||||
return s:complete('trailers')
|
||||
elseif s:complete_co_author == 1
|
||||
return s:complete('co-author')
|
||||
endif
|
||||
let res = []
|
||||
for m in s:cache_commits()
|
||||
@ -101,6 +143,10 @@ endfunction
|
||||
function! s:complete(what) abort
|
||||
if a:what ==# 'types'
|
||||
return s:commit_types
|
||||
elseif a:what ==# 'trailers'
|
||||
return s:git_trailers
|
||||
elseif a:what ==# 'co-author'
|
||||
return s:generate_co_author()
|
||||
else
|
||||
return []
|
||||
endif
|
||||
|
@ -6,6 +6,46 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section Symbol highlighter, plugins-symbol-highlighter
|
||||
" @parentsection plugins
|
||||
" SpaceVim supports highlighting current symbol on demand and add a transient
|
||||
" state to easily navigate and rename these symbols.
|
||||
"
|
||||
" It is also possible to change the range of the navigation on the fly, the
|
||||
" available ranges are:
|
||||
"
|
||||
" 1. buffer: the whole buffer
|
||||
" 2. function: in current function
|
||||
" 3. visible area: in current visible area of the buffer
|
||||
"
|
||||
" The default key binding to Highlight the symbol under the cursor is `SPC s h`.
|
||||
"
|
||||
" Navigation between the highlighted symbols can be done with the commands:
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------ | -------------------------------------------
|
||||
" * | highlight current symbol and jump forwards
|
||||
" # | highlight current symbol and jump backwards
|
||||
" SPC s e | start iedit mode on current symbol
|
||||
" SPC s h | highlight current symbol within default range
|
||||
" SPC s H | highlight last symbol within default range
|
||||
" <
|
||||
" In highlight symbol transient state, the following key bindings can be used:
|
||||
" >
|
||||
" Key Bindings | Descriptions
|
||||
" ------------- | -----------------------------------
|
||||
" e | start iedit mode
|
||||
" n | go to next occurrence
|
||||
" N / p | go to previous occurrence
|
||||
" b | search occurrence in all buffers
|
||||
" / | search occurrence in whole project
|
||||
" <Tab> | toggle highlight current occurrence
|
||||
" r | change range
|
||||
" R | go to home occurrence
|
||||
" Any other key | leave the navigation transient state
|
||||
" <
|
||||
|
||||
" TODO: {{{
|
||||
" e: iedit
|
||||
" d/D: next previous definition
|
||||
|
82
autoload/SpaceVim/plugins/history.vim
Normal file
82
autoload/SpaceVim/plugins/history.vim
Normal file
@ -0,0 +1,82 @@
|
||||
"=============================================================================
|
||||
" history.vim --- history manager
|
||||
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
let s:FILE = SpaceVim#api#import('file')
|
||||
let s:JSON = SpaceVim#api#import('data#json')
|
||||
let s:LOG = SpaceVim#logger#derive('history')
|
||||
let s:BUF = SpaceVim#api#import('vim#buffer')
|
||||
let s:history_cache_path = s:FILE.unify_path(g:spacevim_data_dir, ':p') . 'SpaceVim/nvim_history.json'
|
||||
let s:filepos = {}
|
||||
|
||||
function! SpaceVim#plugins#history#readcache() abort
|
||||
call s:LOG.debug('read cache')
|
||||
call s:read_cache()
|
||||
endfunction
|
||||
function! SpaceVim#plugins#history#writecache() abort
|
||||
call s:LOG.debug('write cache')
|
||||
call s:write_cache()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#history#jumppos() abort
|
||||
" nvim filename
|
||||
" BufReadPost event before VimEnter
|
||||
if empty(s:filepos)
|
||||
call s:read_cache()
|
||||
endif
|
||||
let [l, c] = get(s:filepos, expand('%:p'), [0, 0])
|
||||
call s:LOG.debug(printf('jump to pos: [%s, %s]', l, c))
|
||||
if l != 0 && c != 0
|
||||
call cursor(l, c)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#history#savepos() abort
|
||||
if empty(s:BUF.bufname()) || &buftype == 'nofile'
|
||||
return
|
||||
endif
|
||||
call s:LOG.debug('save pos for:' . s:BUF.bufname())
|
||||
let [_, l, c, _] = getpos('.')
|
||||
call s:LOG.debug(printf('line %d, col %d', l, c))
|
||||
if l != 0 && c != 0 && filereadable(s:BUF.bufname())
|
||||
let s:filepos[expand('%:p')] = [l, c]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
function! s:read_cache() abort
|
||||
if filereadable(s:history_cache_path)
|
||||
let his = s:JSON.json_decode(join(readfile(s:history_cache_path, ''), ''))
|
||||
if type(his) ==# type({})
|
||||
call map(deepcopy(his.cmd), 'histadd("cmd", v:val)')
|
||||
call map(deepcopy(his.search), 'histadd("search", v:val)')
|
||||
let s:filepos = get(his, 'filepos', {})
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:write_cache() abort
|
||||
let his = { 'cmd' : [], 'filepos' : s:filepos, 'search' : []}
|
||||
for i in range(1, 100)
|
||||
let cmd = histget('cmd', 0 - i)
|
||||
if empty(cmd)
|
||||
break
|
||||
endif
|
||||
call insert(his.cmd, cmd)
|
||||
endfor
|
||||
for i in range(1, 100)
|
||||
let search = histget('search', 0 - i)
|
||||
if empty(search)
|
||||
break
|
||||
endif
|
||||
call insert(his.search, search)
|
||||
endfor
|
||||
call writefile([s:JSON.json_encode(his)], s:history_cache_path)
|
||||
endfunction
|
||||
|
||||
|
@ -92,6 +92,12 @@ endfunction
|
||||
" @vimlint(EVL103, 0, a:event)
|
||||
|
||||
function! SpaceVim#plugins#pmd#run(...) abort
|
||||
if !executable(g:Pmd_Cmd[0])
|
||||
echohl WarningMsg
|
||||
echo g:Pmd_Cmd[0] .. ' is not executable'
|
||||
echohl None
|
||||
return
|
||||
endif
|
||||
let argv = g:Pmd_Cmd + a:000
|
||||
if index(a:000, '-R') == -1
|
||||
let argv += g:Pmd_Rulesets
|
||||
|
@ -34,10 +34,17 @@ if has('nvim-0.5.0')
|
||||
function! SpaceVim#plugins#projectmanager#RootchandgeCallback() abort
|
||||
lua require("spacevim.plugin.projectmanager").RootchandgeCallback()
|
||||
endfunction
|
||||
function! SpaceVim#plugins#projectmanager#reg_callback(func) abort
|
||||
lua require("spacevim.plugin.projectmanager").reg_callback(
|
||||
\ require("spacevim").eval("string(a:func)")
|
||||
\ )
|
||||
function! SpaceVim#plugins#projectmanager#reg_callback(func, ...) abort
|
||||
if a:0 == 0
|
||||
lua require("spacevim.plugin.projectmanager").reg_callback(
|
||||
\ require("spacevim").eval("string(a:func)")
|
||||
\ )
|
||||
else
|
||||
lua require("spacevim.plugin.projectmanager").reg_callback(
|
||||
\ require("spacevim").eval("string(a:func)"),
|
||||
\ require("spacevim").eval("a:1")
|
||||
\ )
|
||||
endif
|
||||
endfunction
|
||||
function! SpaceVim#plugins#projectmanager#current_root() abort
|
||||
return luaeval('require("spacevim.plugin.projectmanager").current_root()')
|
||||
@ -188,8 +195,16 @@ else
|
||||
augroup END
|
||||
endif
|
||||
function! s:find_root_directory() abort
|
||||
" @question confused about expand and fnamemodify
|
||||
" confused about expand and fnamemodify
|
||||
" ref: https://github.com/vim/vim/issues/6793
|
||||
" response from Bram Moolenaar
|
||||
" When there is no file name there also isn't a directory in which that
|
||||
" file exists. Perhaps expand('%:p') should result in an error.
|
||||
" Returning an empty string is basically the same as returning an error.
|
||||
"
|
||||
" fnamemodify() doesn't use the current file name. Now what should it do
|
||||
" with an empty string? Not sure. Anyway, the current behavoir is what
|
||||
" users rely on, so let's not change it.
|
||||
|
||||
|
||||
" get the current path of buffer or working dir
|
||||
@ -333,16 +348,19 @@ else
|
||||
endfunction
|
||||
|
||||
let s:project_callback = []
|
||||
function! SpaceVim#plugins#projectmanager#reg_callback(func) abort
|
||||
function! SpaceVim#plugins#projectmanager#reg_callback(func, ...) abort
|
||||
" support second argv
|
||||
if type(a:func) == 2
|
||||
call add(s:project_callback, a:func)
|
||||
else
|
||||
call SpaceVim#logger#warn('can not register the project callback: ' . string(a:func))
|
||||
call SpaceVim#logger#warn('can not register the project callback: ' . get(a:000, 0, string(a:func)))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#projectmanager#current_root() abort
|
||||
" @todo skip some plugin buffer
|
||||
" skip specific buffer for plugins
|
||||
" - denite.nvim
|
||||
" - defx
|
||||
if bufname('%') =~# '\[denite\]'
|
||||
\ || bufname('%') ==# 'denite-filter'
|
||||
\ || bufname('%') ==# '\[defx\]'
|
||||
@ -384,13 +402,13 @@ else
|
||||
if name !=# ''
|
||||
call s:BUFFER.filter_do(
|
||||
\ {
|
||||
\ 'expr' : [
|
||||
\ 'buflisted(v:val)',
|
||||
\ 'getbufvar(v:val, "_spacevim_project_name") == "' . name . '"',
|
||||
\ ],
|
||||
\ 'do' : 'bd %d'
|
||||
\ }
|
||||
\ )
|
||||
\ 'expr' : [
|
||||
\ 'buflisted(v:val)',
|
||||
\ 'getbufvar(v:val, "_spacevim_project_name") == "' . name . '"',
|
||||
\ ],
|
||||
\ 'do' : 'bd %d'
|
||||
\ }
|
||||
\ )
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
@ -6,6 +6,32 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section scrollbar, plugins-scrollbar
|
||||
" @parentsection plugins
|
||||
" The `scrollbar` plugin provides a scrollbar for current windows. There are
|
||||
" two versions in SpaceVim.
|
||||
"
|
||||
" 1. Old version is written in Vim script for vim and < nvim 0.9.0
|
||||
" 2. The new version is written in Lua, and require `has('nvim-0.9.0')`
|
||||
"
|
||||
" This plugin is included in @section(layers-ui).
|
||||
|
||||
if has('nvim-0.9.0')
|
||||
function! SpaceVim#plugins#scrollbar#usable() abort
|
||||
return luaeval('require("spacevim.plugin.scrollbar").usable()')
|
||||
endfunction
|
||||
function! SpaceVim#plugins#scrollbar#show() abort
|
||||
lua require('spacevim.plugin.scrollbar').show()
|
||||
endfunction
|
||||
function! SpaceVim#plugins#scrollbar#clear(...) abort
|
||||
lua require('spacevim.plugin.scrollbar').clear()
|
||||
endfunction
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
|
||||
let s:VIM = SpaceVim#api#import('vim')
|
||||
let s:BUF = SpaceVim#api#import('vim#buffer')
|
||||
let s:WIN = SpaceVim#api#import('vim#window')
|
||||
@ -21,7 +47,7 @@ scriptencoding utf-8
|
||||
|
||||
let s:default = {
|
||||
\ 'max_size' : 10,
|
||||
\ 'min_size' : 3,
|
||||
\ 'min_size' : 5,
|
||||
\ 'width' : 1,
|
||||
\ 'right_offset' : 1,
|
||||
\ 'excluded_filetypes' : ['startify', 'git-commit','leaderf', 'NvimTree', 'tagbar', 'defx', 'neo-tree', 'qf'],
|
||||
@ -103,6 +129,7 @@ function! s:create_scrollbar_buffer(size, lines) abort
|
||||
endif
|
||||
call s:BUF.buf_set_lines(s:scrollbar_bufnr, 0, -1, 0, a:lines)
|
||||
call s:add_highlight(s:scrollbar_bufnr, a:size)
|
||||
call setbufvar(s:scrollbar_bufnr, '&buftype', 'nofile')
|
||||
return s:scrollbar_bufnr
|
||||
endfunction
|
||||
|
||||
@ -156,8 +183,10 @@ function! SpaceVim#plugins#scrollbar#show() abort
|
||||
\ 'row' : row,
|
||||
\ 'col' : float2nr(col),
|
||||
\ 'focusable' : 0,
|
||||
\ 'zindex' : 10,
|
||||
\ }
|
||||
if has('nvim-0.5.0')
|
||||
let opts.zindex = 10
|
||||
endif
|
||||
if s:WIN.is_float(s:scrollbar_winid)
|
||||
if bar_size !=# s:scrollbar_size
|
||||
let s:scrollbar_size = bar_size
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user