Friday, February 14, 2014

Re: gd command doesn't go to definition of identifier

On Friday, February 14, 2014 3:55:26 AM UTC-5, coot_. wrote:
>On 08:24 Fri 14 Feb, Jürgen Krämer wrote:
>>Paul wrote:
>>> I a *test* file tmp.tex consisting solely of the following LaTeX code:
>>>
>>> Start LaTeX code
>>> ----------------
>>> \DeclareAcronym{myacro}{
>>> short = MYACRO,
>>> long = some longer expansion of myacro
>>> }
>>>
>>> \section
>>> {Big long section name that never ends but keeps going and going and}
>>> \subsection{\ac{myacro}}
>>> --------------
>>> End LaTeX code
>>>
>>> If I place my cursor on "myacro" on the last line and press "gd"
>>> (without quotes), cursor does not jump to the first occurance on
>>> the first line. However, if I attach the 4th last line "{Big long
>>> section..." to the preceding line "\section" with no adjoining
>>> space, then "gd" *does* work.
>>>
>>> Can anyone explain why? The problem exhibits itself even if the
>>> file is named tmp.txt, so it doesn't seem to be a
>>> language-specific syntax issue.
>>
>> the description at ":help gd" seems to indicate that "gd" is
>> intended to be used on C-like code, i.e., languages that use curly
>> braces to define blocks. In a lot of places Vim assumes that a C
>> function starts with an opening curly brace in the first column.
>> Vim does not actually have a concept of programming language
>> structures. With "gd" the search for "myacro" will start at the
>> curly brace that Vim *thinks* is the start of a function. As long
>> as your text "{Big long section name ..." is on a line of its own,
>> the search for "myacro" will start there and stop at the place
>> where your cursor is already located.
>>
>> Maybe with LaTeX code "gD" might be a better alternative, although
>> this will always stop at the first occurrence of a word and ignore
>> later re-definitions.
>
> AutomaticLaTeXPlugin has a map for that.
>
> The author (of ATP), Marcin

Jurgen, your explanation sort of makes sense. Before posting, I thought that C's insensitivity to white space ruled that explanation out rules out that explanation, but it's the only candidate for a reason so far.

Marcin, I will have to look into ATP. It must give extra power to vim when used for LaTeX.

Get it? ATP -- power -- muscle ??

Sigh.

Seriously, I will have to look into such an intriguing plugin. Thanks.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment