15 votes
Accepted

Replace a series of asterisk bullet points with a numbered list

You could try the following command: :let c=0 | g/^* /let c+=1 | s//\=c.'. ' First it initializes the variable c (let c=0), then it executes the global command g which looks for the pattern ^* (a ...
saginaw's user avatar
  • 6,626
14 votes
Accepted

NeoVim hides the * chars when editing markdown

Those chars are hidden because the conceal feature as you can see on the vim-markdown source. You can adjust how to this feature is applied to text using the option conceallevel. Setting it to 0 will ...
vappolinario's user avatar
14 votes
Accepted

automatically rewrap lines when writing markdown in VIM

Even simpler: the a flag for 'formatoptions' enables automatic formatting of paragraphs whenever text is inserted or deleted. See :help fo-table for details on 'formatoptions' flags and :help ...
8bittree's user avatar
  • 1,457
11 votes

Markdown in Neovim: which plugin sets conceallevel=2?

Ok, I found the plugin involved into this: is indentLine. It is reported in its README: it does not work if conceallevel is not set to 1 or 2, so it set this parameter to 2 by default. The side ...
caneta's user avatar
  • 417
10 votes
Accepted

How to preview the result of markdown file edited in vim?

While I mostly agree with @romainl comment (markdown was made to be explicit enough not to need a preview) you can do this in different ways: [OSX / Unix] The instant-markdown plugin is a solution. ...
statox's user avatar
  • 48.4k
10 votes

Markdown in Neovim: which plugin sets conceallevel=2?

Like @caneta, the indentLine plugin was the culprit for me too. I solved it by disabling it for markdown files like this: let g:indentLine_fileTypeExclude = ['markdown']
Sheharyar's user avatar
  • 741
9 votes
Accepted

Open markdown filename under cursor like gf, and jump to the section?

This function is not thoroughly tested but it should provide a good enough bootstrap for your own experiments. In ~/.vim/after/ftplugin/markdown.vim: function! s:MDGoToSection() let raw_filename ...
romainl's user avatar
  • 36.9k
9 votes

Replace a series of asterisk bullet points with a numbered list

This only works with a recent Vim version (that has :h v_g_CTRL-A): Block-select the list bullets (*) and replace them with 0 (cursor is on first *): Ctrl-v j j r 0. Reselect previous block and ...
VanLaser's user avatar
  • 9,530
9 votes

Replace a series of asterisk bullet points with a numbered list

Visually select the lines and execute this substitution command: :'<,'>s/*/\=line('.') - line("'<") + 1 . '.' See :help sub-replace-expression, :help line(), and :help '<. To avoid ...
djjcast's user avatar
  • 901
9 votes
Accepted

How do I make Vim respect Markdown headers when formating text?

Since you don't have wrapping for comments enabled, the workaround in this Stack Overflow post can be used: set comments+=n:# set fo+=q This adds # as a comment marker (allowing nesting, so that ##, ...
muru's user avatar
  • 24.5k
9 votes

Paste link to image in clipboard when editing Markdown

The following solution should work on most Linux systems. It requires a relatively updated xclip tool. For a solution that works on MacOS/OSX, see @Rich's answer. I've proposed a solution that maps &...
Karl Yngve Lervåg's user avatar
9 votes

Mardown files always have vimwiki filetype (vimwiki plugin)

This is the expected behavior of the plugin when you create a file in your vimwiki the filetype is set to vimwiki. If you don't want files created outside of the wiki directory to have this filetype ...
statox's user avatar
  • 48.4k
8 votes

Markdown: how to syntax-highlight Bold and Italic in different color than normal text?

Try something like that: highlight htmlBold gui=bold guifg=#af0000 ctermfg=124 highlight htmlItalic gui=italic guifg=#ff8700 ctermfg=214
A S's user avatar
  • 240
8 votes
Accepted

Highlight double space in markdown

Quick answer: syntax match Todo "\s$" syntax match Error "\s\{2}$" syntax match Visual "\s\{3,}$" This uses match groups already available from your colorscheme to highlight differently 1,2 or 3+ ...
VanLaser's user avatar
  • 9,530
7 votes

How to fold markdown using the built-in markdown mode?

Markdown folding: As ana found out, for markdown specifically make sure that you have let g:markdown_folding = 1 or folding wont be "turned on". General folding tips: Vim won't fold automatically, ...
Tumbler41's user avatar
  • 7,646
6 votes
Accepted

Why does Vim load unrelated ftplugins?

Vim already comes with Markdown support so what happens is that you have two Markdown ftplugins doing the same thing. Since you "fixed" one (~/.vim/ftplugin/markdown.vim) without "fixing" the other ($...
romainl's user avatar
  • 36.9k
6 votes

Paste link to image in clipboard when editing Markdown

Based on answers above I've created a Plugin for vim solving my problem for macos and possibly for linux. Hope you'll find this plugin useful. I also appreciate any contributions and feature requests.
Maxim Kochurov's user avatar
6 votes

How to show math equations or formula in markdown file

Mathematical equations cannot be displayed in Vim in this way: Vim has no means of rendering them, as @BLayer explains in his answer. However, mathematical symbols you can indeed display using Vim's ...
Rich's user avatar
  • 30.4k
6 votes
Accepted

Vim RegEx question: how to detect headings of markdown(.md) i.e. lines composed of '-' or '='

The original regex is ?^==\\+$ which means, searching backwards (?) for start-of-line (^), followed by =, followed by another = which can be repeated several times (\+ qualifier, followed by end-of-...
Christian Brabandt's user avatar
6 votes
Accepted

Join all non-blank lines

Maybe it sounds too simplistic, but why not %!fmt -9999
Matt's user avatar
  • 19.5k
5 votes

How do I make Vim respect Markdown headers when formating text?

If you're willing to change the way you write your Markdown slightly, you could fix this simply by introducing an extra blank line between your headings and the following text: # this is a h1 this ...
Rich's user avatar
  • 30.4k
5 votes
Accepted

write a key command for a markdown comment

Vim creates marks for the beginning and the end of the last visual selection in the current buffer. You can use '< to move to the beginning and '> to move to end. In this way you can ...
jjaderberg's user avatar
  • 3,339
5 votes

Open markdown filename under cursor like gf, and jump to the section?

As I said in the comments on my setup gf didn't opened the file because # was in isfname, so using set isfname-=# allowed gf to jump to the file. As I also said I think the feature to go to a section ...
statox's user avatar
  • 48.4k
5 votes
Accepted

Line formatting (gq) does not correctly indent long list items

As far as I can tell (and from @Antony's comments), autoindent must be turned on for this to work. From the help pages: When autoindent is on, formatting (with the "gq" command or when you reach '...
s4y's user avatar
  • 316
5 votes

Pandoc and formatting

Markdown has a concept of a "paragraph" different from that of MS Word. In MS Word, all text wrapping is "soft wrapped"—that is, you keep typing text without pressing "Enter" (or "Return") until you ...
Wildcard's user avatar
  • 4,305
5 votes
Accepted

Paste link to image in clipboard when editing Markdown

The usual terminal command for accessing the clipboard on Mac is pbpaste. However, this doesn't work for image data, so we have to resort to AppleScript: nnoremap <silent> <buffer> p :call ...
Rich's user avatar
  • 30.4k
5 votes
Accepted

Move lines with tildes to a certain section of a file

Moving completed tasks Presuming that a done line looks like this: - ~A completed task~ Then you can do so with a :global command that performs a :move: :g/^- \~.*\~$/m/^# Things done/+1 :g ...
Rich's user avatar
  • 30.4k
5 votes
Accepted

How to use code highlighting and checking in markdown?

If you use default markdown filetype which is bundled with vim (tpope's markdown): make sure you have let g:markdown_fenced_languages = ['dart', 'python', 'ruby', 'go'] in your vimrc. This is the ...
Maxim Kim's user avatar
  • 12.2k
5 votes

Join all non-blank lines

You were almost there: v/^$/norm vipJ For each matching line it selects the inner paragraph(without following newline) und joins.This works because, the command is only executed for the first line of ...
erba's user avatar
  • 51

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