How can I open a file from the status menu in a different editor #1439
stackmystack
started this conversation in
General
Replies: 1 comment
-
hehe, I get it. I have doom emacs installed just for magit (shell alias: So I think the easiest way would be for you to overload the function here: https://github.com/NeogitOrg/neogit/blob/master/lua/neogit/buffers/status/actions.lua#L1092-L1111 so somewhere in your nvim config, you would do: require("neogit.buffers.status.actions").n_goto_file = function(self)
return function()
local item = self.buffer.ui:get_item_under_cursor()
-- Goto FILE
if item and item.absolute_path then
local cursor = translate_cursor_location(self, item)
-- something here to open the file in your editor of choice
return
end
-- Goto COMMIT
local ref = self.buffer.ui:get_yankable_under_cursor()
if ref then
require("neogit.buffers.commit_view").new(ref):open()
end
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I know my question sounds crazy, but what I want is basically what I described in the title.
Cursor on a certain modified, or added file, I want to be able to hit enter, and make that open in a different editor.
Why?
Because someone is going to tell me how wrong I am and why would I want to leave neovim … well, I'm not on neovim anymore but I really, really, really, really, don't want to leave neogit (and I also left emacs very reluctantly because I wanted magit).
So now I have a special neogit config (see https://github.com/stackmystack/dot-files/blob/master/.config/neogit/init.lua) and a
g
alias that launches neovim with neogit only.I added a hook that quits
g
when I pressq
, butg
will also quit when I hitenter
on a buffer. Ideally, I'd like to hit enter and for neogit to pick up my$EDITOR
, and send the proper path, ideally configurable since not all editors (ehem, neogit for instance) would accept apath:line
format, or maybe I'd want to pass certain flags …Beta Was this translation helpful? Give feedback.
All reactions