> Start with a list of items delineated by line breaks:
>
> foo
> bar
> baz
>
> And turn it into a markdown numbered list:
>
> 1. foo
> 2. bar
> 3. baz
>
> I know that I *could* use 1. for every item, since that's easy enough
> to do and Markdown knows what to do when rendering, but that's not so
> good for human readers of plain text.
>
> Is there a way I can have vim prefix the lines with an ascending
> counter like the above?
Dr. Chip's VisIncr.vim script may be what you want:
http://www.vim.org/scripts/script.php?script_id=670
You _can_ do things like
:'<,'>s/^/\=(1+line('.')-line("'<")).'. '
to number un-numbered lines (like you describe), or
'<,'>s/^\(\d\+\. *\)\=/\=(1+line('.')-line("'<")).'. '
to re-number lines that may (or may not) have already been numbered.
-tim
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment