From f6e377fcfed932b71456a0b0780c1f5ed22cabd4 Mon Sep 17 00:00:00 2001 From: Jonathan Raines Date: Tue, 6 Jul 2021 12:40:10 -0500 Subject: Replace LazyGit Plugin with FTerm Instance (#717) * Replace LazyGit Plugin with FTerm Instance * Added gg keybind to FTerm LazyGit * Added check to see if lazygit is installed * Changed lazyload event to prevent error when called from dashboard on startup * Removed lazygit plugin. Changed Fterm lazy loading * Made the executable check more universal for when we include other terminal applications Co-authored-by: rebuilt --- lua/lv-which-key/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lua/lv-which-key') diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index 5fb3c92d..a14a82b6 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -263,8 +263,12 @@ if O.plugin.zen.active then vim.api.nvim_set_keymap("n", "z", ":ZenMode", { noremap = true, silent = true }) mappings["z"] = "Zen" end -if O.plugin.lazygit.active then - vim.api.nvim_set_keymap("n", "gg", ":LazyGit", { noremap = true, silent = true }) +if O.plugin.floatterm.active then + vim.api.nvim_set_keymap("n", "gg", "lua _G.__fterm_lazygit()", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "", "lua require('FTerm').toggle()", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("t", "", "lua require('FTerm').toggle()", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "", "lua _G.__fterm_lazygit()", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("t", "", "lua _G.__fterm_lazygit()", { noremap = true, silent = true }) mappings["gg"] = "LazyGit" end if O.plugin.telescope_project.active then -- cgit v1.2.3 From 0e2ad0c1fec50a24177129c89b3edb9007776caf Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 6 Jul 2021 19:15:37 -0400 Subject: testing autosave config poetnetially unstable --- lua/lv-which-key/init.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lua/lv-which-key') diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index a14a82b6..8edb244b 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -120,7 +120,7 @@ local mappings = { name = "Packer", c = { "PackerCompile", "Compile" }, i = { "PackerInstall", "Install" }, - r = { ":luafile %", "Reload" }, + r = { "lua require('lv-utils').reload_lv_config()", "Reload" }, s = { "PackerSync", "Sync" }, u = { "PackerUpdate", "Update" }, }, @@ -266,9 +266,19 @@ end if O.plugin.floatterm.active then vim.api.nvim_set_keymap("n", "gg", "lua _G.__fterm_lazygit()", { noremap = true, silent = true }) vim.api.nvim_set_keymap("n", "", "lua require('FTerm').toggle()", { noremap = true, silent = true }) - vim.api.nvim_set_keymap("t", "", "lua require('FTerm').toggle()", { noremap = true, silent = true }) + vim.api.nvim_set_keymap( + "t", + "", + "lua require('FTerm').toggle()", + { noremap = true, silent = true } + ) vim.api.nvim_set_keymap("n", "", "lua _G.__fterm_lazygit()", { noremap = true, silent = true }) - vim.api.nvim_set_keymap("t", "", "lua _G.__fterm_lazygit()", { noremap = true, silent = true }) + vim.api.nvim_set_keymap( + "t", + "", + "lua _G.__fterm_lazygit()", + { noremap = true, silent = true } + ) mappings["gg"] = "LazyGit" end if O.plugin.telescope_project.active then -- cgit v1.2.3 From 716f127e95b71bdc1f1ebb960b381ba50b10c1fe Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Jul 2021 20:42:29 -0400 Subject: wrap requires in pcall --- lua/lv-which-key/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lua/lv-which-key') diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index 8edb244b..42547916 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -1,8 +1,12 @@ -- if not package.loaded['which-key'] then -- return -- end +local status_ok, which_key = pcall(require, "which-key") +if not status_ok then + return +end -require("which-key").setup { +which_key.setup { plugins = { marks = true, -- shows a list of your marks on ' and ` registers = true, -- shows your registers on " in NORMAL or in INSERT mode -- cgit v1.2.3 From 8c9ddc70908c8aa978ed13af4b962e85b6df452d Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Jul 2021 20:50:57 -0400 Subject: manual formatting with neoformat --- lua/lv-which-key/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lv-which-key') diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index 42547916..8b3a26e4 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -204,7 +204,7 @@ local mappings = { "Telescope lsp_workspace_diagnostics", "Workspace Diagnostics", }, - f = { "lua vim.lsp.buf.formatting()", "Format" }, + f = { "Neoformat", "Format" }, i = { "LspInfo", "Info" }, j = { "lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})", "Next Diagnostic" }, k = { "lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})", "Prev Diagnostic" }, -- cgit v1.2.3 From 00bf949fe8ee51d49650356e9a68cfe068e400e1 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Jul 2021 21:42:26 -0400 Subject: custom whichkey entries --- lua/lv-which-key/init.lua | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'lua/lv-which-key') diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index 8b3a26e4..f36815b6 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -65,16 +65,12 @@ vim.api.nvim_set_keymap("n", "h", ':let @/=""', { noremap = true, si -- explorer --- TODO this introduces some bugs unfortunately vim.api.nvim_set_keymap( "n", "e", ":lua require'lv-nvimtree'.toggle_tree()", { noremap = true, silent = true } ) --- vim.api.nvim_set_keymap('n', 'e', --- ":NvimTreeToggle", --- {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", "f", ":Telescope find_files", { noremap = true, silent = true }) @@ -88,8 +84,6 @@ vim.api.nvim_set_keymap("v", "/", ":CommentToggle", { noremap = true -- close buffer vim.api.nvim_set_keymap("n", "c", ":BufferClose", { noremap = true, silent = true }) --- TODO create entire treesitter section - local mappings = { ["/"] = "Comment", @@ -128,26 +122,6 @@ local mappings = { s = { "PackerSync", "Sync" }, u = { "PackerUpdate", "Update" }, }, - -- diagnostics vanilla nvim - -- -- diagnostic - -- function lv_utils.get_all() - -- vim.lsp.diagnostic.get_all() - -- end - -- function lv_utils.get_next() - -- vim.lsp.diagnostic.get_next() - -- end - -- function lv_utils.get_prev() - -- vim.lsp.diagnostic.get_prev() - -- end - -- function lv_utils.goto_next() - -- vim.lsp.diagnostic.goto_next() - -- end - -- function lv_utils.goto_prev() - -- vim.lsp.diagnostic.goto_prev() - -- end - -- function lv_utils.show_line_diagnostics() - -- vim.lsp.diagnostic.show_line_diagnostics() - -- end -- " Available Debug Adapters: -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/ @@ -320,5 +294,14 @@ if O.lushmode then } end +-- for _, v in pairs(O.user_which_key) do +-- end +for k, v in pairs(O.user_which_key) do + mappings[k] = v + -- table.insert(mappings, O.user_which_key[1]) + -- print(k) + -- print(v) +end + local wk = require "which-key" wk.register(mappings, opts) -- cgit v1.2.3