summaryrefslogtreecommitdiff
path: root/lua/lvim/core/lir.lua
diff options
context:
space:
mode:
authorLostNeophyte <[email protected]>2023-01-25 18:55:31 +0100
committerLostNeophyte <[email protected]>2023-01-25 18:55:31 +0100
commit75b653cc623a8cd6de397e42f21b838a065eb0e0 (patch)
tree7b43499c99423651d7e75662bb4628569834e28f /lua/lvim/core/lir.lua
parent4f02e54d923414eb6690d64c7e334f624a2a9342 (diff)
refactor!: put all plugin options under `opts`
Diffstat (limited to 'lua/lvim/core/lir.lua')
-rw-r--r--lua/lvim/core/lir.lua120
1 files changed, 61 insertions, 59 deletions
diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua
index af3e1840..08b2e2fb 100644
--- a/lua/lvim/core/lir.lua
+++ b/lua/lvim/core/lir.lua
@@ -6,69 +6,71 @@ M.config = function()
local clipboard_actions = utils.require_on_exported_call "lir.clipboard.actions"
local config = {
- icon = "î—¿",
- show_hidden_files = false,
- ignore = {}, -- { ".DS_Store" "node_modules" } etc.
- devicons = {
- enable = true,
- highlight_dirname = true,
- },
- mappings = {
- ["l"] = actions.edit,
- ["<CR>"] = actions.edit,
- ["<C-s>"] = actions.split,
- ["v"] = actions.vsplit,
- ["<C-t>"] = actions.tabedit,
+ opts = {
+ icon = "î—¿",
+ show_hidden_files = false,
+ ignore = {}, -- { ".DS_Store" "node_modules" } etc.
+ devicons = {
+ enable = true,
+ highlight_dirname = true,
+ },
+ mappings = {
+ ["l"] = actions.edit,
+ ["<CR>"] = actions.edit,
+ ["<C-s>"] = actions.split,
+ ["v"] = actions.vsplit,
+ ["<C-t>"] = actions.tabedit,
- ["h"] = actions.up,
- ["q"] = actions.quit,
+ ["h"] = actions.up,
+ ["q"] = actions.quit,
- ["A"] = actions.mkdir,
- ["a"] = actions.newfile,
- ["r"] = actions.rename,
- ["@"] = actions.cd,
- ["Y"] = actions.yank_path,
- ["i"] = actions.toggle_show_hidden,
- ["d"] = actions.delete,
+ ["A"] = actions.mkdir,
+ ["a"] = actions.newfile,
+ ["r"] = actions.rename,
+ ["@"] = actions.cd,
+ ["Y"] = actions.yank_path,
+ ["i"] = actions.toggle_show_hidden,
+ ["d"] = actions.delete,
- ["J"] = function()
- require("lir.mark.actions").toggle_mark()
- vim.cmd "normal! j"
- end,
- ["c"] = clipboard_actions.copy,
- ["x"] = clipboard_actions.cut,
- ["p"] = clipboard_actions.paste,
- },
- float = {
- winblend = 0,
- curdir_window = {
- enable = false,
- highlight_dirname = true,
+ ["J"] = function()
+ require("lir.mark.actions").toggle_mark()
+ vim.cmd "normal! j"
+ end,
+ ["c"] = clipboard_actions.copy,
+ ["x"] = clipboard_actions.cut,
+ ["p"] = clipboard_actions.paste,
},
+ float = {
+ winblend = 0,
+ curdir_window = {
+ enable = false,
+ highlight_dirname = true,
+ },
- -- You can define a function that returns a table to be passed as the third
- -- argument of nvim_open_win().
- win_opts = function()
- local width = math.floor(vim.o.columns * 0.7)
- local height = math.floor(vim.o.lines * 0.7)
- return {
- border = "rounded",
- width = width,
- height = height,
- }
+ -- You can define a function that returns a table to be passed as the third
+ -- argument of nvim_open_win().
+ win_opts = function()
+ local width = math.floor(vim.o.columns * 0.7)
+ local height = math.floor(vim.o.lines * 0.7)
+ return {
+ border = "rounded",
+ width = width,
+ height = height,
+ }
+ end,
+ },
+ hide_cursor = false,
+ on_init = function()
+ -- use visual mode
+ vim.api.nvim_buf_set_keymap(
+ 0,
+ "x",
+ "J",
+ ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
+ { noremap = true, silent = true }
+ )
end,
},
- hide_cursor = false,
- on_init = function()
- -- use visual mode
- vim.api.nvim_buf_set_keymap(
- 0,
- "x",
- "J",
- ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
- { noremap = true, silent = true }
- )
- end,
}
---@cast config +LvimBuiltin
require("lvim.core.builtins").extend_defaults(config)
@@ -93,7 +95,7 @@ function M.icon_setup()
devicons.set_icon {
lir_folder_icon = {
- icon = lvim.builtin.lir.icon,
+ icon = lvim.builtin.lir.opts.icon,
color = icon_hl,
name = "LirFolderNode",
},
@@ -107,10 +109,10 @@ function M.setup()
end
if not lvim.use_icons then
- lvim.builtin.lir.devicons.enable = false
+ lvim.builtin.lir.opts.devicons.enable = false
end
- lir.setup(lvim.builtin.lir)
+ lir.setup(lvim.builtin.lir.setup)
M.icon_setup()
end