added os detection to use powershell in windows instead of cmd
This commit is contained in:
17
init.lua
17
init.lua
@@ -3,7 +3,7 @@ require("config.lazy")
|
||||
|
||||
require("typst-preview").setup({
|
||||
-- This function will be called to determine the root of the typst project
|
||||
get_root = function(path_of_main_file)
|
||||
get_root = function()
|
||||
local root = os.getenv("TYPST_ROOT")
|
||||
if root then
|
||||
return root
|
||||
@@ -13,3 +13,18 @@ require("typst-preview").setup({
|
||||
})
|
||||
|
||||
vim.opt.expandtab = false
|
||||
|
||||
--OS detection
|
||||
local mySysname = vim.loop.os_uname().sysname
|
||||
local isMac = mySysname == "Darwin"
|
||||
local isLinux = mySysname == "Linux"
|
||||
local isWin = mySysname:find("Windows") and true or false
|
||||
local isWsl = isLinux and vim.loop.os_uname().release:find("Microsoft") and true or false
|
||||
--Set shell
|
||||
if isWin then
|
||||
if vim.fn.executable("pwsh") == 1 then
|
||||
vim.opt.shell = "pwsh" --"pwsh" for 7.x if installed
|
||||
else
|
||||
vim.opt.shell = "powershell" --"powershell" for 5.x
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user