vim-markdown icon indicating copy to clipboard operation
vim-markdown copied to clipboard

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

Open alexishevia opened this issue 7 years ago • 2 comments

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?

alexishevia avatar Feb 02 '18 16:02 alexishevia

Having the same issue.

bryanmylee avatar Feb 03 '20 16:02 bryanmylee

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.

r10r avatar Mar 30 '22 08:03 r10r