diff --git a/nvim/.config/nvim/README.md b/nvim/.config/nvim/README.md index 109014a..8f11b0a 100644 --- a/nvim/.config/nvim/README.md +++ b/nvim/.config/nvim/README.md @@ -14,6 +14,12 @@ To remove a plugin run `:lua vim.pack.del({ "" })`. See custom keymaps with short descriptions with `h`. +General shortcuts: + +- `e` opens the file browser +- `gx` opens an external viewer +- `gR`, `` refresh + Windowing shortcuts: - `sv` open a vertical split @@ -48,16 +54,6 @@ Git shortcuts: - `[h`, `]h`, `[H`, `]H` jump to hunks - `th` — toggle the expanded hunk view -Refresh shortcuts (mini.files and buffers): - -- `gR` refresh the current buffer -- `` refresh the current buffer - -Files usage: - -- `e` opens the file browser -- `gx` opens the file in external viewer - Toggle shortcuts: - `tw` toggle soft wrap diff --git a/nvim/.config/nvim/lua/romanzy/custom/mini_files_git.lua b/nvim/.config/nvim/lua/romanzy/custom/mini_files_git.lua index 13581d5..426f7d5 100644 --- a/nvim/.config/nvim/lua/romanzy/custom/mini_files_git.lua +++ b/nvim/.config/nvim/lua/romanzy/custom/mini_files_git.lua @@ -355,6 +355,16 @@ local function refresh_filetree() end) end +local function open_external() + local fs_entry = MiniFiles.get_fs_entry() + if fs_entry == nil then + vim.notify("No file system entry under the cursor", vim.log.levels.WARN) + return + end + + vim.ui.open(fs_entry.path) +end + function M.setup() local group = vim.api.nvim_create_augroup("romanzy_mini_files_git", { clear = true }) @@ -372,6 +382,10 @@ function M.setup() desc = "refresh mini.files filetree", }) end + vim.keymap.set("n", "gx", open_external, { + buffer = args.data.buf_id, + desc = "open mini.files entry externally", + }) end, }) vim.api.nvim_create_autocmd({ "BufWritePost", "FocusGained", "TermClose" }, {