vim-pandoc / vim-pandoc-legacy

[UNSUPPORTED/use vim-pandoc/vim-pandoc] vim bundle for pandoc users
143 stars 23 forks source link

<localleader>br not working as expected #116

Closed lingnand closed 10 years ago

lingnand commented 10 years ago

I tried creating a reference using <localleader>nr, typed something and tried going back using <localleader>br and it's not working.

Interestingly, I noticed that the reference created by <localleader>nr has a space at the beginning of the line. So I go ahead and deleted that space and it started working.

The problem is that, these sorts of things really shouldn't happen

fmoralesc commented 10 years ago

Agreed.

Thing is, we hadn't thought of this use case at all. I think <localleader>br was supposed to be used after <localleader>gr, I don't remember thinking of the case you propose. I believe the workaround you found works only by accident, and it shows a problem in the pandoc_misc#Pandoc_Back_From_Ref() function (https://github.com/vim-pandoc/vim-pandoc/blob/master/autoload/pandoc_misc.vim#L100). I'll look into it, but be aware vim-pandoc itself has been deprecated in favor of vim-pantondoc, which implements this functionality differently (but it still has this issue).

lingnand commented 10 years ago

I've already looked into the code and it appears that \nr is not very resistant to factors such as the indent of the document, thus leaving a space at the beginning. However I didn't try to fix it in the end because a SnipMate snippet in this case should do better.Something like thissnippet ‎[:/     [${1:link}][${2:}]${0}     [‎$2]: http://${3:url} "${4:title}" Regards,Lingnan From: Felipe MoralesSent: Thursday, 22 May 2014 21:14To: vim-pandoc/vim-pandocReply To: vim-pandoc/vim-pandocCc: Lingnan DaiSubject: Re: [vim-pandoc] br not working as expected (#116)Agreed.

Thing is, we hadn't thought of this use case at all. I think br was supposed to be used after gr, I don't remember thinking of the case you propose. I believe the workaround you found works only by accident, and it shows a problem in the pandoc_misc#Pandoc_Back_From_Ref() function (https://github.com/vim-pandoc/vim-pandoc/blob/master/autoload/pandoc_misc.vim#L100). I'll look into it, but be aware vim-pandoc itself has been deprecated in favor of vim-pantondoc, which implements this functionality differently (but it still has this issue).

—Reply to this email directly or view it on GitHub.

fmoralesc commented 10 years ago

I fixed this issue in vim-pantondoc, and I'm currently trying to fix it in vim-pandoc. Problem is, I can't reproduce it. Can you provide a sample text where this issue happens?

lingnand commented 10 years ago

Basically the p pastes the string after the cursor and not on the cursor and that's where the problem comes from. This should do it

map <buffer><silent> <Localleader>nr ya[o<CR><ESC>0P$a:
fmoralesc commented 10 years ago

Thanks, I incorporated that change. Does that fix this issue, or there is still stuff pending?