- Notifications
You must be signed in to change notification settings - Fork29
Export indent to g:Context_indent_function#45
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
g:Context_indent_function being a funcref has to start with an uppercase(unless there is a way to get away with it)
wellle commentedFeb 5, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Very nice, thanks for the proof of concept and example function! I'll consider adding this 👍
Yes, functionMyIndent(line)letindent=indent(a:line)ifindent <0return [indent,indent]endifletline=getline(a:line)let headings=match(line,'^*\+\zs\s')+1if headings<=0let headings=match(line,'^#\+\zs\s')+1if headings<=0let headings=5endifendifreturn [indent+headings,indent]endfunctionletg:Context_indent_function=funcref("MyIndent")letg:context_skip_regex='^\s*$' Edit: Updated according to changes introduced in#85. |
Your modification works perfectly. Thanks. |
Hey, thanks again! I tried using this branch for a bit and I found one fundamental issue I don't have a good idea yet how we can solve it in a clean way. Have a look at this screenshot: Because of the |
I guess the indentation of the border line is a feature (which I didn't realize was there until now). |
Another option would be to use the actual line indent (not the custom one)or that the custom function return a dictionary with the indent level andthe context bar. That way the user decide how he wants it. …On Thu, 6 Feb 2020, 19:23 Christian Wellenbrock, ***@***.***> wrote: Hey, thanks again! I tried using this branch for a bit and I found one fundamental issue I don't have a good idea yet how we can solve it in a clean way. Have a look at this screenshot: [image: Screenshot 2020-02-06 20 18 23] <https://user-images.githubusercontent.com/474504/73970695-dc78b980-491d-11ea-893b-6216d2c425e4.png> Because of the +5 in the example indent function from above the border line (▬▬▬▬▬▬ <context.vim>) is indented five characters too much. Do you see a good way to fix that? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#45?email_source=notifications&email_token=AAA4FCA5OPG5HB3MIE2VV23RBRPTXA5CNFSM4KQH6VJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELAOUEA#issuecomment-583068176>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA4FCBPSOLP3WY7P7HGEELRBRPTXANCNFSM4KQH6VJA> . |
'border_line' is used to indent the border line
I've pushed a new version ... |
Thank you! To be honest I also have some concerns* about the new implementation. Let me think about it some more. *Now we always evaluate the border line indent thing, even though we almost never use. That seems a bit wasteful IMO. |
I agree with you.I just wanted to try if it would work but realized it would need a deeperrefactoring.My initial thought was to be able add some `##` at the beginning of theborder linebut realized it doesn't work.The cleaner option would be to add a `heading` or `level` concept (on topof `indent`)or to be able to disable the border line indentation. …On Sun, 9 Feb 2020 at 19:57, Christian Wellenbrock ***@***.***> wrote: Thank you! To be honest I also have some concerns* about the new implementation. Let me think about it some more. *Now we always evaluate the border line indent thing, even though we almost never use. That seems a bit wasteful IMO. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#45?email_source=notifications&email_token=AAA4FCDBWLUE4K57QFW5XX3RCBNZRA5CNFSM4KQH6VJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELGWLBY#issuecomment-583886215>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA4FCCSUQWEEWG4RINNIEDRCBNZRANCNFSM4KQH6VJA> . |
Seems to work. However, to make it work I add to do |
@maxigit: Thanks for checking! I mentioned that in the README and updated the linked comment 👍 Do you think it's clear enough now? |
I'm not sure actually why I needed to change the skip regex.I think it's clear enough. If it's not, people will probably let you knowand you can then clarify if needed.Once again, this plugin is great (especially with this feature ;-)! I useit every day ! …On Tue, 18 Feb 2020 at 22:46, Christian Wellenbrock < ***@***.***> wrote:@maxigit <https://github.com/maxigit>: Thanks for checking! I mentioned that in the README and updated the linked comment 👍 Do you think it's clear enough now? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#45?email_source=notifications&email_token=AAA4FCGL3V7FOTXIJKWTBPTRDRQLZA5CNFSM4KQH6VJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFUVQI#issuecomment-587942593>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA4FCALMXGAVXZOG5ZSGV3RDRQLZANCNFSM4KQH6VJA> . |
Thank you for the feedback, will merge it later 👍 The reason you need to update the skip regex is that the default one does skip lines starting with |
The reason you need to update the skip regex is that the default one does skip lines starting with #. I did this because in many file formats those lines are comments and I wanted to exclude comment lines from the context. So in order to include markdown header lines (which start with #) we need to not skip those lines, hence a different skip regex is required. Of course, I remember know. I set the skip regex the other day to make itwork but when I tried your new branch I commented not sure if it was stillneeded. … — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#45?email_source=notifications&email_token=AAA4FCFGXKZFITLME6GAAZLRDVATJA5CNFSM4KQH6VJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMIEI5Y#issuecomment-588268663>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA4FCBYQEHPZUY34QBZCR3RDVATJANCNFSM4KQH6VJA> . |
Added in#54. |

Uh oh!
There was an error while loading.Please reload this page.
g:Context_indent_function being a funcref has to start with an uppercase
(unless there is a way to get away with it)
I'm not expecting you to accept the pull request, it's just a proof of concept, it works in theory
but defining custom function seems a bit more tricky than expected.
Example for markdown and orgmode (and indentation)
For some reason it hangs at the begining. I think
contextdoesn't like to to start with a indent level of 5 on an empty file ....#44