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