0

I started learning Vim because I spend too much time formatting text right in Markdown editors. Vim motions help a lot with that, but I still want hotkeys or motions to format text in markdown to bold italic etc.

Before I would think of implementing these in my own configuration, I would be surprised if there weren't any Neovim plugins to do this. I found Markdown LSPs and plugins like Markdown Vim mode but none specific for using hotkeys or motions to format text.

Here's a page on Basic Syntax for Markdown.

  • Hotkeys to change selected text to **bold** *italic*, _italic_ `inline code` etc.

    • ## Headings as well (any level from 1 to 6, # to ######)
    • Add links to them: [selected text](cursor position to write the link)
    • and inline code obviously.
  • > blockquotes, was well as indenting and outdenting them. indenting would be from > text to >> text.

  • Same thing with - bullet points.

  • Creating blank callouts and putting selecting text in callouts.

    > [!callout label] title
    > callout text or selected text.
    
  • Same thing with code blocks

    ``` cursor position (so I can specify the programming or markup language for syntax highlighting)
    selected text
    ```
    
7
  • Don't know if there's a plugin to do it all. Seems like a bunch of rather easy mappings. Sooner or later, somebody will suggest surround.vim for bold, italic, etc. so I might as well do it now. As for headings, bullet points and block quotes: can't get much easier than I# <Esc>, can it?
    – Friedrich
    Commented May 7 at 5:47
  • I just listed a bunch of markdown formatting to get whatever answers I can.
    – Oneechan69
    Commented May 7 at 5:58
  • There may be partial answers but these are discouraged (and you barred putting a bunch of mappings in your config). From that point, your question lacks focus. On the other hand, they're all typical markdown editing tasks so they're best kept together. I'm a bit at loss how this could be answered.
    – Friedrich
    Commented May 7 at 6:27
  • Plugin requests are off-topic here. See help center and edit if you can refocus this question.
    – D. Ben Knoble
    Commented May 7 at 20:23

1 Answer 1

1

The VimWiki plugin support the markdown syntax on top of its own syntax.

It comes with a number of mappings that help editing markdown files in particular:

  • headings
  • list
  • table

They are documented.

For the typeface support I would recommend using vim-surround

E.g:

  • To put selection in Italic you could do: S_
  • To remove italic from the selection you could do: ds_
2
  • 1
    I said somebody would bring up surround, didn't I?
    – Friedrich
    Commented May 7 at 7:27
  • 1
    I appreciate the gesture. I can hardly take credit for mentioning the (probably?) most popular Vim plugin ever. And I don't even use surround myself. I kept forgetting the mappings and had to look them up every time so I stopped using it years ago :-D
    – Friedrich
    Commented May 7 at 9:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.