Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hijack e key to prevent nnn.nvim nnn nvim inception #57

Closed
wants to merge 1 commit into from
Closed

Hijack e key to prevent nnn.nvim nnn nvim inception #57

wants to merge 1 commit into from

Conversation

ggustafsson
Copy link
Contributor

Hello!

When running nnn -p/NnnPicker the "e" (Edit file) key is disabled and that is of course not the case with nnn/NnnExplorer which can make things end up a bit messy if you are not careful. Worst case scenario is that a user ends up pressing "e" by habit while a directory is selected which will start nvim and then nnn.nvim netrw hijack 🤯

See it in action here:
https://asciinema.org/a/500370

I've actually ended up doing this a few times because I use both "e" and return open things in nnn. I tried to hijack it on my end with mappings = {} first but that doesn't work and I figured others might appreciate it too.

Best regards,
Göran Gustafsson

@luukvbaal
Copy link
Owner

Why do you say it's "of course not the case" for NnnExplorer?

IMO the justification for jarun/nnn@8a1a5db applies to explorer mode as well and we should rather patch nnn than nnn.nvim, no?

@luukvbaal
Copy link
Owner

I.e.

@@ -7335,7 +7335,7 @@ nochange:
                                copycurname();
                                goto nochange;
                        case SEL_EDIT:
-                               if (!g_state.picker)
+                               if (!(g_state.picker || g_state.fifomode))
                                        spawn(editor, newpath, NULL, NULL, F_CLI);
                                continue;
                        default: /* SEL_LOCK */

luukvbaal added a commit to luukvbaal/nnn that referenced this pull request Jun 8, 2022
luukvbaal added a commit to luukvbaal/nnn that referenced this pull request Jun 8, 2022
@ggustafsson
Copy link
Contributor Author

Ohh sorry, I didn't realise that there was another mode! That is why I didn't write nnn -F... Sounds like you are absolutely right about this one! 🙂

@ggustafsson
Copy link
Contributor Author

Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants