bullets-vim/bullets.vim

Conflict with Code Block <CR>

Opened this issue · 0 comments

I am using code block a lot when formatting the Markdown in Vim.

The code block rule is

imap <expr> <CR> ExpanderCR()

function! s:IsCodeBlock(line, ccol)
    return a:line[0:2] ==# "```" && a:line[a:ccol : a:ccol+2] ==# "```"
endfunction

function! ExpanderCR()
  if s:IsCodeBlock(line, currentCol)
    return "\<CR>\<Esc>O"
  endif
  return "\<CR>"
endfunction

The main idea is to inspect if you want to insert a block, then it will auto-insert the empty line for you to continue typing.

Your input pointer

I think is bellow in bullets.vim conflict with the above.

 488     let l:keys = l:send_return ? "\<CR>" : ''

Don't know how to solve the problem, anyone has ideas?