Skip to content

Tmux pane management. #10

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

Merged
merged 2 commits into from
May 4, 2017
Merged

Tmux pane management. #10

merged 2 commits into from
May 4, 2017

Conversation

jhshi
Copy link
Contributor

@jhshi jhshi commented May 4, 2017

Close previously opened edit pane (if exists) when editing in tmux mode, so that
we always keep two panes (detail and edit) side-by-side.

Close previously opened edit pane (if exists) when editing in tmux mode, so that
we always keep two panes (detail and edit) side-by-side.
@chishui
Copy link
Owner

chishui commented May 4, 2017

It's a little compulsive to close all the other panes without noticing people.
My previous solution is to open a new pane and when the vim is closed, the pane will be destroyed. But I don't have a perfect way to implement this.
Is there a way to open a named pane and every time to send source code file to this target pane?

@jhshi
Copy link
Contributor Author

jhshi commented May 4, 2017

As far as I know, tmux panes do not have a name but only a number ID.
The solution you described can potentially be implemented by appending "&& exit" to the edit command. But what I personally don't like to close the vim after submission. Instead, I go back to the details view and select another problem, without closing the edit pane. So when I press "e" in the new problem, I'd like to update the edit pane with the new solution file. Does this make sense?

@chishui
Copy link
Owner

chishui commented May 4, 2017

Yeah, that does make sense, but how do you know which pane is the pane you want? If pane id is not unique, when user closes the pane and opens a new one and run another program, this new pane may have the same pane id?

@jhshi
Copy link
Contributor Author

jhshi commented May 4, 2017

Yes, the new pane will have the same id. And there seems no way to tell if the other pane was opened by us or the user. I think the assumption should be: leetcode should be the only one who manages panes in current window. So we always enforce the side-by-side detail and edit pane layout in current window. Otherwise, there is no simple "correct" way to do this once user starts to create extra panes in current window.

Is this a valid assumption? If so, we can state this in the manual.

@chishui
Copy link
Owner

chishui commented May 4, 2017

Since there isn't a perfect way to solve this, I think your code to close all the other panes is a reasonable solution because user has to set "tmux_support" in config.cfg to enable this feature. And yes, what we need to do is to add a statement in the manual.

If you agree with this, I'll merge this pull request.

@jhshi
Copy link
Contributor Author

jhshi commented May 4, 2017

Hold on. I'll update the readme accordingly.

@jhshi
Copy link
Contributor Author

jhshi commented May 4, 2017

done.

@chishui chishui merged commit db7d3e2 into chishui:master May 4, 2017
@chishui
Copy link
Owner

chishui commented May 4, 2017

Great, thanks man!

@jhshi jhshi deleted the tmux-edit branch May 4, 2017 20:33
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