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

snip

--
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/hotab
 will complete to
:Radiant edit pages/home/
 which I can further complete:
:Radiant edit pages/home/fitab
 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/Atab
 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/Atab

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


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/hotab
will complete to
  :Radiant edit pages/home/
which I can further complete:
  :Radiant edit pages/home/fitab
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/Atab
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: 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


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: autocomplete from BufReadCmd

2007-03-12 Thread Raphael Bauduin

snip


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/pTAB   -   :split radiant/pages/
:split radiant/lTAB   -   :split radiant/layouts/
:split radiant/TAB   -   cycles through pages,layouts,snippets
:split radiant/pages/TAB  - :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


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


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('afile')))


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: 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


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