LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Browsing through code with tags? (https://www.linuxquestions.org/questions/programming-9/browsing-through-code-with-tags-4175611325/)

validator456 08-04-2017 01:38 PM

Browsing through code with tags?
 
On a regular basis I have to open a SVG file (Scalable Vector Graphics) and because these files can be quite large, I have difficulty browsing the code, especially if there is an error.
Example (simplified):

Code:

<g> 
  <g> 
      </g> 
  <g> 
      </g>   
</g>

How can I jump from one tag to its end tag? For instance, if my cursor is on the first tag <g>, how can I go to the end tag </g> (The last tag in the example).

So, in short, my question is, how can I browse code in the best way?

TheEzekielProject 08-04-2017 01:50 PM

Depends on the editor you use. I use vim and with the "set showmatch" option in .vimrc if you have the cursor on one bracket for example it highlights the corresponding one

Turbocapitalist 08-04-2017 01:55 PM

Emacs will open SVG files as in nXML mode and allow you to edit the file as XML. So in emacs you could bind keys to nxml-down-element, nxml-backward-element, nxml-forward-element, and nxml-backward-up-element.

validator456 08-04-2017 02:50 PM

Quote:

"Browsing through code
:set mps+=<:>
matchpairs does the job for me in Vim. See above.

This is the page that discusses it and more: http://vim.wikia.com/wiki/Moving_to_matching_braces

There is also a vim plugin that offers more but I haven't looked into it.

Thank you for your answers, both of you.


All times are GMT -5. The time now is 08:01 PM.