-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
add alternate file #223
add alternate file #223
Conversation
inspired by vim ctrl-6/kak ga commands. the alternate file is kept per view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've been missing this feature! Just a few minor comments.
helix-view/src/editor.rs
Outdated
@@ -88,6 +88,12 @@ impl Editor { | |||
pub fn switch(&mut self, id: DocumentId, action: Action) { | |||
use crate::tree::Layout; | |||
use helix_core::Selection; | |||
|
|||
if !self.documents.contains_key(id) { | |||
log::warn!("cannot switch to document that does not exist (anymore)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this log::error!
, ideally this shouldn't happen. We'll need to add something like forget_doc
on the view to remove it from both alternate file and the jumplist: https://github.com/mawww/kakoune/blob/c507863a00289fe4b210ecc4fef5554de4c87bf4/src/context.cc#L197-L210
helix-view/src/view.rs
Outdated
@@ -67,6 +67,7 @@ pub struct View { | |||
pub first_col: usize, | |||
pub area: Rect, | |||
pub jumps: JumpList, | |||
pub alternate_file: Option<DocumentId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this alternate_doc
to match the doc
field.
I wish it could be like vim |
@pickfire i think that would be a great addition as well |
@robinvd Can you change those |
@pickfire done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Not tested but I will test later.
Tested, works nicely. But I think it would be better to have a text in the status line saying "no last accessed file" when |
inspired by vim ctrl-6/kak ga commands. the alternate file is kept per view