1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Simplify condition check (#397)

This commit is contained in:
jdhao 2025-04-02 21:57:37 +02:00 committed by GitHub
parent 9e6be1f001
commit ad4a0e82dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -77,10 +77,7 @@ local plugin_specs = {
{ {
"vlime/vlime", "vlime/vlime",
enabled = function() enabled = function()
if utils.executable("sbcl") then return utils.executable("sbcl")
return true
end
return false
end, end,
config = function(plugin) config = function(plugin)
vim.opt.rtp:append(plugin.dir .. "/vim") vim.opt.rtp:append(plugin.dir .. "/vim")
@ -236,11 +233,7 @@ local plugin_specs = {
vim.g.netrw_nogx = 1 -- disable netrw gx vim.g.netrw_nogx = 1 -- disable netrw gx
end, end,
enabled = function() enabled = function()
if vim.g.is_win or vim.g.is_mac then return vim.g.is_win or vim.g.is_mac
return true
else
return false
end
end, end,
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
config = true, -- default settings config = true, -- default settings
@ -252,11 +245,7 @@ local plugin_specs = {
{ {
"liuchengxu/vista.vim", "liuchengxu/vista.vim",
enabled = function() enabled = function()
if utils.executable("ctags") then return utils.executable("ctags")
return true
else
return false
end
end, end,
cmd = "Vista", cmd = "Vista",
}, },
@ -302,10 +291,7 @@ local plugin_specs = {
{ {
"lyokha/vim-xkbswitch", "lyokha/vim-xkbswitch",
enabled = function() enabled = function()
if vim.g.is_mac and utils.executable("xkbswitch") then return vim.g.is_mac and utils.executable("xkbswitch")
return true
end
return false
end, end,
event = { "InsertEnter" }, event = { "InsertEnter" },
}, },
@ -313,10 +299,7 @@ local plugin_specs = {
{ {
"Neur1n/neuims", "Neur1n/neuims",
enabled = function() enabled = function()
if vim.g.is_win then return vim.g.is_win
return true
end
return false
end, end,
event = { "InsertEnter" }, event = { "InsertEnter" },
}, },
@ -365,22 +348,19 @@ local plugin_specs = {
}, },
-- Another markdown plugin -- Another markdown plugin
{ "preservim/vim-markdown", ft = { "markdown" } }, -- { "preservim/vim-markdown", ft = { "markdown" } },
-- Faster footnote generation -- Faster footnote generation
{ "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }, { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } },
-- Vim tabular plugin for manipulate tabular, required by markdown plugins -- Vim tabular plugin for manipulate tabular, required by markdown plugins
{ "godlygeek/tabular", cmd = { "Tabularize" } }, { "godlygeek/tabular", ft = { "markdown" } },
-- Markdown previewing (only for Mac and Windows) -- Markdown previewing (only for Mac and Windows)
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
enabled = function() enabled = function()
if vim.g.is_win or vim.g.is_mac then return vim.g.is_win or vim.g.is_mac
return true
end
return false
end, end,
build = "cd app && npm install && git restore .", build = "cd app && npm install && git restore .",
ft = { "markdown" }, ft = { "markdown" },
@ -389,10 +369,7 @@ local plugin_specs = {
{ {
"rhysd/vim-grammarous", "rhysd/vim-grammarous",
enabled = function() enabled = function()
if vim.g.is_mac then return vim.g.is_mac
return true
end
return false
end, end,
ft = { "markdown" }, ft = { "markdown" },
}, },
@ -413,10 +390,7 @@ local plugin_specs = {
{ {
"lervag/vimtex", "lervag/vimtex",
enabled = function() enabled = function()
if utils.executable("latex") then return utils.executable("latex")
return true
end
return false
end, end,
ft = { "tex" }, ft = { "tex" },
}, },
@ -427,10 +401,7 @@ local plugin_specs = {
{ {
"tmux-plugins/vim-tmux", "tmux-plugins/vim-tmux",
enabled = function() enabled = function()
if utils.executable("tmux") then return utils.executable("tmux")
return true
end
return false
end, end,
ft = { "tmux" }, ft = { "tmux" },
}, },
@ -447,8 +418,7 @@ local plugin_specs = {
{ {
"glacambre/firenvim", "glacambre/firenvim",
enabled = function() enabled = function()
local result = vim.g.is_win or vim.g.is_mac return vim.g.is_win or vim.g.is_mac
return result
end, end,
-- it seems that we can only call the firenvim function directly. -- it seems that we can only call the firenvim function directly.
-- Using vim.fn or vim.cmd to call this function will fail. -- Using vim.fn or vim.cmd to call this function will fail.
@ -471,10 +441,7 @@ local plugin_specs = {
{ {
"sakhnik/nvim-gdb", "sakhnik/nvim-gdb",
enabled = function() enabled = function()
if vim.g.is_win or vim.g.is_linux then return vim.g.is_win or vim.g.is_linux
return true
end
return false
end, end,
build = { "bash install.sh" }, build = { "bash install.sh" },
lazy = true, lazy = true,
@ -486,10 +453,7 @@ local plugin_specs = {
{ {
"ojroques/vim-oscyank", "ojroques/vim-oscyank",
enabled = function() enabled = function()
if vim.g.is_linux then return vim.g.is_linux
return true
end
return false
end, end,
cmd = { "OSCYank", "OSCYankReg" }, cmd = { "OSCYank", "OSCYankReg" },
}, },