delimitMate icon indicating copy to clipboard operation
delimitMate copied to clipboard

Markdown code fences

Open mrak opened this issue 9 years ago • 5 comments

Forgive me if there is already an incantation of settings that allows this.

Markdown code fences are lines that start with three backticks. When I write markdown files and type the third backtick, the cursor is left between the 2nd and 3rd backticks, instead of at the end.

Here's an example:

```javascript
var someVar = 'value';

when typing three backticks to start the code fence, my cursor ends up where the | is:

``|`

instead of this:

```|

Any ideas?

mrak avatar Feb 10 '16 22:02 mrak

What if you try hitting four times, instead of three? Works for me. The fourth moves the cursor to the right (where you want it) without producing an additional backtick.

rschmitt avatar Mar 12 '16 08:03 rschmitt

Set the 'delimitMate_quotes' option in your .vimrc:

let delimitMate_quotes = "\" '"

Type :h 'delimitMate_quotes' for more info.

sfurman3 avatar Aug 29 '16 13:08 sfurman3

Here is my attempt at configuring delimitMate for markdown:

" in ~/.vim/after/ftplugin/markdown.vim
let b:delimitMate_expand_cr = 2
let b:delimitMate_expand_inside_quotes = 1
let b:delimitMate_expand_space = 0
let b:delimitMate_nesting_quotes = ['`']

It works, except for <CR> expansion when the code block has a language, like this:

```javascript
```

adriaanzon avatar May 24 '17 09:05 adriaanzon

Cane be done only for markdown with autocmd in a global vimrc

au FileType markdown let b:delimitMate_nesting_quotes = ['`']

0ihsan avatar Dec 14 '20 13:12 0ihsan

Here is my attempt at configuring delimitMate for markdown:

" in ~/.vim/after/ftplugin/markdown.vim
let b:delimitMate_expand_cr = 2
let b:delimitMate_expand_inside_quotes = 1
let b:delimitMate_expand_space = 0
let b:delimitMate_nesting_quotes = ['`']

It works, except for <CR> expansion when the code block has a language, like this:

```javascript
```

I have same setting, 😃.

Some different is:

let delimitMate_expand_space = 1
let delimitMate_expand_inside_quotes = 0

So current for <CR> expansion when the code block has a language is not supported, right?

roachsinai avatar Mar 19 '21 15:03 roachsinai