nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] jumping to the declaration of a symbol


From: Benno Schulenberg
Subject: [Nano-devel] jumping to the declaration of a symbol
Date: Mon, 21 May 2018 11:15:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

Op 19-05-18 om 02:21 schreef Marco Diego Aurélio Mesquita:
> Surprise: we already have that feature! An unintended consequence of
> having pre-recorded macros is that (combined with the linter feature)
> it makes for a reasonably good source code navigation tool. Add the
> following lines to your .nanorc:
> 
>   # Experiments for code navigation
>   set wordchars "_"
>   set afterends
>   extendsyntax c linter ./navigate.sh

No need for an extra script in this case.  You can just do:

    extendsyntax c linter cat found_tags

>   bind M-1 "^][1;5D^[a^[[1;5C^[6^R^Xgrep ^U tags > found_tags^M^T" main

I've changed this to:

   bind M-J "^[OC^[od^[A^[oc^[6^R^Xgrep ^U tags >found_tags^M^Ty^C" main

It uses the shortest available escape sequences for the arrow keys,
adds a <Right> at the beginning so the <Ctrl+Left> will do the right
thing when the cursor was on the first character of the symbol, adds
"y" at the end in case the symbol is in an unopened file, and finishes
with ^C to get out of the linter.

> And the tags file is generated by:
> 
>   ctags -x src/*.[ch]|awk '{print $4":"$3": "$1}'> tags

For a usable tags file, I need to run:

    ctags -x src/*.[ch] | awk '{print $3":"$2": "$1}'> tags

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]