summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/grid.lua6
-rw-r--r--ar/.config/TheSiahxyz/lua/thesiahxyz/utils/utils.lua14
2 files changed, 10 insertions, 10 deletions
diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/grid.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/grid.lua
index 6616b1e..ced539b 100644
--- a/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/grid.lua
+++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/cheatsheet/grid.lua
@@ -78,14 +78,14 @@ return function(buf, win, action)
-- Highlight ASCII art and title
for i = 1, #ascii_header do
- api.nvim_buf_add_highlight(buf, ns, "ThesiahAsciiHeader", i - 1, 0, -1)
+ vim.hl.range(buf, ns, "ThesiahAsciiHeader", { i - 1, 0 }, { i - 1, -1 }, {})
end
- api.nvim_buf_add_highlight(buf, ns, "Title", #ascii + 1, 0, -1)
+ vim.hl.range(buf, ns, "Title", { #ascii + 1, 0 }, { #ascii + 1, -1 }, {})
-- Highlight section headers
local current_line = #ascii + 3 -- Adjust for blank lines and title
for section_name, mappings in pairs(state.mappings_tb) do
- api.nvim_buf_add_highlight(buf, ns, "ThesiahSection", current_line, 0, -1)
+ vim.hl.range(buf, ns, "TheSiahSection", { current_line, 0 }, { current_line, -1 }, {})
current_line = current_line + #mappings + 2 -- Count section header, mappings, and blank line
end
diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/utils.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/utils.lua
index f4d280b..24aa264 100644
--- a/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/utils.lua
+++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/utils/utils.lua
@@ -68,8 +68,8 @@ vim.api.nvim_set_keymap(
)
function M.create_floating_scratch(content)
-- Get editor dimensions
- local width = vim.api.nvim_get_option("columns")
- local height = vim.api.nvim_get_option("lines")
+ local width = vim.api.nvim_get_option_value("columns", {})
+ local height = vim.api.nvim_get_option_value("lines", {})
-- Calculate the floating window size
local win_height = math.ceil(height * 0.8) + 2 -- Adding 2 for the border
@@ -81,9 +81,9 @@ function M.create_floating_scratch(content)
-- Create a buffer and set it as a scratch buffer
local buf = vim.api.nvim_create_buf(false, true)
- vim.api.nvim_buf_set_option(buf, "buftype", "nofile")
- vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
- vim.api.nvim_buf_set_option(buf, "filetype", "sh") -- for syntax highlighting
+ vim.api.nvim_set_option_value("buftype", "nofile", { buf = buf })
+ vim.api.nvim_set_option_value("bufhidden", "wipe", { buf = buf })
+ vim.api.nvim_set_option_value("filetype", "sh", { buf = buf }) -- for syntax highlighting
-- Create the floating window with a border and set some options
local win = vim.api.nvim_open_win(buf, true, {
@@ -102,8 +102,8 @@ function M.create_floating_scratch(content)
vim.api.nvim_buf_set_lines(buf, 0, -1, true, { "This is a scratch buffer in a floating window." })
end
- vim.api.nvim_win_set_option(win, "wrap", false)
- vim.api.nvim_win_set_option(win, "cursorline", true)
+ vim.api.nvim_set_option_value("wrap", false, { win = win })
+ vim.api.nvim_set_option_value("cursorline", true, { win = win })
-- Map 'q' to close the buffer in this window
vim.api.nvim_buf_set_keymap(buf, "n", "q", ":q!<CR>", { noremap = true, silent = true })