Skip to main content
17 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,546
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
  • 427
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
  • 50.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
  • 761
10 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
  • 50.4k
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
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
  • 41.8k
8 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,776
7 votes
Accepted

Join all non-blank lines

Maybe it sounds too simplistic, but why not %!fmt -9999
Matt's user avatar
  • 21.3k
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
  • 32.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
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
  • 50.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
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
  • 32.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
  • 32.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
  • 13.8k
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
5 votes
Accepted

Fold just one line

'foldminlines' 'fml' number (default: 1) local to window {not available when compiled without the +folding feature} ...
Maxim Kim's user avatar
  • 13.8k
5 votes

How to cut a markdown link on the same line e.g. from `[` to `)`?

I'd just do this in normal mode: 0f[df). If this is something you're doing a lot, then you could create a mapping: :nnoremap <leader>d 0f[df) But once you're going that far, you probably want ...
Rich's user avatar
  • 32.4k
5 votes

Convenient way to surround block with markdown codeblock backticks

Presuming your lines are already formatted as a paragraph as in your example, you can type: cip```Enter```EscP. You can substitute in any motion/text object for ip if you want to surround other things....
Rich's user avatar
  • 32.4k
4 votes

Automatically add '>' at beginning of line following one starting with '>' when writing Markdown

The 'mail' ft plugin (at least in vim 7.4) does this by making '>' a comment leader, like this: set comments+=n:> The "n:" means that they can be nested, as they often are in email. You probably ...
John O'M.'s user avatar
  • 8,622
4 votes

No italics in vim

It's possible your terminal doesn't support italics. Go through this link (if you're interested in learning a little) to possibly fix your issue. Start at the paragraph with vimrc in it. I'll provide ...
Scrambo's user avatar
  • 141
4 votes

How to show math equations or formula in markdown file

My interpretation is that the OP is looking for rendering of markup into fancy, graphical depictions of equations and formulae. If instead the question is about simple substitutions of Unicode ...
B Layer's user avatar
  • 20k
4 votes

Generating automated bullets and numbered lists with markdown

Just discovered the "bullets" plugin. Seems to do the job perfectly: https://github.com/dkarter/bullets.vim
StevieD's user avatar
  • 1,542
4 votes

Join all non-blank lines

Normal substitution: %s/\([^\n]\)\n\([^\n]\)/\1 \2/ Substitution with magic mode, so as to drop escaping (): %s/\v([^\n])\n([^\n])/\1 \2/ Explanation: ([^\n]) is any character except a newline in ...
Quasímodo's user avatar
  • 2,486
4 votes
Accepted

Can I somehow define the file type in some meta-data?

some metadata, embedded into file comments, could be given in the file content itself This is exactly what a modeline does. You can set (some) options for the current buffer from this line. See :help ...
Friedrich's user avatar
  • 2,815
3 votes

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

I enable folding in markdown files by using the following in my .vimrc: set foldmethod = manual set foldcolumn = 1 highlight Folded ctermbg = NONE highlight FoldColumn ctermbg = NONE let g:...
Rodrigo Pinto's user avatar
3 votes

How do I make regexes mutually contain each other?

If you have known start and end delimiters, you should use regions (:h :syn-region): syntax region Emphasis start="\\\@<!\z(_\)" skip="\%(\s\|\\\)\@<=\z1\|\z1\k" end="\\\@<!\z1" keepend ...
Tommy A's user avatar
  • 6,800

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