-
-
Notifications
You must be signed in to change notification settings - Fork 163
Toggle headlines #198
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
Toggle headlines #198
Conversation
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.
Don't forget to run make format
as well.
@kristijanhusak the orgmode docs talk about "regions" that can be toggled as a whole. I don't use Emacs, do you know what is meant by this term? Is this something that's already used by nvim-orgmode? |
@kristijanhusak I'd need your opinion regarding the visual-mode mappings I mentioned in #164 (bottom) to move on with this PR ;) |
@kristijanhusak one last thing: I cannot detect a line that has no parent-headline with function Files.has_headline(id)
local current_file = Files.get_current_file()
local msg = 'Make sure there are no errors in the document'
if not vim.diagnostic then
msg = string.format('%s by running :OrgDiagnostics command', msg)
end
if not current_file then
error({ message = string.format('Failed to parse current file. %s.', msg) })
end
if not current_file:get_closest_headline(id) then
return false
else
return true
end
end But it introduces some code duplication and I hate that. Do you have a better idea for how to check if a line even has a headline? |
@jgollenz I pushed small change where |
7c1f74a
to
8d1fe36
Compare
@kristijanhusak works like a charm, thanks! You prefer squashing commits, right? |
295463c
to
acf7034
Compare
@jgollenz Yeah, squashed commit is perfect. |
fixes #164
todo: