preservim / vim-markdown

Markdown Vim Mode
4.7k stars 524 forks source link

Issue with `<Enter>` in `:Toc` #359

Open alexishevia opened 6 years ago

alexishevia commented 6 years ago

The documentation for :Toc says:

Hit <Enter> on a line to jump to the corresponding line of the markdown file.

However, I already have a mapping for <Enter> on my vimrc:

" use ENTER to add new lines without going into insert mode
nnoremap <CR> o<Esc>k

Which causes <Enter> inside the :Toc buffer to return an error:

E21: Cannot make changes, 'modifiable' is off

If I disable my mapping with :unmap <CR> then the :Toc jump-to-line behavior starts working. However, that causes my <CR> mapping to be lost for all buffers.

Is there a way to remove my <CR> mapping only in the :Toc buffer? Or a way to make the Toc mapping for <CR> be more specific than my .vimrc mapping? Or a way to use a different key for the jump-to-line behavior?

bryanmylee commented 4 years ago

Having the same issue.

r10r commented 2 years ago

I had the same issue

My ~/.vimrc had the following mappings (for vim-go)

map <C-m> :cprevious<CR>  

I've turned it into

autocmd FileType go map <C-m> :cprevious<CR> 

This fixes <ENTER> in :Toc for me.