From e798e34775c353743a380bed2e0a9236d5832543 Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Fri, 23 Dec 2022 16:44:45 +0100 Subject: [PATCH] feat(nvim): add fm plugin for better file managment integration --- nvim/after/plugin/fm.lua | 56 ++++++++++++++++++++++++++++++++ nvim/after/plugin/toggleterm.lua | 14 -------- nvim/lazy-lock.json | 1 + nvim/lua/kogakure/plugins.lua | 1 + 4 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 nvim/after/plugin/fm.lua diff --git a/nvim/after/plugin/fm.lua b/nvim/after/plugin/fm.lua new file mode 100644 index 0000000..7927e9d --- /dev/null +++ b/nvim/after/plugin/fm.lua @@ -0,0 +1,56 @@ +-- https://github.com/is0n/fm-nvim +local opts = { noremap = true, silent = true } + +vim.keymap.set("n", "", "Lazygit", opts) +vim.keymap.set("n", "", "Lf", opts) +vim.keymap.set("n", "lf", "Lf", opts) +vim.keymap.set("n", "lg", "Lazygit", opts) + +require("fm-nvim").setup({ + edit_cmd = "edit", + on_close = {}, + on_open = {}, + ui = { + default = "float", + float = { + border = "rounded", + float_hl = "Normal", + border_hl = "FloatBorder", + blend = 0, + height = 0.9, + width = 0.9, + x = 0.5, + y = 0.5, + }, + split = { + direction = "topleft", + size = 24, + }, + }, + cmds = { + lf_cmd = "lf", + fm_cmd = "fm", + nnn_cmd = "nnn", + fff_cmd = "fff", + twf_cmd = "twf", + fzf_cmd = "fzf", + fzy_cmd = "find . | fzy", + xplr_cmd = "xplr", + vifm_cmd = "vifm", + skim_cmd = "sk", + broot_cmd = "broot", + gitui_cmd = "gitui", + ranger_cmd = "ranger", + joshuto_cmd = "joshuto", + lazygit_cmd = "lazygit", + neomutt_cmd = "neomutt", + taskwarrior_cmd = "taskwarrior-tui", + }, + mappings = { + vert_split = "", + horz_split = "", + tabedit = "", + edit = "", + ESC = "", + }, +}) diff --git a/nvim/after/plugin/toggleterm.lua b/nvim/after/plugin/toggleterm.lua index f27fa12..904cbb3 100644 --- a/nvim/after/plugin/toggleterm.lua +++ b/nvim/after/plugin/toggleterm.lua @@ -4,12 +4,8 @@ local Terminal = require("toggleterm.terminal").Terminal local opts = { noremap = true, silent = true } -- Keymaps -vim.keymap.set("n", "", "lua _LAZYGIT_TOGGLE()", opts) -vim.keymap.set("n", "", "lua _LF_TOGGLE()", opts) -vim.keymap.set("n", "lg", "lua _LAZYGIT_TOGGLE()", opts) vim.keymap.set("n", "ncdu", "lua _NCDU_TOGGLE()", opts) vim.keymap.set("n", "node", "lua _NODE_TOGGLE()", opts) -vim.keymap.set("n", "lf", "lua _LF_TOGGLE()", opts) vim.keymap.set("n", "top", "lua _HTOP_TOGGLE()", opts) vim.keymap.set("n", "y", "lua _PYTHON_TOGGLE()", opts) @@ -51,22 +47,12 @@ end vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()") -local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) -local lf = Terminal:new({ cmd = "lf", hidden = true }) local tig = Terminal:new({ cmd = "tig", hidden = true }) local node = Terminal:new({ cmd = "node", hidden = true }) local ncdu = Terminal:new({ cmd = "ncdu", hidden = true }) local htop = Terminal:new({ cmd = "htop", hidden = true }) local python = Terminal:new({ cmd = "python", hidden = true }) -function _LAZYGIT_TOGGLE() - lazygit:toggle() -end - -function _LF_TOGGLE() - lf:toggle() -end - function _TIG_TOGGLE() tig:toggle() end diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0420cf7..8b59631 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -31,6 +31,7 @@ "emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" }, "export-to-vscode.nvim": { "branch": "main", "commit": "7746bb67d03f6a6891cdedc8c760c95a5714fe8c" }, "file-line": { "branch": "main", "commit": "559088afaf10124ea663ee0f4f73b1de48fb1632" }, + "fm-nvim": { "branch": "master", "commit": "8e6a77049330e7c797eb9e63affd75eb796fe75e" }, "friendly-snippets": { "branch": "main", "commit": "1a6a02350568d6830bcfa167c72f9b6e75e454ae" }, "fzf": { "branch": "master", "commit": "8e283f512acb74faef6f1760927e1ef4da1b5263" }, "fzf-lua": { "branch": "main", "commit": "5abf66f63bf08121dd4e917488b59ccb693eee12" }, diff --git a/nvim/lua/kogakure/plugins.lua b/nvim/lua/kogakure/plugins.lua index c360929..a7bf977 100644 --- a/nvim/lua/kogakure/plugins.lua +++ b/nvim/lua/kogakure/plugins.lua @@ -119,6 +119,7 @@ local plugins = { "mrjones2014/smart-splits.nvim", -- Smart splits "xiyaowong/nvim-transparent", -- Remove all background colors "nanotee/zoxide.vim", -- zoxide integration + "is0n/fm-nvim", -- terminal file managers -- Editing Files "windwp/nvim-autopairs", -- Autopairs, integrates with both cmp and treesitter