preservim / vim-markdown

Markdown Vim Mode
4.68k stars 521 forks source link

gx not working on visually select link #372

Open sadid opened 6 years ago

sadid commented 6 years ago

Based on my experience (and the minimal conf I've provided), vim-markdown plugin cause gx in vim not working in the visual mode. gf works completely fine in both normal and visual mode but gx only works in normal mode. However with special filenames (contain spaces) this is not satisfactory.

To reproduce this, I've provided the minimal vimrc config and a test markdown file. You should select the link to a pdf file in visual mode (e.g. vi) and then gx). The reason is since there is a space in the filename link visually selecting the link (url) and then gx is required.

The minimal config vimrc:

if empty(glob('~/.vim/autoload/plug.vim'))
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall | source $MYVIMRC
endif

call plug#begin('~/.vim/plugged')
Plug 'plasticboy/vim-markdown', {'for': 'markdown'}
call plug#end()

here is the test markdown file to reproduce:

this is a [link with space to a pdf file](a b.pdf).
this is a [link with space to a jpg file]("a b.jpg").

NOTE: This seems somehow similar to #353, but it might be different problem since it's just the case for visual mode.

VIM - Vi IMproved 8.1 (2018 May 17, compiled May 25 2018 00:50:25) Included patches: 1-22 Compiled by Arch Linux

sadid commented 6 years ago

To update this issue and provide a workaround I have put nnoremap <Plug> <Plug>Markdown_OpenUrlUnderCursor in the vimrc file and this has solved the problem for now.