-
Notifications
You must be signed in to change notification settings - Fork 238
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
feat: Add ability to hijack-cursor #955
Conversation
cff8f12
to
7ba0edf
Compare
@cseickel Thanks for the quick review. I have addressed your comments. Is there anything left that I should do? Initially I was thinking also about mentioning it in the vim docs, but I see that not all of the flags are there, so I am not sure if I should put it there. |
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.
As far as docs go, not everything is in the help file because I was just too lazy to write docs for every single option. The general rule is that anything that can easily be explained with an inline comment in the config doesn't need to be explicitly listed in the help file.
If you wanted to put in a doc entry, you could just start a new section that could someday contain all of the options that just need one-line explanations like this one. Or you can skip it.
Hi @cseickel, it seems that I can now get back to this one, though I still don't know where to subscribe for the events. Could you drop some hint? 🙏 |
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.
I'm not sure why, but it does not seem to work with position = "current"
.
if vim.o.filetype ~= "neo-tree" then | ||
return | ||
end | ||
local source = vim.api.nvim_buf_get_var(0, "neo_tree_source") |
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.
I would make this a pcall
because it will throw an error if the variable is not set. Most likely that would only happen from a timing problem.
The important thing is that it would get real annoying if something did cause an error on every cursor moved event.
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.
Good idea, done.
I will look into that. |
@cseickel I looked into that. It doesn't work because |
Yes. The problem is that if you call You'd need something like this: local winid = nil
local _, position = pcall(vim.api.nvim_buf_get_var, 0, "neo_tree_position")
if position == "current" then
winid = vim.api.get_current_win()
end
local state = manager.get_state(source, nil, winid) That block of logic should probably be a utility function, or maybe the |
I see, thanks for the explanation. For now I will just add this check here but I think that it would make sense to move it eventually to |
Hey @ghostbuster91, sorry I think I dropped the ball on this. Is this good to go? |
@cseickel Sorry, this is totally my fault. I used this ticket to get some hands-on experience with neotree codebase as this ticket seemed quite simple. However obstacles that I encountered caused my motivation to go away. Having said that, I think that it would be a waste if I didn't finish it, so I will try to get that last mile done. |
@cseickel I fixed the issue with |
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 and it works for me in all situations. Thanks!
This closes #604
TODO: