2

If you are using an auto-pairs-style plugin, it is most likely trying to delete the closing "; not finding one, it erroneously deletes further. As mentioned in the comments, these plugins generally cause more headache than they’re worth (YMMV). Snippets provide a more flexible alternative (though the author has very little experience with them).


2

Add this to your after/ftplugin/c.vim or after/ftplugin/cpp.vim: let &l:formatlistpat .= '\|^\s*-\s*' It tell vim to recognize - as numbered list. set them in vimrc is a mistake, this option is local to buffer. You can use :verbose setlocal formatlistpat to check if it's set properly. Result: // - foo foo foo foo foo foo foo foo foo foo foo foo foo ...


1

You can also get this behavior with this minimalist vimrc set nocompatible filetype on set textwidth=80 set formatoptions=c let g:tex_flavor="latex" au Filetype tex set comments=sO:%\ -,mO:%\ \ ,:% au Filetype cpp set comments=sO:\/\/\ -,mO:\/\/\ \ ,:\/\/ When editing tex files you would get the following % - foo foo foo foo foo foo foo foo foo foo ...


1

It would be really hard to do this for a real world markdown files with regards to all edge cases (tables, code blocks, list items, headers etc). But for example given you can try following :h :global commands: :g/^\S.*\n\S/normal! vipJ :g/^\S/normal! gww Join with :g/^\S.*\n\S/normal! vipJ It searches for all "paragraphs" -- 2 consecutive lines that ...


1

As jecxgo points out, the problem is that the obvious solution of recording a macro that processes a single line and then applying that to the selection of lines with :normal fails because, when the lines are expanded, this messes with the other lines in the range. jecxgo solves this by not expanding the lines within the macro but instead doing so in a ...


Only top voted, non community-wiki answers of a minimum length are eligible