Re: swapfile name

2007-03-18 Thread Raphael Bauduin

On 3/17/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Raphael Bauduin wrote:
> On 3/16/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
>> Raphael Bauduin wrote:
>> > Hi,
>> >
>> > When opening a file, is there a way to tell vim which name to use for
>> > the swapfile?
>> >
>> > I'm writing a little vim config file to edit a CMS' content in a DB.
>> > Each page has a parts named 'body', which the script makes available
>> > through
>> >:Radiant edit pages/Home Page/body
>> > or, for another page:
>> >:Radiant edit pages/Home Page/Articles/First Post/body
>> >
>> > The problem is that vim is using the same swapfile due to the last
>> > part of the path being body in both cases. I see 2 solutions to this
>> > problem: either use no swapfile (resetting swapfile), or specify
>> > another name for the swapfile, with a preference for the latter. I can
>> > specify the directory where to put swapfiles, but can I specify a name
>> > for the swapfile? Or can I set a swapfile directory specific to a
>> > buffer?
>> >
>> > Thanks in advance for your help.
>> >
>> > Raph
>> >
>> >
>>
>> IIUC, you can't specify the swapfile name; but (again, IIUC) the
>> default is to
>> write the swapfile in the same directory as the editfile: so you would
>> have
>>
>> pages/Home Page/.body.swp
>>
>> and
>>
>> pages/Home Page/Articles/First Post/.body.swp
>>
>> which are different files by virtue of being located in diferent
>> directories.
>
> The swapfile used is .body.swp , it doesn't seem to create the
> directories. I set directory=/tmp/ and the swapfile used is
> /tmp/body.swp .

That's the problem. If you set the swapfile to always be written to a fixed
directory, there will be collisions.

If 'directory' starts with . (as in the default), Vim will attempt to create
the swapfile in the same directory as the editfile. There will be no need to
"create" the directory since it already contains the file you're editing, and
for the same reason it should be writable.


This directory doesn't exist as the path is in fact mapped to a
database (see http://www.raphinou.com/radiant.vim/ , I'll post a new
release today). However, it works fine when I create the directory.
Thanks for your help on this!

Raph

PS: I saw after sending my previous mail I had mistakenly done a
'Reply' rather than 'Reply all'. Thanks for having redirected the
discussion on the ML. Mistakes do happen



--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


swapfile name

2007-03-16 Thread Raphael Bauduin

Hi,

When opening a file, is there a way to tell vim which name to use for
the swapfile?

I'm writing a little vim config file to edit a CMS' content in a DB.
Each page has a parts named 'body', which the script makes available
through
   :Radiant edit pages/Home Page/body
or, for another page:
   :Radiant edit pages/Home Page/Articles/First Post/body

The problem is that vim is using the same swapfile due to the last
part of the path being body in both cases. I see 2 solutions to this
problem: either use no swapfile (resetting swapfile), or specify
another name for the swapfile, with a preference for the latter. I can
specify the directory where to put swapfiles, but can I specify a name
for the swapfile? Or can I set a swapfile directory specific to a
buffer?

Thanks in advance for your help.

Raph


--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


Re: complete=custom for path including spaces

2007-03-15 Thread Raphael Bauduin

On 3/15/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:


Raphael Bauduin wrote:

> I'm writing a command with a custom completion, and it works fine,
> except when there's a space in the "path" to complete.
>
> For example, without spaces everything works:
>:Radiant edit pages/ho
> will complete to
>:Radiant edit pages/home/
> which I can further complete:
>:Radiant edit pages/home/fi
> to
>:Radiant edit pages/home/first-post/
>
> If there's a space, it doesn't work:
>:Radiant edit pages/Ho
> is completed to
>:Radiant edit pages/Home\ Page/
> But now, this
>:Radiant edit pages/Home\ Page/A
> doesn't complete it, although my completion function returns what is
> expected as completion:
>pages/Home\ Page/About
>pages/Home\ Page/Articles
>
> What am I missing here?

Did you try returning the matches without the backslash?


I'm 99% sure I tried it, but your question is seeding doubts :-)



You can also try using "customlist", then Vim will not filter the
results.  The backslash may confuse the filtering.


I did that indeed (but from further tests, the following approach
should also work when using custom in place of customlist), and only
return the part after the last space.  Eg, when completing
:Radiant pages/Home Page/A

the returned list is

["Page/About","Page/Articles"]


I'll post a notice  when I get a satisfying result.

Cheers

Raph

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


Re: How to paste while keep the cursor at the same place?

2007-03-14 Thread Raphael Bauduin

On 3/14/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Albie Janse van Rensburg wrote:
> Raphael Bauduin wrote:
>> Is it possible to jump to a mark at the exact same position in the
>> line as when the mark was set? When I jump to a mark I always get back
>> to the first character of the line.
> You are using ' instead of  `
>
> On my keyboard, ` is on the same key as ~.  ` is used to jump to a mark
> characterwise, whereas ' does so line-wise.
>

On mine (which is an AZERTY fr-BE layout) the apostrophe is lowercase 4 while
the backtick is AltGr+ยต (i.e. the Greek letter mu with AltGr modifier)
followed by space. (The same key, when followed by one of the letters aeinouwy
instead of a space, would add a grave accent to the letter.)



Thanks albie and tony.

I'm also using a fr-BE, so I guess I'd better set an alternate mapping
to make it easily accessible :-)

Raph






Best regards,
Tony.
--
I gave up Smoking, Drinking and Sex.  It was the most *horrifying* 20
minutes of my life!




--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


Re: How to paste while keep the cursor at the same place?

2007-03-14 Thread Raphael Bauduin

On 3/14/07, Gary Johnson <[EMAIL PROTECTED]> wrote:

On 2007-03-13, Peng Yu <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Suppose I use p to paste something, the cursor always goes to the end
> of the pasted text. Is there any other key to paste will keep the
> cursor before the pasted text?

See

:help `[



Is it possible to jump to a mark at the exact same position in the
line as when the mark was set? When I jump to a mark I always get back
to the first character of the line.

Even '< described as "To the first character of the last selected
Visual area in the current buffer" puts me at the start of the line.

Thanks

Raph




You could either type `[ after the p to move the cursor, or you
could remap p like this

:noremap p p`[

to have it behave that way all the time.

HTH,
Gary

--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Mobile Broadband Division
 | Spokane, Washington, USA




--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


complete=custom for path including spaces

2007-03-14 Thread Raphael Bauduin

Hi,

I'm writing a command with a custom completion, and it works fine,
except when there's a space in the "path" to complete.

For example, without spaces everything works:
  :Radiant edit pages/ho
will complete to
  :Radiant edit pages/home/
which I can further complete:
  :Radiant edit pages/home/fi
to
  :Radiant edit pages/home/first-post/

If there's a space, it doesn't work:
  :Radiant edit pages/Ho
is completed to
  :Radiant edit pages/Home\ Page/
But now, this
  :Radiant edit pages/Home\ Page/A
doesn't complete it, although my completion function returns what is
expected as completion:
  pages/Home\ Page/About
  pages/Home\ Page/Articles

What am I missing here?

Raph

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


Re: autocomplete from BufReadCmd

2007-03-12 Thread Raphael Bauduin




vim comandline completion if programmable:
:helpgrep -complete=file
:helpgrep -complete=custom



This is what I need. However, I hoped to be able to define it for
standard vim commands such as split, edit, etc
Isn't there a way to specify a custom completion if the filename
starts with radiant/ , like I defined the autocommands for filename
starting with radiant/ ?

Examples of what I want to achieve:

:split radiant/p   ->   :split radiant/pages/
:split radiant/l   ->   :split radiant/layouts/
:split radiant/   ->   cycles through pages,layouts,snippets
:split radiant/pages/  -> :split radiant/pages/Home\ Page

This should also work with edit, vsplit, etc

If you want to see the complete code of the vim script, it is
available at http://www.raphinou.com/radiant.vim/

Thanks

Raph

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


autocomplete from BufReadCmd

2007-03-11 Thread Raphael Bauduin

Hi,

I've written a BufReadCmd so that when I edit files starting with
radiant/ (I am working with http://www.radiantcms.org ), it lets me
edit a certain field of a certain row determined by the path following
the radiant/prefix:

:au BufReadCmd radiant/* ruby ReadFile( VIM::evaluate( "expand('')"))


For example, this command

:split radiant/pages/Home\ Page/articles/First\ Post/body

lets me edit the body of the First post located in the section
acticles which is itself under the Home Page.

Similarly

:split radiant/layouts/1

lets me edit the layout with id 1.


As my first example shows, the length of the path to enter can grow,
and I would like to add autocompletion like there is when editing a
file on the filesystem. The problem is that I didn't find any
documentation for that. Does anyone of you have a pointer to
documentation on how to implement this?


Raph





--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


Re: character ^@ in place of new lines

2007-03-11 Thread Raphael Bauduin

Hi,

The extra character is the hex 0 character, ga returns
<<00>>  0,  Hex 00,  Octal 000.

Just in case someone else get the same problem, I've corrected it by
repalcing this line in my script:

 VIM::Buffer.current.append(0, content)

by this:

 VIM::command('1')
 VIM::command("norm i"+content)

Raph



On 3/9/07, Raphael Bauduin <[EMAIL PROTECTED]> wrote:

HI,

I'm writing a BufReadCmd to read content from a database. It works
fine, except that new lines are displayed as [EMAIL PROTECTED] When I write it 
back
new lines are correct in the data written in the DB. I guess this is a
problem with encoding, but I have everyting in UTF-8: database,
fileencoding (I set it at the start of BufReadCmd), encoding, and (I
think) terminal (xterm -u8).

Does any one have a hint? Searching the web for these characters
wasn't very helpful

thanks.


Raph

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org




--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org


Re: beta 7.0e and cmdline_comp on ubuntu

2006-04-20 Thread Raphael Bauduin
On 4/20/06, James Vega <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 20, 2006 at 05:06:05PM +0200, Raphael Bauduin wrote:
> > I looked there, but it's not set. ( I rechecked with a grep ;-)
>
> nocp is short for nocompatible which is set in Debian (and Ubuntu's
> unless they're deviating from us on that) /etc/vim/vimrc.


that's it indeed.

raph


Re: beta 7.0e and cmdline_comp on ubuntu

2006-04-20 Thread Raphael Bauduin
I looked there, but it's not set. ( I rechecked with a grep ;-)

Oh well, I'ml switch to vim7 anyway :-)

Raph


On 4/20/06, Thomas Adam <[EMAIL PROTECTED]> wrote:
>  --- Raphael Bauduin <[EMAIL PROTECTED]> wrote:
> > On 4/20/06, Benji Fisher <[EMAIL PROTECTED]> wrote:
> > > On Thu, Apr 20, 2006 at 11:45:41AM +0200, Raphael Bauduin wrote:
> > > > Hi,
> > > >
> > > > I have compiled beta 7.0e on ubuntu, but command completion doesn't
> > > > seem to work.  A tab displays ^I. Did I miss something obvious?
> > >
> > > :set nocp
> > >
> > > :help 'compatible'
> > >
> > > HTH --Benji Fisher
> > >
> >
> > That was it indeed, thanks!
> >
> > Not sure why it works with the packaged vim as I nowhere found nocp
> > (no vimrc listed by vim --version contained that command). Is there a
> > compile time configuration possible?
>
> Well, it's set in /etc/vim/vimrc -- which I just copied as ~/.vimrc many
> moons ago.
>
> -- Thomas Adam
>
>
>
>
>
> ___
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
> voicemail http://uk.messenger.yahoo.com
>


Re: beta 7.0e and cmdline_comp on ubuntu

2006-04-20 Thread Raphael Bauduin
On 4/20/06, Benji Fisher <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 20, 2006 at 11:45:41AM +0200, Raphael Bauduin wrote:
> > Hi,
> >
> > I have compiled beta 7.0e on ubuntu, but command completion doesn't
> > seem to work.  A tab displays ^I. Did I miss something obvious?
>
> :set nocp
>
> :help 'compatible'
>
> HTH --Benji Fisher
>

That was it indeed, thanks!

Not sure why it works with the packaged vim as I nowhere found nocp
(no vimrc listed by vim --version contained that command). Is there a
compile time configuration possible?

Cheers

Raph


beta 7.0e and cmdline_comp on ubuntu

2006-04-20 Thread Raphael Bauduin
Hi,

I have compiled beta 7.0e on ubuntu, but command completion doesn't
seem to work.  A tab displays ^I. Did I miss something obvious?

Here's some info:

$ vim --version
VIM - Vi IMproved 7.0e BETA (2006 Apr 16, compiled Apr 20 2006 11:34:10)
Compiled by [EMAIL PROTECTED]
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv -cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+folding -footer +fork() -gettext -hangul_input -iconv +insert_expand +jumplist
 -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm
-mouse_jsbterm -mouse_netterm +mouse_xterm -multi_byte +multi_lang -mzscheme
-netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile
-python +quickfix -rightleft -ruby +scrollbind -signs +smartindent -sniff
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white
-tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore
+wildmenu +windows +writebackup +X11 -xfontset -xim +xsmp_interact
+xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
 user vimrc file: "$HOME/.vimrc"
  user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/vim-7.e/share/vim"
Compilation:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2  -I/usr/X11R6/include
Linking: gcc  -L/usr/X11R6/lib   -L/usr/local/lib -o vim-lXt -lncurses

ldd of my compiled vim:
$ ldd /usr/local/vim-7.0e/bin/vim
linux-gate.so.1 =>  (0xe000)
libXt.so.6 => /usr/lib/libXt.so.6 (0xb7e92000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb7e51000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7d22000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb7d1b000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb7d02000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb7c42000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7c3e000)
/lib/ld-linux.so.2 (0xb7ef5000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb7c3b000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7c36000)
ldd of the packaged vim (v 6.3)
$ ldd $(which vim)
linux-gate.so.1 =>  (0xe000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb7f7f000)
libgpm.so.1 => /usr/lib/libgpm.so.1 (0xb7f79000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e4a000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7e46000)
/lib/ld-linux.so.2 (0xb7fd5000)

Thanks

Raph