Skip to content
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

Cycle bullets #907

Merged
merged 1 commit into from
Jun 7, 2020
Merged

Cycle bullets #907

merged 1 commit into from
Jun 7, 2020

Conversation

robertgzr
Copy link
Contributor

When the syntax local cnfig cycle_bullets is set (currently only
markdown has it by default) the indent functions will cycle through the
characters defined in bullet_types based on the level of indentation.

Signed-off-by: Robert Günzler r@gnzler.io

Steps for submitting a pull request:

  • ALL pull requests should be made against the dev branch!
  • Take a look at CONTRIBUTING.MD
  • Reference any related issues.
  • Provide a description of the proposed changes.
  • PRs must pass Vint tests and add new Vader tests as applicable.
  • Make sure to update the documentation in doc/vimwiki.txt if applicable,
    including the Changelog and Contributors sections.

@robertgzr
Copy link
Contributor Author

opening this as draft to see if it's acceptable :)

I like using different bullet chars to indicate the indentation level of list elements, it's especially useful with long lists that flow outside the viewport of my editor.

@@ -73,8 +73,9 @@ let s:markdown_syntax.rxHR = '\(^---*$\|^___*$\|^\*\*\**$\)'
let s:markdown_syntax.rxTableSep = '|'

" Lists
let s:markdown_syntax.bullet_types = ['-', '*', '+']
let s:markdown_syntax.bullet_types = ['*', '-', '+']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this line change is more of a personal preference than anything else...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do prefer , +, - : each time lighter or the contratyr -,+, : for a default it is easyer to remember

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense, so let's go with *, +, -

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually just tried it and just writing the test cases I find it harder to visually distinguish * and +:

* aaaaaa
* bbbbbb
  + cccccc
    - dddddd
  + eeeeee
* aaaaaa
* bbbbbb
  - cccccc
    + dddddd
  - eeeeee

@robertgzr
Copy link
Contributor Author

hmm I didn't check this would still work on numbered lists, my bad. will have a look at that

Copy link
Member

@tinmarino tinmarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more tests: what happens when inserting a new line with Go:

* lvl1
  + lvl2
    - lvl3
      * lvl4

@tinmarino
Copy link
Member

I didn't check this would still work on numbered lists, my bad. will have a look at that

Add the tests to Vader please: nice to see PR with some tests become to come

opening this as draft to see if it's acceptable :)

If will be accepted when you feel ready: just ping me

@tinmarino tinmarino self-assigned this Jun 6, 2020
@robertgzr robertgzr force-pushed the cycle-bullets branch 5 times, most recently from 97fb240 to 20a7695 Compare June 6, 2020 15:08
@robertgzr
Copy link
Contributor Author

robertgzr commented Jun 6, 2020

@tinmarino can you have a look here. I added the latest neovim version to the test setup (it's what I'm using)

my manual testing and that new neovim test suite run fine, all the vim suites fail the test you asked for here

@tinmarino
Copy link
Member

The error is from:

    (33/38) [ EXPECT] (X) New item
      - Expected:
          * Love
            - Very
              + Much
              +
      - Got:
          * Love
            - Very
              + Much
            - 

It fails in my vader, not in my personal vim instance. The problem is that + is not considered as a bullet type in the vader configuration.

@tinmarino
Copy link
Member

Not a serious error, if tired, just comment the test out.

@@ -1338,7 +1343,7 @@ function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode) abort
else
"if the old is ### and the new is * use ***
if cur_item.type == 1 &&
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you justify that ? I guess it is because the variable is declare in syntaxlocal so you fixed a bug.
It would be more coherent to have it in syntaxlocal as recurring_bullet so to change the varaible declaration in vars.
What do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started this patch on master, there multiple_bullet_chars was retrieved via syntaxlocal. when rebasing on dev I noticed it was coming from wikilocal everywhere else, but you're right... it get's called through both. Should I just leave it? And we can follow this up with another PR (I can open an issue to track that)?

Copy link
Contributor Author

@robertgzr robertgzr Jun 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is with my patch...

$ rg multiple_bullet_chars autoload/vimwiki/lst.vim
1106:        \ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
1127:        \ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
1333:    if index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'), s:first_char(new_mrkr)) > -1
1346:                \ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
1404:        \ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the line was just missed here: ac4d0a1?

@tinmarino
Copy link
Member

Te resume:

  1. Fix or comment test: markdown syntax, ensure + is accepted as bullet point
  2. Multiple_bullet_chars: from wikilocal to syntaxlocal
  3. Optional: If wanna have fun, comment some (all) function in lst.vim as I've jsut did un base.vim: it helps newcommers

Anyhow, very nice contribution. It will be accepted in any case, I just try to minimize my integration additions.

When the syntax local config `cycle_bullets` is set (currently only
markdown has it by default) the indent functions will cycle through the
characters defined in `bullet_types` based on the level of indentation.

Signed-off-by: Robert Günzler <r@gnzler.io>
@robertgzr robertgzr marked this pull request as ready for review June 7, 2020 12:19
@tinmarino
Copy link
Member

Well 1. changes I requested for have been, made; 2. the PR has its own tests and 3. The optional feature do not break the former behavior.
Good job!

@tinmarino tinmarino merged commit 61093f4 into vimwiki:dev Jun 7, 2020
@robertgzr robertgzr deleted the cycle-bullets branch June 8, 2020 07:48
@robertgzr
Copy link
Contributor Author

@tinmarino thanks for the help on this :) really glad to have found this

@Nudin Nudin added this to Done in v2.6 Jun 8, 2020
@ndaman
Copy link

ndaman commented Jun 11, 2020

I don't know if this is the right place for this, but I believe this change introduces an error when changing the indentation of checklists. There is now an error when I try to indent my checklist: Key not present in Dictionary: cycle_bullets.

@bewuethr
Copy link

@ndaman Same here; I get

E716: Key not present in Dictionary: cb !=? ''

@davidsierradz
Copy link
Contributor

Is this feature behind a toggle? I would like to deactivate it

@teranex
Copy link

teranex commented Jul 10, 2020

Is this feature behind a toggle? I would like to deactivate it

I came here looking to ask exactly the same. I really hate this new cycle behaviour. Meanwhile i found it can be disabled by editing syntax/vimwiki_markdown.vim and setting let s:markdown_syntax.recurring_bullets to 0 (at line 77), but that will have to be done after each update.

deepredsky pushed a commit to deepredsky/vimwiki that referenced this pull request Jan 16, 2021
When the syntax local config `cycle_bullets` is set (currently only
markdown has it by default) the indent functions will cycle through the
characters defined in `bullet_types` based on the level of indentation.

Signed-off-by: Robert Günzler <r@gnzler.io>
jls83 pushed a commit to jls83/vimwiki that referenced this pull request Jan 17, 2023
When the syntax local config `cycle_bullets` is set (currently only
markdown has it by default) the indent functions will cycle through the
characters defined in `bullet_types` based on the level of indentation.

Signed-off-by: Robert Günzler <r@gnzler.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v2.6
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants