Various ways of editing Wiki pages in your editor of choice have been suggested
in the pages:
What Hath Been Wrought?
There are a few bits to this:
- A Daemon program wikiEditDaemon.pl and it's perl object wikiEditDaemonObject.pm
- Two template files, implementing the non-skin
- A script for the vim editor which communicates with the daemon.
- A syntax file for the vim editor which does a modest job of marking WikiSyntax (which you can get from the VimEditor page).
The daemon is capable of getting pages from the Wiki using the
templates and putting them in a directory for editing. When you are done
editing it saves the result back to the Wiki. The VimEditor
this into Vim
The Fine Print (Disclaimer)
If you are going to use this the standard disclaimers apply. If this
software causes you to lose or corrupt data, brings down your corporate
network, gets you fired or starts a war, then that makes me sad but doesn't
make me liable.
If you have improvements or suggestions, please let me know.
This is software I use every day, and it works for me. It likely has some bugs.
As they say, every program has bugs, and every program can be
shortened by one line... therefore every program can be reduced to a single
line that doesn't work. Hopefully I'm not that badly off here.
This software is aimed at power users and is known to work on Linux. I expect
that other versions of Unix should be OK. Windows users may well be out of
luck since I use Unix FIFO pipes.
I'm using this on a 01 Dec 2001 release of TWiki. I've got a current
installation of Perl (5.8) but I expect anything after 5.005.3 should work.
You'll need the
package for Perl for the
packages, and the
You could use the Daemon component with editors other than the VimEditor
you would have to write a script in that editor to do so, or communicate
directly with the daemon through its FIFO pipe. I also use the
system to check on processes.
How to Install This
- Put the daemon perl scripts in a handy place.
$HOME/bin is my favourite place, and is the default configured in the script itself. If you put it somewhere else, you'll need to change the path as indicated in the script
- If you intend to use the daemon with the VimEditor then put the
.wikiVimRC script somewhere where you can
:source it, usually in your
$HOME directory. Put the syntax file from the VimEditor page either in the vim syntax installation, or under
$HOME/.vim/syntax so that Vim will find it.
- Put the templates on the TWiki installation under the
twiki/templates directory. This program needs these templates to function properly.
Using the Package
If you are using Vim, all you need to do is
the management functions into Vim. The following short-cut commands are
provided, and work from command-mode in Vim:
Start the daemon. If it is already running (as indicated by the presence of its input pipe and the process is there) then it won't be started again.
Supplies the daemon with the TWiki URL. When prompted, supply the URL up to and including the
Authenticate yourself to the TWiki. When prompted, give it your WikiName and your password.
Supply the Web.PageName to be edited. When the download is done, the editor will pull the file in for editing.
Saves the Web.PageName you supply on the command prompt line. This will close the window if you save from the file's own edit buffer
Saves the current edit buffer back to the wiki, closing it it when it has finished.
Displays the last few lines of the edit daemon log file.
If you need to create a page, create it first through your browser. Also,
use the browser mechanisms to change or add forms to the page.
There will be a line
<!--- Do not remove this line: Form Fields can be edited below --->
in the file you edit. If form values are attached to the page, then they
are supplied after this line in a simple
format which you can then modify. Changes will be written back to the
Guts of the Thing
The daemon creates a directory, by default
$HOME/.wikiEditDaemon/log is the log file, and lists operations that have been performed and errors that have occurred. Old log files are stamped with the date and time when a new daemon starts, and left in the directory for reference.
$HOME/.wikiEditDaemon/edit is the editing directory, where the files that you have recalled are placed for editing.
$HOME/.wikiEditDaemon/inputPipe is the pipe to which you feed commands.
Note that all of this is only readable and writable by you. Files in the
sub-directory are removed after editing is complete.
You can send commands directly to the daemon with an
echo quit > ~/.wikiEditDaemon/inputPipe
It understands the commands:
configure wikiURL followed by the URL of the Wiki, up to and including the
authenticate followed by your Wiki name and password.
edit followed by the Web.PageName to be edited.
save also followed by the Web.PageName to be edited, or the keyword
ALL to save all open files.
quit to shut down, saving all files opened with
Note that you must configure the URL, then authenticate, then you can start
Useful Notes, Known Problems
- I like to put a few menu items up that call the editing functions for various often edited files (in my case, log books).
- When I start my
.vimrc that is set for certain tasks, I call the functions to start the daemon, supply a default URL, then call the authentication function.
- It would be nice to be able to access the search routines of TWiki this way. Someday I'll have to write something, but not today.
- There is supposed to be a read-only mode with this, done with the
read command to the daemon. Unfortunately, the
raw option of the view command is contaminated with HTML code in the
bin/view script and the minimal template doesn't get what I expected.
- If I was feeling really smart and enthusiastic I would use the VimEditor language interface to use the daemon more directly. I don't feel that smart today, but might later on.
12 Nov 2002
Comments & Feedback
I've posted another update, this one whacks a nasty little bug that went
off at midnight.
- 17 Jan 2003
BTW I mentioned your Gvim integration daemon yesterday to someone at London.pm
who is developing a 'wikibot' - an IRC bot that lets IRC users update Wikis by sending messages to the bot via an IRC channel. He has a working version for UseModWiki
, using LWP::Agent like your code, so there may be some scope for code re-use - see the Wikibot
page for more info.
- 22 Nov 2002
TEXTAREAS are handled with vi/vim (or your favourite
with the superb text mode browser 'w3m' (synop.: better than 'lynx' and perfect for mostly text TWikis with support for tables, cookies, ssl, etc.; contemporaneous to but functionally superior to 'links' other than in terms of performance IMHO)
I don't believe that 'w3m' is available under cygwin yet ('links' is and may do the job as well) so this may be a Linux/Unix only solution, but of course if one has access to a Linux server via ssh/telnet then w3m/links may be used from most any platform.
Also, I've heard mention, but not verified, that Mozilla supports external editors for textareas as well. This may be in a devel or patch but not a released version however.
- 03 Dec 2002
Of course it does
I'm using it right now together with VimEditor
. You need a so called Extension
, which you can
find at http://extensionroom.mozdev.org/
. I only tested FireFox (which works quite
well), but Mozilla should work too.
Hmm, I should start a new page for this, but which
Web is the right one for ExternalEditorViaMozEx ? Support? TWiki?
- 11 Jun 2004
Thanks for the link Ralf. I would probably create ExternalEditor
and make a Mozilla and w3m sections within that page. In which web though? That's a tough one. I would do it here in Codev because it gets the most eyeballs. There is not much action in TWiki, that being mostly "the manual" (and nobody reads them anymore... :).
- 13 Jun 2004
This really seems like the kind of thing that should be put in vim scripts
. I'm very tempted to do it to help spread the TWiki love, but I don't want to seem like I'm taking the credit for it.
- 15 Mar 2006
See also: EditorDaemonAddOnDev