[TxMt] a shell mode for TextMate?
siemsen at UCAR.EDU
Mon Jul 30 22:02:25 UTC 2007
This is a blue-sky kind of question, not a query about TextMate
features. I want to do something that's probably impossible...
As I mentioned in another thread on this list titled "opening a file
readonly", I often use TextMate to view files that contain saved
copies of router or switch configurations. I never change the files,
but I like the power TextMate provides when reading the files which
can be quite large. I wrote TextMate language grammars for the 3
kinds of configuration files that I peruse, so now I have syntax
highlighting in all 3 types. Very cool!
With a little TextMate hacking I've added another benefit. When
"editing" one of these files with TextMate, I can place the caret in
an IP address, autonomous system number or VLAN number, hit the
"help" key, and TextMate looks up and displays a tooltip window that
tells me what I'm looking at. For example, if I put the caret in an
IP address and hit "help", a tooltip window pops up containing the
name that corresponds to the IP address. You can probably guess that
this is implemented with a TextMate "command" in a bundle. The
command executes a 40-line Perl script that uses gethostbyaddr or
looks strings up in a file based on very simple guesses about what
the search string is. This is *very* convenient when viewing
My question is, can I push this any further? I'd like to have the
same functionality when I'm logged into a device interactively. Today
I access network devices through Terminal windows that run telnet or
ssh sessions to the devices. I'd like to be able to place the mouse
cursor over something in such a window, hit the "help" key and have
the system make an attempt to tell me something useful about what I'm
pointing at. Terminal.app can't do this, but TextMate can.
Terminal.app can do interactive command-line sessions, but TextMate
can't. But TextMate has ^R for executing the current line as a shell
command, which is close...
Emacs has it. It's called "shell mode" or "eshell". An Emacs edit
buffer functions something like a Terminal window that's also an edit
buffer. If you move the caret (Emacs calls it "point") over any line
and hit RETURN, the point is moved to the bottom of the buffer, the
line is sent to the shell, and the output is appended to the buffer,
including the shell's prompt. With this system, command-line history
takes on a new meaning - it's not only the commands, it's all their
output that is available in the edit buffer. Instead of a shell with
Emacs-style command-line editing, it's an editor with command-line
features. I suppose Emacs handles the ever-growing edit buffer size
somehow, probably by only preserving 1000 lines or something. Emacs
urban legend has it that at some universities in the 70s, beginning
computer science students were give accounts that by default put them
in Emacs in shell mode instead of a true shell when they logged in.
If TextMate supported this, it would be an invaluable aid when I'm
working on network devices. It could probably be used in similar
scenarios to give TextMate users their own dynamic help for various
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the textmate