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

Fixed indent alfter list #3

Merged
merged 1 commit into from Jun 17, 2015
Merged

Fixed indent alfter list #3

merged 1 commit into from Jun 17, 2015

Conversation

hori-ryota
Copy link

No description provided.

rcmdnk added a commit that referenced this pull request Jun 17, 2015
@rcmdnk rcmdnk merged commit e1de55c into rcmdnk:mod Jun 17, 2015
@rcmdnk
Copy link
Owner

rcmdnk commented Jun 17, 2015

Thanks, that's fine with me.

@hori-ryota
Copy link
Author

@rcmdnk
Copy link
Owner

rcmdnk commented Jun 17, 2015

For numbering bullets, I agree.

For indent function, maybe we can make it much simpler, like:

" Only define the function once
if exists("*GetMkdIndent") | finish | endif

function GetMkdIndent()
  let lnum = prevnonblank(v:lnum - 1)
  if lnum == 0 || v:lnum - lnum > 2
    return 0
  endif
  return indent(lnum)
endfunction

I think it works as same as your modification, doesn't it?

In addition, I prefer to do:

  if lnum == 0 || v:lnum - lnum > 1

For syntax, it is better to do:

setlocal comments+=bn:>

Ho do you think?

@hori-ryota
Copy link
Author

Thanks.

needs_keeping needs to be recursive.

e.g.

* list item

    first paragraph

    second paragraph

is


  • list item

    first paragraph

    second paragraph


But this method incomplete in terms of ignoring line feeds.

setlocal comments+=bn:> is nice!

@rcmdnk
Copy link
Owner

rcmdnk commented Jun 17, 2015

ok, I got what you want. (sorry, I didn't think the third condition is actually intended...)

I think it is better to have current your pull request's one,
because your another pull request doesn't work when

* list item
second line

    first paragraph

    second paragraph

first paragraph is not indented.

With original one, second line is also indented, and paragraphs are also indented.

In case you don't have second line, you can immediately finish the indent after a blank line with your new one, though.

But the behavior such

* item list<cursor1>
<cursor2>
    <cursor3>
<cursor4>

is a bit annoying if you actually finish the item (and it happens much more than the cases with paragraphs.)

By the way, I found the typo in line 54 of your pull request (s:is_li_stat -> s:is_li_start).

@hori-ryota
Copy link
Author

By the way, I found the typo in line 54 of your pull request (s:is_li_stat -> s:is_li_start).

Thanks, I updated.

I also think so the behavior, but using numbering bullet indented when new line added.

e.g.

1. numbered<CR>
    <here>

If that's the case, I think better also behave not indented.

@rcmdnk
Copy link
Owner

rcmdnk commented Jun 18, 2015

How about this?

setlocal comments=b:*,b:+,b:-,b:1.

in syntax/markdown.vim.

It works for:

1. aaa
1. bbb
1. ccc
1. 

Though it is more complex if you want to increment here,
Markdown parser automatically increments the number and more frexible to change lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants