12.9 Programming Assistancevile 's programming assistance capabilities are discussed in this section. 12.9.1 Edit-Compile Speedupvile uses two straightforward vi mode commands to manage program development, shown in Table 12.6 .
vile understands the Entering directory XXX and Leaving directory XXX messages that GNU make generates, allowing it to find the correct file, even if it's in a different directory. The error messages are parsed using regular expressions in the
buffer vile 's error finder also compensates for changes in the file, keeping track of additions and deletions as you progress to each error. The error finder applies to the most recent buffer created
by reading from a shell command.
For example, You can point the error finder at an arbitrary buffer (not just
the output of shell commands) using
the 12.9.2 Syntax Highlightingvile relies on help from an external program to provide syntax coloring. In fact, there are three programs: one for C programs, one for Pascal programs, and one for UNIX man pages. The vile documentation provides this sample macro for use in a .vilerc file: 30 store-macro write-message "[Attaching C/C++ attributes...]" set-variable %savcol $curcol set-variable %savline $curline set-variable %modified $modified goto-beginning-of-file filter-til end-of-file "vile-c-filt" goto-beginning-of-file attribute-cntl_a-sequences-til end-of-file ~if ¬ %modified unmark-buffer ~endif %savline goto-line %savcol goto-column write-message "[Attaching C/C++ attributes...done ]" ~endm bind-key execute-macro-30 ^X-q This runs vile-c-filt over the C source code. This program in turn relies upon the contents of $HOME/.vile.keywords , which specifies the attributes to provide to different text. (B for bold, U for underlined, I for italic, and C for one of 16 different colors.) This is Kevin Buettner's version: Comments:C2 Literal:U Cpp:CB if:B else:B for:B return:B while:B switch:B case:B do:B goto:B break:B Syntax coloring works on the X11 interface with both Versions 7.4 and 8.0 of vile . Getting it to work on a Linux console is a bit more complicated. It depends upon which screen handling interface it was compiled with.
On the one hand, because syntax highlighting is accomplished with an external program, it should be possible to write any number of highlighters for different languages. On the other hand, because the facilities are rather low-level, doing so is not for non-programmers. The online help describes how the highlight filters should work. The directory ftp://ftp.clark.net/pub/dickey/vile/utilities contains user-contributed filters for coloring makefiles, LaTeX input, Perl, HTML, and troff . It even contains a macro that will color the lines in RCS files according to their age! |
|