From a4c2dc4d0b638a50c3219f247b09e6238a44ec50 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Thu, 15 Sep 2022 23:33:08 -0400 Subject: refactor: small improvements (#3021) --- lua/lvim/core/lir.lua | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 lua/lvim/core/lir.lua (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..e14e01cd --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,90 @@ +local M = {} + +M.config = function() + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + local actions = require "lir.actions" + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" + + lir.setup { + show_hidden_files = false, + devicons_enable = true, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["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, + + ["J"] = function() + 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, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) + end, + } + + -- custom folder icon + require("nvim-web-devicons").set_icon { + lir_folder_icon = { + icon = "", + -- color = "#7ebae4", + -- color = "#569CD6", + color = "#42A5F5", + name = "LirFolderNode", + }, + } +end +return M -- cgit v1.2.3 From 62d9a4ea9df1828af2cbc6c5f42774f1662aaab4 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 16 Sep 2022 11:15:18 +0200 Subject: revert: remove incomplete lir integration (#3030) --- lua/lvim/core/lir.lua | 90 --------------------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 lua/lvim/core/lir.lua (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua deleted file mode 100644 index e14e01cd..00000000 --- a/lua/lvim/core/lir.lua +++ /dev/null @@ -1,90 +0,0 @@ -local M = {} - -M.config = function() - local status_ok, lir = pcall(require, "lir") - if not status_ok then - return - end - - local actions = require "lir.actions" - local mark_actions = require "lir.mark.actions" - local clipboard_actions = require "lir.clipboard.actions" - - lir.setup { - show_hidden_files = false, - devicons_enable = true, - mappings = { - ["l"] = actions.edit, - [""] = actions.edit, - [""] = actions.split, - ["v"] = actions.vsplit, - [""] = actions.tabedit, - - ["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, - - ["J"] = function() - 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, - -- row = 1, - -- col = math.floor((vim.o.columns - width) / 2), - } - end, - }, - hide_cursor = false, - on_init = function() - -- use visual mode - vim.api.nvim_buf_set_keymap( - 0, - "x", - "J", - ':lua require"lir.mark.actions".toggle_mark("v")', - { noremap = true, silent = true } - ) - - -- echo cwd - -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) - end, - } - - -- custom folder icon - require("nvim-web-devicons").set_icon { - lir_folder_icon = { - icon = "", - -- color = "#7ebae4", - -- color = "#569CD6", - color = "#42A5F5", - name = "LirFolderNode", - }, - } -end -return M -- cgit v1.2.3 From 77fdcd43cb77b50fc925487132f6aabd31760337 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 16 Sep 2022 17:47:40 +0200 Subject: feat: add lir.nvim (#3031) --- lua/lvim/core/lir.lua | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 lua/lvim/core/lir.lua (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..38b05b9c --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,107 @@ +local M = {} + +local Log = require "lvim.core.log" +M.config = function() + lvim.builtin.lir = { + active = false, + on_config_done = nil, + } + + local status_ok, actions = pcall(require, "lir.actions") + if not status_ok then + return + end + + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" + lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, { + setup = { + show_hidden_files = false, + devicons_enable = true, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["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, + + ["J"] = function() + 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, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) + end, + }, + icons = { + lir_folder_icon = { + icon = "", + -- color = "#7ebae4", + -- color = "#569CD6", + color = "#42A5F5", + name = "LirFolderNode", + }, + }, + }) +end + +function M.setup() + if lvim.builtin.nvimtree.active then + Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" + return + end + local lir = require "lir" + lir.setup(lvim.builtin.lir.setup) + require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) + + if lvim.builtin.lir.on_config_done then + lvim.builtin.lir.on_config_done(lir) + end +end +return M -- cgit v1.2.3 From 26d493419af23244fe6ca3daf3477c7b5d95c36e Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 17 Sep 2022 13:42:46 +0200 Subject: revert: lir.nvim is still broken (#3036) --- lua/lvim/core/lir.lua | 107 -------------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 lua/lvim/core/lir.lua (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua deleted file mode 100644 index 38b05b9c..00000000 --- a/lua/lvim/core/lir.lua +++ /dev/null @@ -1,107 +0,0 @@ -local M = {} - -local Log = require "lvim.core.log" -M.config = function() - lvim.builtin.lir = { - active = false, - on_config_done = nil, - } - - local status_ok, actions = pcall(require, "lir.actions") - if not status_ok then - return - end - - local mark_actions = require "lir.mark.actions" - local clipboard_actions = require "lir.clipboard.actions" - lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, { - setup = { - show_hidden_files = false, - devicons_enable = true, - mappings = { - ["l"] = actions.edit, - [""] = actions.edit, - [""] = actions.split, - ["v"] = actions.vsplit, - [""] = actions.tabedit, - - ["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, - - ["J"] = function() - 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, - -- row = 1, - -- col = math.floor((vim.o.columns - width) / 2), - } - end, - }, - hide_cursor = false, - on_init = function() - -- use visual mode - vim.api.nvim_buf_set_keymap( - 0, - "x", - "J", - ':lua require"lir.mark.actions".toggle_mark("v")', - { noremap = true, silent = true } - ) - -- echo cwd - -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) - end, - }, - icons = { - lir_folder_icon = { - icon = "", - -- color = "#7ebae4", - -- color = "#569CD6", - color = "#42A5F5", - name = "LirFolderNode", - }, - }, - }) -end - -function M.setup() - if lvim.builtin.nvimtree.active then - Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" - return - end - local lir = require "lir" - lir.setup(lvim.builtin.lir.setup) - require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) - - if lvim.builtin.lir.on_config_done then - lvim.builtin.lir.on_config_done(lir) - end -end -return M -- cgit v1.2.3 From a331ef711bc6c73e78535e9b4fa44d54c937aa88 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 11:44:04 -0400 Subject: feat: add lir.nvim again (#3038) --- lua/lvim/core/lir.lua | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 lua/lvim/core/lir.lua (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..694ea4eb --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,117 @@ +local M = {} + +local Log = require "lvim.core.log" + +M.config = function() + lvim.builtin.lir = { + active = true, + on_config_done = nil, + } + + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + local actions = require "lir.actions" + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" + + lir.setup { + show_hidden_files = false, + devicons_enable = true, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["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, + + ["J"] = function() + 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, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) + end, + } + + -- custom folder icon + require("nvim-web-devicons").set_icon { + lir_folder_icon = { + icon = "", + -- color = "#7ebae4", + -- color = "#569CD6", + color = "#42A5F5", + name = "LirFolderNode", + }, + } +end + +function M.setup() + if lvim.builtin.nvimtree.active then + Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" + return + end + + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + lir.setup(lvim.builtin.lir.setup) + require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) + + if lvim.builtin.lir.on_config_done then + lvim.builtin.lir.on_config_done(lir) + end +end + +return M -- cgit v1.2.3 From bb4a3769f9ac52cafb44de54cd5745467f0d7c15 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 19:06:30 -0400 Subject: fix: remove warning message --- lua/lvim/core/lir.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index 694ea4eb..25f3820f 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -97,7 +97,7 @@ end function M.setup() if lvim.builtin.nvimtree.active then - Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" + -- Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" return end -- cgit v1.2.3 From 2190dba4c7e297568549743476b8f76c620ae4cc Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 19:35:57 -0400 Subject: feat: a less noisy tree (#3042) --- lua/lvim/core/lir.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index 25f3820f..e65d45dd 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -1,6 +1,6 @@ local M = {} -local Log = require "lvim.core.log" +-- local Log = require "lvim.core.log" M.config = function() lvim.builtin.lir = { -- cgit v1.2.3 From 1c03ac80529d90c7a824a581172b6e41e6ae237b Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 3 Oct 2022 00:56:23 +0000 Subject: feat: reload and lir color update (#3123) --- lua/lvim/core/lir.lua | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index e65d45dd..a47c40b6 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -1,21 +1,20 @@ local M = {} --- local Log = require "lvim.core.log" - M.config = function() lvim.builtin.lir = { active = true, on_config_done = nil, + icon = "", } - local status_ok, lir = pcall(require, "lir") + local status_ok, lir = pcall(reload, "lir") if not status_ok then return end - local actions = require "lir.actions" - local mark_actions = require "lir.mark.actions" - local clipboard_actions = require "lir.clipboard.actions" + local actions = reload "lir.actions" + local mark_actions = reload "lir.mark.actions" + local clipboard_actions = reload "lir.clipboard.actions" lir.setup { show_hidden_files = false, @@ -84,31 +83,45 @@ M.config = function() } -- custom folder icon - require("nvim-web-devicons").set_icon { + reload("nvim-web-devicons").set_icon { lir_folder_icon = { icon = "", - -- color = "#7ebae4", - -- color = "#569CD6", color = "#42A5F5", name = "LirFolderNode", }, } end +function M.icon_setup() + local function get_hl_by_name(name) + local ret = vim.api.nvim_get_hl_by_name(name.group, true) + return string.format("#%06x", ret[name.property]) + end + + local found, icon_hl = pcall(get_hl_by_name, { group = "NvimTreeFolderIcon", property = "foreground" }) + if not found then + icon_hl = "#42A5F5" + end + + reload("nvim-web-devicons").set_icon { + lir_folder_icon = { + icon = lvim.builtin.lir.icon, + color = icon_hl, + name = "LirFolderNode", + }, + } +end + function M.setup() if lvim.builtin.nvimtree.active then - -- Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" return end - local status_ok, lir = pcall(require, "lir") + local status_ok, lir = pcall(reload, "lir") if not status_ok then return end - lir.setup(lvim.builtin.lir.setup) - require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) - if lvim.builtin.lir.on_config_done then lvim.builtin.lir.on_config_done(lir) end -- cgit v1.2.3 From 8767a17b5e6087153494a5cd30e5ae0c5165c9af Mon Sep 17 00:00:00 2001 From: Philippe Richard Date: Sun, 2 Oct 2022 23:48:23 -0400 Subject: feat: move icons to a single icons file (#3115) --- lua/lvim/core/lir.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index a47c40b6..af9eb549 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -85,7 +85,7 @@ M.config = function() -- custom folder icon reload("nvim-web-devicons").set_icon { lir_folder_icon = { - icon = "", + icon = lvim.icons.ui.Folder, color = "#42A5F5", name = "LirFolderNode", }, -- cgit v1.2.3 From e5bcf01c759e7c833d8a5f1fcf665b6ea32a7c16 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 4 Oct 2022 19:23:52 +0200 Subject: refactor: more deliberate reload (#3133) --- lua/lvim/core/lir.lua | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'lua/lvim/core/lir.lua') diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index af9eb549..68445664 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -7,16 +7,16 @@ M.config = function() icon = "", } - local status_ok, lir = pcall(reload, "lir") + local status_ok, _ = pcall(require, "lir") if not status_ok then return end - local actions = reload "lir.actions" - local mark_actions = reload "lir.mark.actions" - local clipboard_actions = reload "lir.clipboard.actions" + local actions = require "lir.actions" + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" - lir.setup { + lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, { show_hidden_files = false, devicons_enable = true, mappings = { @@ -80,16 +80,7 @@ M.config = function() -- echo cwd -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) end, - } - - -- custom folder icon - reload("nvim-web-devicons").set_icon { - lir_folder_icon = { - icon = lvim.icons.ui.Folder, - color = "#42A5F5", - name = "LirFolderNode", - }, - } + }) end function M.icon_setup() @@ -113,14 +104,11 @@ function M.icon_setup() end function M.setup() - if lvim.builtin.nvimtree.active then - return - end - local status_ok, lir = pcall(reload, "lir") if not status_ok then return end + lir.setup(lvim.builtin.lir) if lvim.builtin.lir.on_config_done then lvim.builtin.lir.on_config_done(lir) -- cgit v1.2.3