Re: using vim as external mediawiki editor

2007-03-31 Thread Cameron Simpson
On 31Mar2007 18:06, Dr. Johannes Zellner [EMAIL PROTECTED] wrote:
| does anyone have experience with using vim as external editor for
| mediawiki articles? I'm especially looking for some script which lets
| you commit changes to the wiki or update the preview in the browser by just
| some keystrokes from vim.

I use the It's All text! firefox/mozilla extension for this. It attaches
a small edit button to text areas that runs the editor of your choice
- I use vim-in-a-terminal for this. It then polls the temp file it made
you and updates the text area when it changes. Works well.

You still have to do the submit/preview thing as required by mediawiki, but
the editing is fairly seamless.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

What if you are underpaid?  Know the joy of being worth more than you get -
the pure joy of unrecognized superiority.   - Rev. S. M. Smith


Re: How can a script know if we're running without X ?

2007-03-13 Thread Cameron Simpson
On 13Mar2007 23:29, A.J.Mechelynck [EMAIL PROTECTED] wrote:
| How can a Vim script know if we're running without an X connection?
| Of course, some cases are obvious, such as
|   if has('unix')  !has('x11')
| meaning we're on Unix with no X11 support compiled-in.
| 
| But what about an X-enabled Vim running in console mode, either with the -X 
| command-line switch, or in a terminal with no access to an X server?

Examine the $DISPLAY environment variable. If non-empty, you have a X11
display.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

...when my mood gets too hot and I find myself wandering beyond control I pull
out my motor-bike and hurl it at top speed through these unfit roads for hour
after hour. My nerves are jaded and gone near dead, so that nothing less than
hours of voluntary danger will prick them into life... - T.E. Lawrence 1923


Re: delete html tags command?

2007-02-25 Thread Cameron Simpson
On 25Feb2007 22:19, Simon Jackson [EMAIL PROTECTED] wrote:
| is there something similar to 'dw' that would delete an entire tag and
| its contents or one just to delete the opening of a tag (just p
| instead of psome text/p?

The first requires counting nested tags - beyod my ken.

The second:

  df

or

  hfdf

or ...
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

Indeed! But do not reject these teachings as false because I am crazy. The
reason that I am crazy is because they are true.
- Malaclypse the Younger


Re: Web-based editing [Was :wq vs ZZ]

2007-02-15 Thread Cameron Simpson
On 15Feb2007 15:30, James Kanze [EMAIL PROTECTED] wrote:
| On 2/15/07, Bram Moolenaar [EMAIL PROTECTED] wrote:
| I'm using It's All Text! now.  Just had to create a shell script to
| start gvim, because it doesn't allow you to give arguments to the
| command.  I'm using this (on Unix, obviously):
| 
| #!/bin/sh
| gvim -f $@
| 
| I can't seem to get it to work; gvim comes up all right, but as
| if it was started without any file arguments.  Adding an echo to
| the shell script shows that in fact, it isn't being passed any
| arguments.  Is there something special I have to do in the
| preferences of It's All Text! to tell it how to pass a
| filename.

Um, no? It should just work. IAT only lets you supply the path to the
edit command, so it must pass the file as an argument - it seems to for
my setup. You're certain the script gets not arguments - you're echoing
$# and $* ?

| Store this in a file, make it executable, and set it from
| Tools/Add-ons/It's All Text/Preferences
| 
| The plugin can be found here:
| https://addons.mozilla.org/firefox/4125/
| 
| Warning: If you set the preferences to use Vim firefox gets stuck.
| 
| Not if you've started it from an xterm; vim comes up in the
| xterm.  (But Firefox does hang until you exit vim.)

That's surprising.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

Do not go gentle into that good night. Old age should burn and rave at the
closing of the day.  Rage, rage at the dying of the light!


Re: Feature request: off_t / off64_t

2007-02-15 Thread Cameron Simpson
On 15Feb2007 22:59, Mathieu Malaterre [EMAIL PROTECTED] wrote:
| On 2/8/07, Bram Moolenaar [EMAIL PROTECTED] wrote:
| Mathieu Malaterre wrote:
|Could someone please add off_t / off64_t to the C syntax file.
| 
| I'll add off_t, I think it's a generic type.
| I don't know off64_t.  Is that for Linux?
| 
| Yeah I am not sure, leave it alone. This comes from the 64bits hackish
| API to read large file on unix. I don't know what microsoft came up
| with. I guess they use __int64.

It's a standard type for POSIX. Include it! Look in unistd.h.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

It's there as a sop to former Ada programmers.  :-)
- Larry Wall regarding 10_000_000 in [EMAIL PROTECTED]


Re: Web-based editing [Was :wq vs ZZ]

2007-02-14 Thread Cameron Simpson
On 15Feb2007 13:39, Pete Johns [EMAIL PROTECTED] wrote:
| [...] It provides a menu item for you to launch
| your favourite text editor (Vim) from a textarea. [...]

I'sAT puts a little edit button on the bottom right corner of the text
area. An ergonomic win.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

...don't permit your spirit to be dampened by pinheaded bottom liners who
feel the proper work environment is one that resembles a benign prison camp.
- a Good Times horoscope


Re: Web-based editing [Was :wq vs ZZ]

2007-02-14 Thread Cameron Simpson
On 15Feb2007 17:32, Peter Hodge [EMAIL PROTECTED] wrote:
| Mozex (http://mozex.mozdev.org/) is working quite well for me on Windows and
| Mac.

It's good, but buries the edit function in a submenu of the context
menu. It's also not live - you need to quit the editor then click in
the text area to update; IAT! monitors the text file and updates the
textarea as yo uedit (tunable polling frequency).

I used to rely on mozex for editing and mailto: links, but now the
mailto: is controlled by the GTK libraries (Linux) and I'm using IAT!
for editing.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

Getting information off the Internet is like drinking from a fire hydrant.
- Mitchell Kapor (Lotus)


Re: Web-based editing [Was :wq vs ZZ]

2007-02-13 Thread Cameron Simpson
On 14Feb2007 10:55, Pete Johns [EMAIL PROTECTED] wrote:
| On Tue, 2007-02-13 at 16:07:32 -0700, [EMAIL PROTECTED] sent:
| (Sorry guys, my web-based editor, which I must use at work
| becauseof IT paranoia about SMTP, simply will not let me reply
| at the end rather than beginning of the thread.) 
| 
| Web-based editor? Why not use Vim as your editor from within
| Firefox? Works a treat for me!
| 
| ViewSourceWith http://dafizilla.sourceforge.net/viewsourcewith/

While on this topic, let me point you at It's All Text! here:

  https://addons.mozilla.org/firefox/4125/

Puts a small edit button on every TEXTAREA text box, which pops
up the editor of your choice. I have it set to pop up a vim-inna-xterm
(well, rxvt-unicode). But Gvim would be as good a choice.

It's very very handy.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

55 mph is fast enough to get you killed, but slow enough to make you think
you're safe.- The Gumball Rally


Re: open multiple files with wildcard from inside vim

2007-02-04 Thread Cameron Simpson
On 05Feb2007 01:09, ben lieb [EMAIL PROTECTED] wrote:
| I thought I read once that I could open multiple files with a wildcard
| from within VIM (not from the command line).
| 
| I tried this:
| 
| :sp path/file*
| 
| And vim gives me too many file names, even though there are only two
| files that match.

Have you tried:

  :n path/file*

That opens the first one and queues the others.

  :n

takes you to the next one and :p to the previous in the list.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/


Re: Vim taking a long time to save files

2007-01-18 Thread Cameron Simpson
On 18Jan2007 09:23, Tim Chase [EMAIL PROTECTED] wrote:
| It's running on the server, no network involved.   Just a standard 
| out-of-the box enterprise linux installation (ie installed from rpm)
| 
| Other things one might want to investigate:
| 
| - does it happen when you start with vim -u NONE (eliminate 
| possible plugin/script problems)
| 
| - is your hard-drive set to spin-down after some idle period? 
| (have had this with a Win32 box, where the 2nd drive spins down 
| after periods of disuse--if you access it, it has to spin up 
| which takes a spell)
| 
| - do other apps/editors have similar lag-times?  (try ed, pico, 
| emacs, joe, or whatever and see if they too have problems)
| 
| Answers to these might help narrow down where the problem resides.

One thing I often do is use strace to see where it's spending its time.

Open two terminals. Run the tty command in one to find out its name.
Let us pretent it says /dev/pts/23.

In the other terminal, go:

  strace -f -e trace=file vim some-text-file 2/dev/pts/23

Then save the file and watch the second terminal to see where the pauses
take place.

Cheers,
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

Life is pleasant. Death is peaceful. It's the transition that's troublesome.
- Isaac Asimov


Re: finding extra { braces

2006-11-30 Thread Cameron Simpson
On 01Dec2006 01:45, yakov lerner [EMAIL PROTECTED] wrote:
| It is easy to identify extra '}' in the .c source, compiler
| points us to the exact line. Rarely, I have the opposite error,
| the extra '{' somewhere in the source. For example
| int foo() {
| {
|   
|  }
| In this case, gcc points me to the end of file. This is not helpful.
| Can anyone suggest quick method of finding the function
| that contains extra '{' brace ?

I insert a closing brace at the end of the file (or earlier, depending
what extra brace opening I suspect) and then find its match.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

This site has been moved.
We'd tell you where, but then we'd
have to delete you.
- Haiku Error Messages 
http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html


Re: '\\' and \\\\ Question

2006-11-25 Thread Cameron Simpson
On 25Nov2006 15:30, Bill McCarthy [EMAIL PROTECTED] wrote:
| But the example I gave:
| echo substitute(a,'\','/','')
| actually works.  The regex process appears to treat a single
| backslash as a special case - it treats it like a pair of
| backslashes.

No, it treats it like a bare backslash - with no following character
it's not possible to treat it as a \x (for x something special like n,
etc), so rather than complain, it treats is as though it's not a
syntacticly special character. So it's just a backslash.

| On the other hand, if I want to replace \b with /b then,
| using a literal, I clearly need that second backslash:
| 
| echo substitute(a,'\\b','/b','')

Yes. Again, the distinction is that the first backslash has a following
characters. You'll only see the behaviour in your first example when the
backslash is the last character in the rgexp.

So you're really seeing here the regexp parser being forgiving instead
of strict.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

I worry about my child and the Internet all the time, even though she's
too young to have logged on yet. Here's what I worry about. I worry
that 10 or 15 years from now, she will come to me and say 'Daddy, where
were you when they took freedom of the press away from the Internet?'
- Mike Godwin


Re: '\\' and \\\\ Question

2006-11-25 Thread Cameron Simpson
On 25Nov2006 16:34, Bill McCarthy [EMAIL PROTECTED] wrote:
|  So you're really seeing here the regexp parser being forgiving instead
|  of strict.
| 
| Yes.  That's what I'm calling a special case.  I don't
| believe that special case is documented.

If you want to document things like this, rather than being really
precise and enumerating every weido invalid-but-accepted syntax, you
may find it's as simple as: if a punctuation/special/meta char cannot
complete the special syntax it introduces, treat the special char as
an ordinary char and proceed.  That covers a multitude of things where
parsers forgive invalid syntax and still act somewhat sensibly.

The shell is much the same in behaviour for its globbing.
--
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

It is without question that planning should be for the long term. Not for the
next day, but for the next millenium. Otherwise we shall not survive.
- Craig Dewick (Freight Raver Craig) [EMAIL PROTECTED]