🐛 fix(multiplatform): adjustments to support multiple platforms
This commit is contained in:
+19
-5
@@ -16,33 +16,47 @@ local data = require("data")
|
||||
local add_keymap = data.func.add_keymap
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━ General Keybinds ━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
-- Add keymaps for miscellaneous keybinds
|
||||
for _, item in ipairs(data.keys.misc) do
|
||||
add_keymap(item)
|
||||
end
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Group Keybinds ━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
-- Add keymaps for menu groups
|
||||
for _, item in ipairs(data.keys.groups) do
|
||||
add_keymap(item)
|
||||
end
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Resizing splits ━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
-- Add keymaps for resizing splits
|
||||
for _, map in ipairs(data.keys.splits.resize) do
|
||||
add_keymap(map[1], map[2], map[3], data.types.all_modes)
|
||||
end
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━ Moving between splits ━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
-- Add keymaps for moving between splits
|
||||
for _, map in ipairs(data.keys.splits.move) do
|
||||
add_keymap(map[1], map[2], map[3], data.types.all_modes)
|
||||
end
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━ Swapping buffers between windows ━━━━━━━━━━━━━━━
|
||||
|
||||
-- Add keymaps for swapping buffers
|
||||
for _, map in ipairs(data.keys.splits.swap) do
|
||||
add_keymap(map[1], map[2], map[3], data.types.all_modes)
|
||||
end
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Overrides ━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- Add keymaps for overrides
|
||||
add_keymap(data.keys.overrides)
|
||||
|
||||
add_keymap("<leader>qP", function()
|
||||
data.func.InputPrompt("Enter your name: ", function(input)
|
||||
if input then
|
||||
-- trim whitespace from end of input
|
||||
input = input:gsub("%s+$", "")
|
||||
print("👋😎 Hello " .. input .. "!")
|
||||
else
|
||||
print("Input was canceled")
|
||||
end
|
||||
end)
|
||||
end, "Test Prompt")
|
||||
|
||||
+53
-30
@@ -7,30 +7,42 @@
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
-- stylua: ignore start
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Leader Key ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.mapleader = " " ---@type string Options: <leader>
|
||||
vim.g.maplocalleader = " " ---@type string Options: <localleader>
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Key Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.mapleader = " " ---@type string Options: <leader>
|
||||
vim.g.maplocalleader = " " ---@type string Options: <localleader>
|
||||
-- vim.g.timeoutlen = 1000 ---@type integer Options: <ms>
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ LSP ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- We don't need perl
|
||||
vim.g.loaded_perl_provider = 0 ---@type integer Options: <0|1>
|
||||
vim.g.loaded_ruby_provider = 0 ---@type integer Options: <0|1>
|
||||
-- Prefer basedpyright
|
||||
vim.g.lazyvim_python_lsp = "basedpyright" ---@type string Options: [python lsp]
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ OS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- Check if we are on windows
|
||||
vim.g.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1
|
||||
vim.g.loaded_perl_provider = 0 ---@type integer Options: <0|1>
|
||||
-- or ruby
|
||||
vim.g.loaded_ruby_provider = 0 ---@type integer Options: <0|1>
|
||||
-- Prefer basedpyright for python
|
||||
vim.g.lazyvim_python_lsp = "basedpyright" ---@type string Options: [python lsp]
|
||||
-- Open all folds by default
|
||||
vim.opt.foldlevel = 99 ---@type integer Options: <0-99>
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ROOTIEST ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- Use WakaTime for code stats
|
||||
vim.g.usewakatime = true ---@type boolean Options: <true|false>
|
||||
vim.g.usemusic = true ---@type boolean Options: <true|false>
|
||||
-- Allow music controls and stats
|
||||
vim.g.usemusic = false ---@type boolean Options: <true|false>
|
||||
-- Enable HardTime on startup
|
||||
vim.g.usehardtime = false ---@type boolean Options: <true|false>
|
||||
-- Enable Image plugin on compatible terminals
|
||||
vim.g.useimage = true ---@type boolean Options: <true|false>
|
||||
-- Ignore missing lazy.nvim plugin manager
|
||||
vim.g.ignore_no_lazy = false ---@type boolean Options: <true|false>
|
||||
-- Enable codesnap for code screenshots
|
||||
vim.g.codesnap = true ---@type boolean Options: <true|false>
|
||||
-- Enable Auto-hiding cursorline
|
||||
vim.g.auto_cursorline = true ---@type boolean Options: <true|false>
|
||||
-- Enable Auto-save
|
||||
vim.g.auto_save = true ---@type boolean Options: <true|false>
|
||||
-- Animate blinky cursor
|
||||
vim.g.blinky = true ---@type boolean Options: <true|false>
|
||||
-- Use Rootiest cmd window instead of cmdline
|
||||
vim.g.rootiest_cmd = false ---@type boolean Options: <true|false>
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ AI TOOL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.aitool = "codeium" ---@type string Options: [ai tool]
|
||||
@@ -42,15 +54,6 @@ vim.g.aitool = "codeium" ---@type string Options: [ai tool]
|
||||
-- │ │ none
|
||||
-- ╰───────────────────────────╯
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ STATUS LINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.statusline = "lualine" ---@type string Options: [statusline]
|
||||
-- ╭───────────────────────────╮ lualine
|
||||
-- │ │ heirline
|
||||
-- │ Status Lines: │ basic
|
||||
-- │ Choose a plugin from │ none
|
||||
-- │ the list │
|
||||
-- │ │
|
||||
-- ╰───────────────────────────╯
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ STATUS COLUMN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.statuscolumn = "native" ---@type string Options: [statuscolumn]
|
||||
-- ╭───────────────────────────╮ barsNlines
|
||||
@@ -60,8 +63,9 @@ vim.g.statuscolumn = "native" ---@type string Options: [statuscolumn]
|
||||
-- │ the list │
|
||||
-- │ │
|
||||
-- ╰───────────────────────────╯
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BUFFER LINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.tabline = "bufferline" ---@type string Options: [tabline]
|
||||
vim.g.tabline = "none" ---@type string Options: [tabline]
|
||||
-- ╭───────────────────────────╮ bufferline
|
||||
-- │ │ barsNlines
|
||||
-- │ Tab Lines: │ none
|
||||
@@ -69,17 +73,32 @@ vim.g.tabline = "bufferline" ---@type string Options: [tabline]
|
||||
-- │ the list │
|
||||
-- │ │
|
||||
-- ╰───────────────────────────╯
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ STATUS LINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
vim.g.statusline = "lualine" ---@type string Options: [statusline]
|
||||
-- ╭───────────────────────────╮ lualine
|
||||
-- │ │ heirline
|
||||
-- │ Status Lines: │ barsNlines
|
||||
-- │ Choose a plugin from │ basic
|
||||
-- │ the list │ none
|
||||
-- │ │
|
||||
-- ╰───────────────────────────╯
|
||||
--
|
||||
-- Click git components on statusline to open LazyGit
|
||||
vim.g.statusline_clickable_git = false ---@type boolean Options: <true|false>
|
||||
-- Show wakatime stats on statusline
|
||||
vim.g.stats_wakatime = true ---@type boolean Options: <true|false>
|
||||
-- Show music stats on statusline
|
||||
vim.g.stats_music = true ---@type boolean Options: <true|false>
|
||||
-- Ignored player sources for music stats
|
||||
vim.g.stats_ignored_players = { ---@type string[] Options: [ignored players]
|
||||
"chromium",
|
||||
"firefox",
|
||||
"kdeconnect",
|
||||
"haruna",
|
||||
"plasma-browser-integration",
|
||||
"plasma-browser-integration-76042",
|
||||
}
|
||||
"chromium",
|
||||
"firefox",
|
||||
"kdeconnect",
|
||||
"haruna",
|
||||
"plasma-browser-integration",
|
||||
"plasma-browser-integration-76042",
|
||||
}
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ COLOR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- Background color
|
||||
@@ -91,5 +110,9 @@ vim.g.disable_transparency = true ---@type boolean Options: <true|false>
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Completion ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- Cmp Window Border
|
||||
vim.g.completion_round_borders_enabled = true ---Options: <true|false>
|
||||
vim.g.completion_round_borders_enabled = true ---@type boolean Options: <true|false>
|
||||
|
||||
-- stylua: ignore end
|
||||
|
||||
-- Post-Config Operations
|
||||
require("config.post-ops")
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
---@module "config.post_ops"
|
||||
--- This module contains the functions that exectute after
|
||||
--- the options.lua file has been loaded.
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Post Ops │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
local M = {}
|
||||
|
||||
M.apply_options = function()
|
||||
-- Setup blinky cursor
|
||||
require("utils.blinky").setup(vim.g.blinky)
|
||||
|
||||
-- Setup Rootiest cmd window
|
||||
require("utils.cmd_window").setup({
|
||||
override_cmdline = vim.g.rootiest_cmd and true or nil,
|
||||
})
|
||||
end
|
||||
|
||||
-- Setup post-ops module
|
||||
M.setup = function()
|
||||
M.apply_options()
|
||||
end
|
||||
|
||||
-- Call setup
|
||||
M.setup()
|
||||
|
||||
return M
|
||||
+100
-60
@@ -7,80 +7,118 @@
|
||||
local M = {}
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━ Bootstrap rocks.nvim ━━━━━━━━━━━━━━━━━━━━━
|
||||
do
|
||||
local rocks_config = {
|
||||
rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks",
|
||||
}
|
||||
function M.bootstrap()
|
||||
do
|
||||
local rocks_config = {
|
||||
rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks",
|
||||
}
|
||||
|
||||
vim.g.rocks_nvim = rocks_config
|
||||
vim.g.rocks_nvim = rocks_config
|
||||
|
||||
local luarocks_path = {
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
|
||||
vim.fs.joinpath(
|
||||
rocks_config.rocks_path,
|
||||
"share",
|
||||
"lua",
|
||||
"5.1",
|
||||
"?",
|
||||
"init.lua"
|
||||
),
|
||||
}
|
||||
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")
|
||||
local luarocks_path = {
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
|
||||
vim.fs.joinpath(
|
||||
rocks_config.rocks_path,
|
||||
"share",
|
||||
"lua",
|
||||
"5.1",
|
||||
"?",
|
||||
"init.lua"
|
||||
),
|
||||
}
|
||||
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")
|
||||
|
||||
local luarocks_cpath = {
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
|
||||
-- Remove the dylib and dll paths if you do not need macos or windows support
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dylib"),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"),
|
||||
}
|
||||
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")
|
||||
local luarocks_cpath = {
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
|
||||
-- Remove the dylib and dll paths if you do not need macos or windows support
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"),
|
||||
vim.fs.joinpath(
|
||||
rocks_config.rocks_path,
|
||||
"lib64",
|
||||
"lua",
|
||||
"5.1",
|
||||
"?.dylib"
|
||||
),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"),
|
||||
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"),
|
||||
}
|
||||
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")
|
||||
|
||||
vim.opt.runtimepath:append(
|
||||
vim.fs.joinpath(
|
||||
rocks_config.rocks_path,
|
||||
"lib",
|
||||
"luarocks",
|
||||
"rocks-5.1",
|
||||
"rocks.nvim",
|
||||
"*"
|
||||
vim.opt.runtimepath:append(
|
||||
vim.fs.joinpath(
|
||||
rocks_config.rocks_path,
|
||||
"lib",
|
||||
"luarocks",
|
||||
"rocks-5.1",
|
||||
"rocks.nvim",
|
||||
"*"
|
||||
)
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
-- If rocks.nvim is not installed then install it!
|
||||
if not pcall(require, "rocks") then
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
local rocks_location = vim.fs.joinpath(vim.fn.stdpath("cache"), "rocks.nvim")
|
||||
|
||||
if not vim.uv.fs_stat(rocks_location) then
|
||||
-- Pull down rocks.nvim
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/nvim-neorocks/rocks.nvim",
|
||||
rocks_location,
|
||||
})
|
||||
end
|
||||
|
||||
-- If the clone was successful then source the bootstrapping script
|
||||
assert(
|
||||
vim.v.shell_error == 0,
|
||||
"rocks.nvim installation failed. Try exiting and re-entering Neovim!"
|
||||
)
|
||||
-- If rocks.nvim is not installed then install it!
|
||||
if not pcall(require, "rocks") then
|
||||
local rocks_location =
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.fs.joinpath(vim.fn.stdpath("cache"), "rocks.nvim")
|
||||
|
||||
vim.cmd.source(vim.fs.joinpath(rocks_location, "bootstrap.lua"))
|
||||
if not vim.uv.fs_stat(rocks_location) then
|
||||
-- Pull down rocks.nvim
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/nvim-neorocks/rocks.nvim",
|
||||
rocks_location,
|
||||
})
|
||||
end
|
||||
|
||||
vim.fn.delete(rocks_location, "rf")
|
||||
-- If the clone was successful then source the bootstrapping script
|
||||
assert(
|
||||
vim.v.shell_error == 0,
|
||||
"rocks.nvim installation failed. Try exiting and re-entering Neovim!"
|
||||
)
|
||||
|
||||
vim.cmd.source(vim.fs.joinpath(rocks_location, "bootstrap.lua"))
|
||||
|
||||
vim.fn.delete(rocks_location, "rf")
|
||||
end
|
||||
end
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Ensure Luarocks ━━━━━━━━━━━━━━━━━━━━━━━
|
||||
function M.ensure_luarocks()
|
||||
-- Check if 'luarocks' command is available
|
||||
if os.execute("luarocks --version") ~= 0 then
|
||||
-- 'luarocks' is not installed, set up 'luarocks.nvim' plugin
|
||||
local status_ok, lazy = pcall(require, "lazy")
|
||||
if not status_ok then
|
||||
vim.notify(
|
||||
"Lazy.nvim not found. Please install it to manage plugins.",
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
lazy.setup({
|
||||
{
|
||||
"vhyrro/luarocks.nvim",
|
||||
priority = 1000, -- Ensure this plugin loads first
|
||||
opts = {
|
||||
rocks = { "magick" }, -- Example of a rock that you want to install
|
||||
},
|
||||
config = function()
|
||||
-- Restart Neovim to apply changes after 'luarocks.nvim' sets up
|
||||
vim.cmd("source $MYVIMRC | qa")
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Rocks plugin spec ━━━━━━━━━━━━━━━━━━━━━━
|
||||
M.plugin_spec = {
|
||||
"vhyrro/luarocks.nvim",
|
||||
priority = 1000, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
|
||||
priority = 1000, -- Very high priority is required
|
||||
opts = {
|
||||
rocks = { "magick" }, -- specifies a list of rocks to install
|
||||
},
|
||||
@@ -94,6 +132,8 @@ end
|
||||
|
||||
-- Perform setup
|
||||
M.setup = function()
|
||||
M.bootstrap()
|
||||
M.ensure_luarocks()
|
||||
M.load_rocks()
|
||||
end
|
||||
|
||||
|
||||
+6
-16
@@ -13,6 +13,11 @@ local function trigger_error(message)
|
||||
return require("data").func.notify(message, "ERROR")
|
||||
end
|
||||
|
||||
local function setup_os_vars()
|
||||
-- Check if we are on windows
|
||||
vim.g.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1
|
||||
end
|
||||
|
||||
--- Yank line without leading/trailing whitespace
|
||||
---@return nil
|
||||
function M.yank_line()
|
||||
@@ -180,6 +185,7 @@ end
|
||||
|
||||
--- Set up rootiest module
|
||||
function M.setup()
|
||||
setup_os_vars()
|
||||
M.eval_neovide()
|
||||
M.define_commands()
|
||||
|
||||
@@ -187,22 +193,6 @@ function M.setup()
|
||||
require("data.types").setup()
|
||||
-- Setup indentor
|
||||
require("utils.indentor")
|
||||
|
||||
---━━━━━━━━━━━━━━━━━━━━━━━━━━ Rootiest cmd window ━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
--
|
||||
-- Setup Rootiest cmd window utility
|
||||
require("utils.cmd_window").setup()
|
||||
|
||||
-- Setup Rootiest cmd window (override default command-line behavior)
|
||||
-- require("utils.cmd_window").setup({ override_cmdline = true })
|
||||
|
||||
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLINKY CURSOR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
-- Setup the blinky cursor if it is enabled
|
||||
if vim.g.blinky ~= false then
|
||||
require("utils").blinky.enable()
|
||||
else
|
||||
require("utils").blinky.disable()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user