Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.98k stars 117 forks source link

Markdown code fences #238

Open mrak opened 8 years ago

mrak commented 8 years ago

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?

rschmitt commented 8 years ago

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.

sfurman3 commented 8 years ago

Set the 'delimitMate_quotes' option in your .vimrc:

let delimitMate_quotes = "\" '"

Type :h 'delimitMate_quotes' for more info.

adriaanzon commented 7 years ago

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
```
0ihsan commented 3 years ago

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

au FileType markdown let b:delimitMate_nesting_quotes = ['`']
roachsinai commented 3 years ago

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?