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
Auto-indentation for lists #126
Comments
Weird, I don't reproduce: hitting enter for me creates the new item. I'm working on adding unit tests to this lib with https://github.com/junegunn/vader.vim: when that is done we'll create tests for this and decide =) |
Ah, that is interesting. It may be another plugin interaction (though I don't use many) or maybe something to do with my format-options. On the other hand, if I remove lines 41-43 from Can I ask you what |
|
I start with I'll try with/without other plugins, but for now the only thing that works is to edit this plugin's indentation file. |
I have just tried it on a minimal config with: https://github.com/cirosantilli/vundle-plugin-tester and still don't reproduce. To try it out, clone, I'm on Vim 7.3. |
I couldn't get |
I have this issue. |
I have this issue as well |
@telemachus Another issue here is the indentation of This gets applied when automatically wrapping on TEST CASE:
RESULT:
@beyondwdq (who did the commit) But for what it's worth, there are mechanisms in Vim already to get this behavior:
|
Anyone having problems with this: post the output of:
I could imagine that problems are based on using filetype I cannot see a reason for a custom |
I suspect you're right about the filetype issue, but even if I add |
@telemachus This does not belong into the syntax file, but should be in the filetype plugin.
Makes sense, especially since it gets shipped with Vim. I'm still interested in feedback from @beyondwdq of course. |
I'm confused: I just cloned the directory today, so why would I be missing those lines? |
@telemachus |
@blueyed Ah, I'm sorry, but no: since my earlier post, I've given in and gone back to So something else must be the issue, though I'm not sure what it is. |
Output for
|
|
👍
|
This was referenced above but I don't see a reply. List indent is mentioned in the original spec:
This allows a markdown parser to bundle multiple paragraphs in one list item. By aligning the text to follow suit you can make the switch to double digit numbers without offsetting the indent as shown: 8. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
9. quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
10. nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum. VS 8. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
9. quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
10. nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum. |
I'm hitting this issue, and found that it's because I remapped When I removed the mapping, I get the correct list behaviour. Does that give any clue to the problem? I'd quite like to keep my remapped return key, too... |
I worked around by using
|
|
I also am having this issue.
|
I moved some things around in my vimrc and now things are working correctly.
Here is the top of my working vimrc:
Removing Alternatively, I was able to fix it by manually issuing |
@arthurdent I think this might be relevant: VundleVim/Vundle.vim#176 It is Vundle not pathogen but I think I recall them both having the same gotcha. P.S. 👍 on the GitHub username. |
@arthurdent moving FWIW, my
|
Also seeing this. What's the solution? |
@danawoodman The only other thing I did is disable folding with |
I'm also getting this. The only solution for me was to remove "filetype plugin indent on" from vimrc. : ( This is really, really annoying. I have stayed away from this plugin for years because of this behavior. I'm using Vim 7.4.258 on OS X. |
As a work-around to only disable plugin indents with markdown, I added the following to my .vimrc:
With the number of people posting in this thread, maybe it should go in the README.md so people find it easier? |
@shirosaki An alternative is to switch to tpope's markdown plugin. |
@blueyed I'm having a similar issue, but in my case both formatlistpat=^\s*[0-9*-+]\+[\]:.)}\t ]\s*\|^\s*\[[x\- ]\]\s\+\|^\s*\[[x -]\]\s\+
Last set from c:\Program Files (x86)\Vim\_vimrc
formatoptions=Bjtqlnr
Last set from c:\Program Files (x86)\Vim\vimfiles\bundle\vim-markdown\indent\markdown.vim
filetype=markdown
Last set from c:\Program Files (x86)\Vim\vimfiles\bundle\vim-markdown\ftdetect\markdown.vim
indentexpr=GetMarkdownIndent()
Last set from c:\Program Files (x86)\Vim\vimfiles\bundle\vim-markdown\indent\markdown.vim
comments=b:>
Last set from c:\Program Files (x86)\Vim\_vimrc
textwidth=100
Last set from c:\Program Files (x86)\Vim\_vimrc |
Still a problem in 2017. I'm on a mac, I just cloned this into my bundle directory. I'm using pathogen. |
How about adding something like the following to
|
I use this plugin indirectly via vim-polyglot and am seeing the same problem. The solution for me was to clear setlocal indentexpr= Specifically, the issue in the function elseif s:IsLiStart(line)
if s:IsMkdCode(lnum)
return ind
else
" Last line is the first line of a list item, increase indent
return ind + list_ind
end
else
return ind
endif If the current line (when you press the Return key) is the first line of a list item (e.g. starts with a For whatever else it's worth, I only see this issue when |
Same here using vim-polyglot too. My formatlistpat=^\s*\d\+\.\s\+\|^[-*+]\s\+\|^\[^\ze[^\]]\+\]:
Modifié la dernière fois dans /usr/local/Cellar/neovim/0.4.3/share/nvim/runtime/ftplugin/markdown.vim line 14
formatoptions=jtcqln
Modifié la dernière fois dans /usr/local/Cellar/neovim/0.4.3/share/nvim/runtime/ftplugin/markdown.vim line 13
filetype=markdown
Modifié la dernière fois dans ~/.local/share/nvim/plugged/vim-polyglot/ftdetect/polyglot.vim line 379
indentexpr=GetMarkdownIndent()
Modifié la dernière fois dans ~/.local/share/nvim/plugged/vim-polyglot/indent/markdown.vim line 6
comments=fb:*,fb:-,fb:+,n:>
Modifié la dernière fois dans /usr/local/Cellar/neovim/0.4.3/share/nvim/runtime/ftplugin/markdown.vim line 12
textwidth=80
Modifié la dernière fois dans ~/git/vim/after/ftplugin/markdown.vim line 2 And my workaround is to set this conf in my " r Automatically insert the current comment leader after hitting
" <Enter> in Insert mode.
" o Automatically insert the current comment leader after hitting 'o' or
" 'O' in Normal mode.
set formatoptions+=ro
" The 'comments' option is a comma-separated list of parts.
" Each part defines a type of comment string.
" A part consists of: {flags}:{string}
" {string} is the literal text that must appear.
" {flags}:
" n Nested comment. Nesting with mixed parts is allowed.
" b Blank (<Space>, <Tab> or <EOL>) required after {string}.
set comments=b:*,b:-,b:+,b:1.,n:> Note about the removed f Only the first line has the comment string. Do not repeat comment on
the next line, but preserve indentation (e.g., a bullet-list). bonus point: thanks to |
Based on @akarzim's post above, I was able to work around this issue by adding the following to my au filetype markdown set formatoptions+=ro
au filetype markdown set comments=b:*,b:-,b:+,b:1.,n:> |
Using this hack for now: autocmd filetype markdown set indentexpr= The fix from @pwc3 works for me with the cursor on a list item, but not on the empty line after the list: - List item 1
- List item 2
- List item 3
█ <normal cursor here, press o> - List item 1
- List item 2
- List item 3
| <insert cursor here now> Output of formatlistpat=^\s*\d\+\.\s\+\|^[-*+]\s\+\|^\[^\ze[^\]]\+\]:
Last set from /usr/share/nvim/runtime/ftplugin/markdown.vim line 14
formatoptions=jtqlnro
Last set from ~/.dotfiles/editor/nvim/init.vim line 616
filetype=markdown
Last set from ~/.dotfiles/editor/nvim/init.vim line 599
indentexpr=GetMarkdownIndent()
Last set from ~/.dotfiles/editor/nvim/plugged/vim-polyglot/indent/markdown.vim line 8
comments=b:*,b:-,b:+,b:1.,n:>
Last set from ~/.dotfiles/editor/nvim/init.vim line 617
textwidth=0 |
this works for me. |
Re-openening to (eventually) review why people think they still have a problem with this after a supposed fix was merged. |
I still have this issue:
And |
A have the same issue. Fixed with syntax on. But the problem, that the line wrapping still does not work properly (not indenting) |
Hi, same issue.
@alerque, what was the supposed fix? The commit 642730f on Nov 16, 2015? For me the solution was to comment out parts of Only adding the line |
Hi,
I believe that my problem is related to #78 and I'm pretty sure that this what I'm seeing is a deliberate choice (based on lines 41-43 of
indent/mkd.vim
), but I want to make sure.If I'm writing Markdown and I start a list-item, when I hit return, the cursor is indented one level further in than the original list-item.
Example:
I don't understand this choice. As a user, when I'm done with the first list-item (and hit
<CR>
), I expect to start typing the next list-item. So shouldn't I be at the same indentation level, rather than further in? (If I want the next list-item to start a sub-list or be code, that's a separate choice. I would then<TAB>
in further myself.)tl;dr Is this observed indentation behavior deliberate? If so, why? Thanks.
The text was updated successfully, but these errors were encountered: