-
Notifications
You must be signed in to change notification settings - Fork 36
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
Jump to line with the edit command #127
Conversation
cc @insanum @swalladge |
@giuli007 thanks, this looks like a nice idea! I haven't had much time to spare lately to look at these though sorry. I'll try to take a look soon, but can't make any guarantees. :/ |
Thanks @swalladge (and @lostways) for the recent 0.4.2 release. I wonder if the feature in this PR might still be considered for merging in at some point? I appreciate I'm probably the only person wanting to use something like it for now but I don't think it is too controversial to have it. Please let me know if I can do anything to facilitate this. |
Sorry for missing this for so long @giuli007 . I think it seems a good idea, and it ties in well with the existing focus position when editing from the interactive interface. I left a request on the code structure. |
This reverts commit 4e756b3.
@swalladge Thank you |
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! Looks pretty good - I just left some comments about off by one errors with focus_position / line.
@swalladge my bad I didn't notice those wrong defaults after the revert; I guess partly because my editor (vim) just defaults to the first line anyway if I pass it a zero like |
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, looks great!
Hi @samuelengineer thanks so much for merging this in. I am wondering when this might get released (and published to pypi). I appreciate it's a very small feature addition and I might be the only one wanting to use it so no rush. |
I find myself wanting to use the
edit
command and provide a+<linenumber>
to directly jump to a certain line in my editor (vim).I've attempted to implement it.
A command to use it will look like
this relies in
cfg_editor
to be set with a+{line}
:For now I made the overall changes in 2 different commits.
The first one just adds a simple
line
parameter to theexec_cmd_on_note
method.On the second one the approach is generalised to pass a
cmd_args
dictionary that can be used to substitute different parameters in thecmd
string.This is not necessarily useful right now but I felt it makes a bit more sense to pass generic parameters in like this.
With the current implementation the only 2 parameters that can be substituted are
fname
andline
and it practically only really makes sense to pass in aline
number from the edit command for now.This is why I kept the 2 commit separate so that I can just use the simpler solution if that's preferred.
Happy to hear opinions and potentially tweak the solution a bit more.