Lists

166 views
Skip to first unread message

Einfach Toll

unread,
Sep 28, 2012, 7:08:09 AM9/28/12
to vim...@googlegroups.com
Currently, I am working on a Vim script for easier typing of bullet lists and also numbered lists because I found the simple approach of Vimwiki by setting 'comments' a bit annoying. And I like numbered lists but don't use the HTML functionality, so the # bullet for a number is useless for me.

Originally, I wanted my plugin to work with Vimwiki as well as with every other text file, but then I found that some things interfere with functions of  Vimwiki, like handling of the checkboxes or the highlight, so I thought about trying to integrate my functionalities into Vimwiki. So I'm asking the devs if you would like to add them to Vimwiki when I'm done, or if you don't like the idea for whatever reason.

What my script is supposed to do is roughly the following:
- handling of different types of bullet points in a hopefully intuitive manner
- numbered lists with automatic increment
- automatic adjustment of the bullet points when indenting a line with i_<C-D> and i_<C-T>

Stuart Andrews

unread,
Sep 28, 2012, 9:14:17 PM9/28/12
to vim...@googlegroups.com

Sounds interesting. It'd be great if you could submit a branch with your work. Thanks!
- S.

It would be easy to incorporate from a development repo branched off the trunk.

Einfach Toll

unread,
Oct 2, 2012, 9:15:28 AM10/2/12
to vim...@googlegroups.com
Ok, but be patient, it may take a while.

Einfach Toll

unread,
May 15, 2013, 6:23:23 AM5/15/13
to vim...@googlegroups.com
Hi,

I see you indeed were patient. It took quite some time because I discovered this proposal: https://code.google.com/p/vimwiki/wiki/NewLists and
implemented most of the design goals mentioned there, especially the following:
    - a list item can have line breaks
    - a list item can contain every other syntax element, including other lists, but excluding header lines
    - a list item can contain empty lines. This leads to a problem I mention below
    - for default and markdown syntax the level of an item is determined by its indent, for media syntax by the number of markers (# ## ### and so on)

Where my implementation differs from the proposal:
    - header lines end every list
    - the assignment in nested lists is different, for example:
        - Item 1
                - Subitem 1 of Item 1
            - Subitem 2 of Item 1 (in the proposal, this would be Item 2)
        - Item 2

To be more precise, what has changed now is the following (I hope I don't forget anything):
- there are 3 types of markers list items can have:
    1. bullets, like -
    2. bullets that can occour repeatedly, like *, **, ***
    3. numbers, like 1. 2. 3. or a) b) c) or I] II] III]

    - but I think we need a fourth type, that behave like bullets inside Vim but are converted to numbered items in HTML
    - Btw, description lists should work as they used to, I did not touch something about them

- the following keys do cool things now:
    - i_<CR> in a list item inserts a new bullet or number in the next line, numbers are incremented, of course
    - i_<CR> in an empty list item deletes the item marker. This is useful to end a list, you simply press <CR> two times.
    - i_<S-CR> in the current settings does *not* insert a new list item
    - o and O insert new list markers, as you would expect it
    - glh gll i_<C-T> i_<C-D> indent or de-indent(?) the current line, in most of the cases the markers are readjusted
    - gLh gLl indent a list item plus all child items
    - i_<C-A> i_<C-S> change the marker of the current list item, e.g. from - to a) to 1. and so on
    - glr renumbers a messed-up numbered list
    - gLr dito, but for the whole buffer
    - <C-Space> makes a [X] checkbox or toggles it (and in many cases the checkboxes of parent and child items are updated)
    - gl<Space> removes a checkbox from an item
    - i_<C-B> (maybe we find a better key) removes a marker from a list item (useful for typing multiline list items) or creates one
    - gl- gl* gl1. gla) (etc., these maps are created automatically) make a list item out of a normal line or change the marker for the current item
    - gL- gL* gL1. gLa) etc. change the marker of the current list to - * 1. a) etc.
    - gq works like one would expect it

    - where it makes sense, these commands also work with a range or in visual mode

- what is also cool is that if you set g:vimwiki_hl_cb_checked=2 in your vimrc, a [X] checked checkbox is now highlighted *plus* every child item,
  if it has a checkbox or not. I find this very useful.

- what is missing:
    - doc
    - at the moment, the types of markers for bulleted and numbered lists can easily be changed in ftplugin/vimwiki.vim, but not in the .vimrc
      see this file (line 47ff.) for the current settings for the various syntaxes
    - the HTML conversion

- The Problem with empty lines: The thing is, what I had in mind when I made all these changes is to use vimwiki not only for small shopping lists or
  so but as a full outline editor, where I can put all my notes and thoughts in a complex hierarchical structure. That means that sublists can be very
  long. If every empty line would break a list in two this would be very limiting in my eyes.
  Allowing or permitting empty lines would, as far I can see, concern the following cases:
    - numbering of numbered lists
    - in the HTML export, every empty line currently starts a new paragraph
      The problem here is that a blockquote can not be distinguished from a indented line that belongs to a list item above it. So we would need a new
      blockquote syntax. The proposal mentions a solution for this.
 
  What do you think, allow or permit empty lines in lists?


So, I attached my sources here, please play with it and let me know what you think!

By the way: I tried lists in MS Word and in Emacs org-mode, but my implementation is more fun :D




Am Samstag, 29. September 2012 03:14:21 UTC+2 schrieb Stu:
vimwiki_with_lists.tar.gz

Einfach Toll

unread,
May 23, 2013, 3:35:25 AM5/23/13
to vim...@googlegroups.com
Um, I'm not talking only to Maxim and Stu here. If something is not working as expected or not working at all, please let me know!

Maxim Kim

unread,
May 27, 2013, 2:40:02 PM5/27/13
to vim...@googlegroups.com
В Чт., 23/05/2013 в 00:35 -0700, Einfach Toll пишет:
> Um, I'm not talking only to Maxim and Stu here. If something is not
> working as expected or not working at all, please let me know!
>
Hi,

from your description it looks very good, the only drawback I can see is
lack of html support.

I will definitely have a look at it. Well, hopefully in a week.

Thanks!


Maxim Kim

unread,
Jul 7, 2013, 1:22:31 PM7/7/13
to vim...@googlegroups.com
n Wednesday, May 15, 2013 2:23:23 PM UTC+4, Einfach Toll wrote:

    Hi,

>    - what is missing:
>        - doc
>        - at the moment, the types of markers for bulleted and numbered lists can easily be changed in ftplugin/vimwiki.vim, but not in the .vimrc
>          see this file (line 47ff.) for the current settings for the various syntaxes
>        - the HTML conversion


        - doc is a must even poorly written like I usually do :).
        - that is not important at the moment, sane defaults are enough.
        - html conversion definitely should be taken into consideration but for now let us leave it as it is. I am looking for a new way to htmlize vimwiki but no luck yet.

 

>    - The Problem with empty lines: The thing is, what I had in mind when I made all these changes is to use vimwiki not only for small shopping lists or
>      so but as a full outline editor, where I can put all my notes and thoughts in a complex hierarchical structure. That means that sublists can be very
>      long. If every empty line would break a list in two this would be very limiting in my eyes.
>      Allowing or permitting empty lines would, as far I can see, concern the following cases:
>        - numbering of numbered lists
>        - in the HTML export, every empty line currently starts a new paragraph
>          The problem here is that a blockquote can not be distinguished from a indented line that belongs to a list item above it. So we would need a new
>          blockquote syntax. The proposal mentions a solution for this.
>     
>      What do you think, allow or permit empty lines in lists?

It is quite natural to have empty lines in lists so I would go for it. Blockquotes should have other way to be formatted.

Einfach Toll

unread,
Jul 8, 2013, 5:51:09 AM7/8/13
to vim...@googlegroups.com
Ok, so for now I'll make sure that the docs are updated and clean everything, plus there are some bugs to fix.

Maxim Kim

unread,
Jul 11, 2013, 10:38:04 AM7/11/13
to vim...@googlegroups.com
Hi, Einfach!

I just want to say thank you for your amazing new-lists branch. I find it more and more useful as far as I continue use it.

Keep up the good work!

Danke schön! :)

Maxim.

Einfach Toll

unread,
Jul 12, 2013, 5:45:06 AM7/12/13
to vim...@googlegroups.com
Woohoo, it's nice to hear that other people enjoy making lists as much as I do.

Btw, while cleaning everything up, I ask myself if there is a compelling reason to use glm and gll to indenent/deindent. Currently, I use gll and glh which I find at least a bit intuitive. What do you think?

Maxim Kim

unread,
Jul 12, 2013, 11:38:05 AM7/12/13
to vim...@googlegroups.com
В письме от 12 июля 2013 02:45:06 пользователь Einfach Toll написал:


>Btw, while cleaning everything up, I ask myself if there is a compelling
reason to use glm and gll to indenent/deindent. Currently, I use gll and glh
which I find at least a bit intuitive. What do you think?

I have already changed mapping description in vimwiki.txt, check it on github.
There should be added the rest of your newly created mappings.

Default vimwiki syntax has no multiple stars bullets so I have removed it.

For some reason with <S-CR> I get unexpected result.

For example, I press it on <CURSOR>

* list 1
* li<CURSOR>st 2
* list 3

And get

* list 1
* M<CURSOR>
* list 2
* list 3



Well for other things I will use issue list or whatever it is called on
github. :)

Maxim.

Eric Weir

unread,
Jul 16, 2013, 2:43:33 PM7/16/13
to vim...@googlegroups.com

On Jul 7, 2013, at 1:22 PM, Maxim Kim <hab...@gmail.com> wrote:

> > - The Problem with empty lines: The thing is, what I had in mind when I made all these changes is to use vimwiki not only for small shopping lists or
> > so but as a full outline editor, where I can put all my notes and thoughts in a complex hierarchical structure. That means that sublists can be very
> > long. If every empty line would break a list in two this would be very limiting in my eyes.
> > Allowing or permitting empty lines would, as far I can see, concern the following cases:
> > - numbering of numbered lists
> > - in the HTML export, every empty line currently starts a new paragraph
> > The problem here is that a blockquote can not be distinguished from a indented line that belongs to a list item above it. So we would need a new
> > blockquote syntax. The proposal mentions a solution for this.
> >
> > What do you think, allow or permit empty lines in lists?

I'm content with hyperlinks for organizing my thinking in vimwiki, but as an old MaxThink devoté---I came to believe I could not think or write without MaxThink; I looked for a replacement for a long time; no current outliner can compare---I'd love to see vimwiki acquire outlining capability of the sort Einfach describes, i.e., paragraphs, not just lists.

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"I can explain it for you, I just can't comprehend it for you."

- Ed Koch

Reply all
Reply to author
Forward
0 new messages