Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vim_fn): check return values of vim.fn against 1 #747

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ end

local shell_config = function()
if global.is_windows then
if not (vim.fn.executable("pwsh") or vim.fn.executable("powershell")) then
if not (vim.fn.executable("pwsh") == 1 or vim.fn.executable("powershell") == 1) then
vim.notify(
[[
Failed to setup terminal config
Expand All @@ -134,7 +134,7 @@ You're recommended to install PowerShell for better experience.]],

local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned"
local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8"
vim.api.nvim_set_option_value("shell", vim.fn.executable("pwsh") and "pwsh" or "powershell", {})
vim.api.nvim_set_option_value("shell", vim.fn.executable("pwsh") == 1 and "pwsh" or "powershell", {})
vim.api.nvim_set_option_value("shellcmdflag", string.format("%s %s;", basecmd, ctrlcmd), {})
vim.api.nvim_set_option_value("shellredir", "-RedirectStandardOutput %s -NoNewWindow -Wait", {})
vim.api.nvim_set_option_value("shellpipe", "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode", {})
Expand Down
2 changes: 1 addition & 1 deletion lua/keymap/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end

local _lazygit = nil
_G._toggle_lazygit = function()
if vim.fn.executable("lazygit") then
if vim.fn.executable("lazygit") == 1 then
if not _lazygit then
_lazygit = require("toggleterm.terminal").Terminal:new({
cmd = "lazygit",
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/completion/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ return function()
mason_lspconfig.setup_handlers({ mason_handler })

-- Set lsps that are not supported by `mason.nvim` but supported by `nvim-lspconfig` here.
if vim.fn.executable("dart") then
if vim.fn.executable("dart") == 1 then
local _opts = require("completion.servers.dartls")
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
nvim_lsp.dartls.setup(final_opts)
Expand Down