FIX: Changed naming convention to be the same throughout the presets
file and fixed neovim api for temrinal. Update: Changed how presets are made to be simpler
This commit is contained in:
+13
-31
@@ -1,61 +1,43 @@
|
||||
---@type table
|
||||
local M = {}
|
||||
|
||||
---@type table
|
||||
local opts = {}
|
||||
|
||||
---@class Preset
|
||||
---@field left_padding integer
|
||||
---@field right_padding integer
|
||||
---@field top_padding integer
|
||||
---@field bottom_padding integer
|
||||
|
||||
---@type Preset
|
||||
local center = {
|
||||
M.presets = {
|
||||
centered = {
|
||||
left_padding = 0,
|
||||
right_padding = 0,
|
||||
top_padding = 0,
|
||||
bottom_padding = 0
|
||||
}
|
||||
|
||||
---@type Preset
|
||||
local center_panel = {
|
||||
},
|
||||
center_panel = {
|
||||
left_padding = 0,
|
||||
right_padding = 100,
|
||||
top_padding = 0,
|
||||
bottom_padding = 0,
|
||||
}
|
||||
|
||||
---@type Preset
|
||||
local right_panel = {
|
||||
},
|
||||
right_panel = {
|
||||
left_padding = 100,
|
||||
right_padding = 0,
|
||||
top_padding = 0,
|
||||
bottom_padding = 0,
|
||||
}
|
||||
|
||||
---@type Preset
|
||||
local corner = {
|
||||
},
|
||||
cornered = {
|
||||
left_padding = 100,
|
||||
right_padding = 0,
|
||||
top_padding = 25,
|
||||
bottom_padding = 0,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
---@param preset string
|
||||
---@return table
|
||||
function M.getPresets(preset)
|
||||
-- if preset == "custom" then
|
||||
-- opts = nil
|
||||
if preset == "centered" then
|
||||
opts = center
|
||||
opts = M.presets.centered
|
||||
elseif preset == "center_panel" then
|
||||
opts = center_panel
|
||||
opts = M.presets.center_panel
|
||||
elseif preset == "right_panel" then
|
||||
opts = right_panel
|
||||
opts = M.presets.right_panel
|
||||
elseif preset == "cornered" then
|
||||
opts = corner
|
||||
opts = M.presets.cornered
|
||||
else
|
||||
print("Preset option: " .. preset .. " does not exist")
|
||||
end
|
||||
|
||||
@@ -60,9 +60,9 @@ function M.open_float_terminal(cmd)
|
||||
vim.api.nvim_set_option_value("cursorline", true, { win = win })
|
||||
vim.api.nvim_set_option_value("scrolloff", 5, { win = win })
|
||||
if(M.opts.number == true) then
|
||||
vim.api.nvim_win_set_option("number", true, { win = win })
|
||||
vim.api.nvim_set_option_value("number", true, { win = win })
|
||||
if(M.opts.relativenumber == true) then
|
||||
vim.api.nvim_win_set_option("relativenumber", true, { win = win })
|
||||
vim.api.nvim_set_option_value("relativenumber", true, { win = win })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user