![]()
!wc -w %
# @(#)wc.tcl 8.2 (Berkeley) 11/18/95
#
proc wc {} {
global viScreenId
global viStartLine
global viStopLine
set lines [viLastLine $viScreenId]
set output ""
set words 0
for {set i $viStartLine} {$i <= $viStopLine} {incr i} {
set outLine [split [string trim [viGetLine $viScreenId $i]]]
set words [expr $words + [llength $outLine]]
}
viMsg $viScreenId "$words words"
}
:tc wc
""" load scripts from nvi tcl interpreter
tc source /home/paul/.nvi_tcl
Unfortunately, development on nvi seems to have come to a standstill. Not a bad thing in itself — one of the drawbacks of so much free software is how it is constantly changing "under your feet", so to speak — but in the case, it seems work came to a halt while there were still things to do. Not that the software isn't stable and complete in itself, but the tcl interpreter is left undocumented.
More about Tcl here: Softpanorama Tcl Links.
By the way, amid all my reading about Tcl on the weekend, one snippet caught my attention:
About the extra newline thing... under Unix, (possibly POSIX) all text files are supposed to end in a blank line, hence the "extra" newline. This is the proper behavior, even if it isnt technically required for most things these days. Unix text editors and tools still enforce it—http://mini.net/tcl/367
Did you know that? I didn't know that.
Copyright © 1995-2007
Paul Dunne,
Sponsored links (requires javascript):