:!

範囲を指定して:![シェルコマンド]って標準入力で選択範囲を受けれるんだった。


spidermonkeyのreadline()でごにょごにょできるな。vim スクリプトよりかきなれている javascript のほうが楽だしなぁ。

関連エントリ

javascript-C1.7(spidermonkey)で標準入力


spidermonkey 1.6が出てた。 readline()も使えるようだ。
なんかよくわからないが,CVSの最新ヴァージョンだと,

js> foo = "bar"
bar
js> foo == "bar"
セグメンテーション違反です

となってしまうので1.6を使うことにする。

以下1.6のヘルプ

js> help()
JavaScript-C 1.6 2006-11-19
Command        Usage                  Description
=======        =====                  ===========
version        version([number])      Get or set JavaScript version number
options        options([option ...])  Get or toggle JavaScript options
load           load(['foo.js' ...])   Load files named by string arguments
readline       readline()             Read a single line from stdin
print          print([exp ...])       Evaluate and print expressions
help           help([name ...])       Display usage and help messages
quit           quit()                 Quit the shell
gc             gc()                   Run the garbage collector
trap           trap([fun, [pc,]] exp) Trap bytecode execution
untrap         untrap(fun[, pc])      Remove a trap
line2pc        line2pc([fun,] line)   Map line number to PC
pc2line        pc2line(fun[, pc])     Map PC to line number
stringsAreUtf8 stringsAreUTF8()       Check if strings are UTF-8 encoded
testUtf8       testUTF8(mode)         Perform UTF-8 tests (modes are 1 to 4)
dis            dis([fun])             Disassemble functions into bytecodes
dissrc         dissrc([fun])          Disassemble functions with source lines
notes          notes([fun])           Show source notes for functions
tracing        tracing([toggle])      Turn tracing on or off
stats          stats([string ...])    Dump 'arena', 'atom', 'global' stats
build          build()                Show build date and time
clear          clear([obj])           Clear properties of object
intern         intern(str)            Internalize str in the atom table
clone          clone(fun[, scope])    Clone function object
seal           seal(obj[, deep])      Seal object, or object graph if deep
getpda         getpda(obj)            Get the property descriptors for obj
getslx         getslx(obj)            Get script line extent
toint32        toint32(n)             Testing hook for JS_ValueToInt32