Skip to content

Conversation

@N-R-K
Copy link
Collaborator

@N-R-K N-R-K commented Nov 1, 2021

This makes it so running :NnnExplorer while an explorer window is already open toggle/close it instead of opening a new explorer window.

Undocumented, also might need more testing (on both vim and neovim) before merge.

@jarun jarun merged commit 90cc1b4 into mcchrish:master Nov 1, 2021
@jarun
Copy link
Collaborator

jarun commented Nov 1, 2021

Thank you!

@N-R-K
Copy link
Collaborator Author

N-R-K commented Nov 1, 2021

@jarun uhhh, the PR wasn't ready for merge yet 😅 . Wanted some more testing in case there's some weird quirk that happens on vim but not nvim and vice versa.

Welp, shouldn't be a big deal. If there's some quirk/problem, we can fix it on the go.

@jarun
Copy link
Collaborator

jarun commented Nov 1, 2021

Use the label work in progress for this purpose.

@N-R-K
Copy link
Collaborator Author

N-R-K commented Nov 1, 2021

Don't think I can add labels, which is why I put [WIP] on the PR title.

@jarun
Copy link
Collaborator

jarun commented Nov 1, 2021

@mcchrish can you please add @N-R-K to the project?

@N-R-K N-R-K deleted the ex_toggle branch November 1, 2021 03:43
@mcchrish
Copy link
Owner

mcchrish commented Nov 1, 2021

Don't think I can add labels, which is why I put [WIP] on the PR title.

I believe you should be able to create a draft PR?

@N-R-K
Copy link
Collaborator Author

N-R-K commented Nov 1, 2021

I believe you should be able to create a draft PR?

I'll try that next time. Anyways, since it's already merged don't think the label is needed. And it works fine for all "basic" usecases from what I've tested (both vim and nvim), so this should be fine.

@jarun
Copy link
Collaborator

jarun commented Nov 1, 2021

@mcchrish in any case, please add @N-R-K to the project.

@N-R-K please confirm when you are added.

@N-R-K
Copy link
Collaborator Author

N-R-K commented Nov 1, 2021

Thanks, I'm in.

@N-R-K N-R-K changed the title [WIP]: toggle explorer instead of opening a new one toggle explorer instead of opening a new one Nov 1, 2021
@mcchrish
Copy link
Owner

mcchrish commented Nov 1, 2021

@jarun @N-R-K you have merge privileges but let's make sure the one who merged tested the changes and confirms it's working as expected.

let s:nnn_conf_dir = (!empty($XDG_CONFIG_HOME) ? $XDG_CONFIG_HOME : $HOME.'/.config') . '/nnn'
" The fifo used by the persistent explorer
let s:explorer_fifo = ""
let t:explorer_winid = 0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need to initialize this immediately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's leftover from earlier state. I'll clean it up and document the changes on a separate PR.

@luukvbaal
Copy link

luukvbaal commented Nov 1, 2021

Closing the explorer pane by means other than running NnnExplorer will require you to run NnnExplorer twice to open it again with the way you implemented this I think(haven't tested). Which is why I actively check if the window is open in nnn.nvim.

Alternatively I suppose you could clear the tabpage var in the termopen() on_exit callback which might be cleaner now that I think of it.

@N-R-K
Copy link
Collaborator Author

N-R-K commented Nov 1, 2021

@luukvbaal Yes, moving that in on_exit should fix the problem. I'll wait to see if there's any more problems before creating a new PR.

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.

4 participants