imported the platform.lua from wezterm config for customizing config based on platform, used it in options for python, node and ruby paths

pull/81/head
Raffaele Wylde 2024-07-25 08:57:42 -04:00
parent 8db8fadcfd
commit 8e6ed2b43b
No known key found for this signature in database
2 changed files with 32 additions and 4 deletions

View File

@ -1,6 +1,8 @@
-- Options are automatically loaded before lazy.nvim startup -- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua -- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here -- Add any additional options here
local platform = require("lua.config.platform")
local current_platform = platform()
vim.opt.wrap = true vim.opt.wrap = true
vim.opt.linebreak = true vim.opt.linebreak = true
vim.opt.breakindent = true vim.opt.breakindent = true
@ -10,12 +12,18 @@ vim.opt.tabstop = 8
vim.opt.softtabstop = 4 vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4
vim.opt.expandtab = true vim.opt.expandtab = true
vim.env.PATH = vim.env.HOME .. "/.local/share/mise/shims:" .. vim.env.PATH -- vim.env.PATH = vim.env.HOME .. "/.local/share/mise/shims:" .. vim.env.PATH
vim.opt.undofile = true vim.opt.undofile = true
vim.opt.autowriteall = true vim.opt.autowriteall = true
vim.opt.swapfile = false vim.opt.swapfile = false
vim.opt.writebackup = true vim.opt.writebackup = true
vim.g.CheatSheetDisableFrameworkDetection = 0 vim.g.CheatSheetDisableFrameworkDetection = 0
vim.g.ruby_host_prog = "$HOME/.local/share/mise/shims/ruby" if current_platform.is_mac or current_platform.is_linux then
vim.g.python_host_prog = "$HOME/.local/share/mise/shims/python3" vim.g.ruby_host_prog = "$HOME/.local/share/mise/shims/ruby"
vim.g.node_host_prog = "$HOME/.local/share/mise/shims/node" vim.g.python_host_prog = "$HOME/.local/share/mise/shims/python3"
vim.g.node_host_prog = "$HOME/.local/share/mise/shims/node"
elseif current_platform.is_win then
vim.g.node_host_prog = "C:\\Users\\jtaylor\\AppData\\Local\\fnm_multishells\\6748_1721478808937\\node.exe"
vim.g.python_host_prog = "C:\\Users\\jtaylor\\.pyenv\\pyenv-win\\shims\\python.bat"
vim.g.ruby_host_prog = "C:\\Users\\jtaylor\\scoop\\apps\\ruby\\current\\bin\\ruby.exe"
end

View File

@ -0,0 +1,20 @@
local wezterm = require('wezterm')
local function is_found(str, pattern)
return string.find(str, pattern) ~= nil
end
local function platform()
local is_win = is_found(wezterm.target_triple, 'windows')
local is_linux = is_found(wezterm.target_triple, 'linux')
local is_mac = is_found(wezterm.target_triple, 'apple')
local os = is_win and 'windows' or is_linux and 'linux' or is_mac and 'mac' or 'unknown'
return {
os = os,
is_win = is_win,
is_linux = is_linux,
is_mac = is_mac,
}
end
return platform