|
|
|
@ -3,7 +3,8 @@ local fn = vim.fn
|
|
|
|
|
|
|
|
|
|
local os_name = vim.loop.os_uname().sysname
|
|
|
|
|
local is_windows = os_name == 'Windows' or os_name == 'Windows_NT'
|
|
|
|
|
local is_git_shell = is_windows and (vim.fn.exists('$SHELL') and vim.fn.expand('$SHELL'):find('bash.exe') ~= nil)
|
|
|
|
|
local is_git_shell = is_windows
|
|
|
|
|
and (vim.fn.exists('$SHELL') and vim.fn.expand('$SHELL'):find('bash.exe') ~= nil)
|
|
|
|
|
|
|
|
|
|
local HASNVIM0_9 = vim.fn.has('nvim-0.9') == 1
|
|
|
|
|
util.get_node_text = vim.treesitter.get_node_text
|
|
|
|
@ -293,8 +294,7 @@ util.log = function(...)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
util.trace = function(...)
|
|
|
|
|
end
|
|
|
|
|
util.trace = function(...) end
|
|
|
|
|
|
|
|
|
|
local rhs_options = {}
|
|
|
|
|
|
|
|
|
@ -378,7 +378,7 @@ function util.nvim_load_mapping(mapping)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
util.loaded = {}
|
|
|
|
|
function util.load_plugin(name, modulename)
|
|
|
|
|
assert(name ~= nil, 'plugin should not empty')
|
|
|
|
|
modulename = modulename or name
|
|
|
|
@ -386,6 +386,10 @@ function util.load_plugin(name, modulename)
|
|
|
|
|
if has then
|
|
|
|
|
return plugin
|
|
|
|
|
end
|
|
|
|
|
if util.loaded[name] then
|
|
|
|
|
return nil -- already loaded/tried
|
|
|
|
|
end
|
|
|
|
|
util.loaded[name] = true
|
|
|
|
|
local pkg = packer_plugins
|
|
|
|
|
|
|
|
|
|
local has_packer = pcall(require, 'packer')
|
|
|
|
@ -401,9 +405,13 @@ function util.load_plugin(name, modulename)
|
|
|
|
|
loader(name)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if not require('lazy.core.config').plugins[name] then
|
|
|
|
|
util.log('lazy loader failed not installed ' .. name)
|
|
|
|
|
else
|
|
|
|
|
require('lazy').load({ plugins = name })
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
util.log('packadd ' .. name)
|
|
|
|
|
local paths = vim.o.runtimepath
|
|
|
|
@ -922,7 +930,7 @@ util.goenv_mode = function()
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local cmd = "command -v goenv > /dev/null 2>&1"
|
|
|
|
|
local cmd = 'command -v goenv > /dev/null 2>&1'
|
|
|
|
|
local status = os.execute(cmd)
|
|
|
|
|
return status == 0
|
|
|
|
|
end
|
|
|
|
|