creating a new file in the Explorer

2006-07-28 Thread Roel Vanhout

Hi,

In the vim Explorer (:Explore), I can create a new directory by pressing 
'd' and typing the directoryname. Is there something similar for 
creating a new, empty file? I've looked through the documentation but 
couldn't find anything. I now press 'c' and type :new filename, but 
that's error-prone (I usually forget to press 'c' and end up with a file 
in the wrong directory). Thanks.


cheers,

roel




Visual select / paste behaviour

2006-07-28 Thread Roel Vanhout

Hi,

Take the following example:

file file_id=myidc:\test.txt/file

When the cursor is on the 'm' of 'myid' and I press 'vw', a word is 
selected in visual mode. However, the  at the end of 'myid' is also 
selected. How do I change the list of 'word separators'?


On a related note, when I have 'myid' selected and I want to replace it 
with the contents of the yank buffer, I press 'p'. But the original 
contents of the yank buffer are then replaced my 'myid', i.e. the text 
that was replaced in the paste operation. How do I change this 
behaviour? Do I have to write a macro to override the paste behaviour in 
visual mode or is there another way? Thanks.


cheers,

roel




Re: Visual select / paste behaviour

2006-07-28 Thread Roel Vanhout

Tim Chase wrote:

  file file_id=myidc:\test.txt/file
  When the cursor is on the 'm' of 'myid' and I press 'vw',
  a word is selected in visual mode. However, the  at the
  end of 'myid' is also selected. How do I change the list
  of 'word separators'?
Well, the answer to your question is that there's a setting
called 'iskeyword' to which you can add and from which you
can remove characters.  However, by default, it doesn't
include the double-quote character.  What you're seeing is
an expression of that range from the drop-point m *up to,
but not including* where the cursor is (on the quote).  If
you follow your vw example with y to yank it, and then
paste it elsewhere, you'll see that the selection was
accurately just myid, not myid


Thanks, this is indeed the setting I'm looking for. However it seems 
that the w motion *is* inclusive, at least on my installation. Here's 
what :set iskeyword says:

iskeyword=@,48-57,_,192-255
(which is the default, I did a 'set nocp' to make sure it was reset to 
the default, as per the docs).
Now when I repeat putting the cursor on 'm' and pressing 'w', the  is 
selected, as confirmed by yanking and pasting and seeing 'myid' being 
pasted. This is not what the documentation says should happen, so I 
looking around for any mappings of w to something but as far as I can 
tell, no such mapping is available.

For the record, I'm using gvim 7 of may 7th, according to :version.
I've tried starting gvim without loading a vimrc, but I get the same 
behaviour. Anyone else seeing this? Am I picking up side effects from 
other settings somehow?



  On a related note, when I have 'myid' selected and I want
  to replace it with the contents of the yank buffer, I
  press 'p'. But the original contents of the yank buffer
  are then replaced my 'myid', i.e. the text that was
  replaced in the paste operation. How do I change this
  behaviour?
The best solution I know is to use
_p
For more info, you can read at
:help _
:help 0
:help v_p
Hope this helps you find a solution to what you're trying to
do.


Thanks, I'll investigate this, I think I can work something out from here.


cheers,

roel



Re: creating a new file in the Explorer

2006-07-28 Thread Roel Vanhout

A.J.Mechelynck wrote:
In the vim Explorer (:Explore), I can create a new directory by 
pressing 'd' and typing the directoryname. Is there something similar 
for creating a new, empty file? I've looked through the documentation 

:mapF2:cd %:p:h Bar newSpace
will allow you to open a new file in the currently browsed directory, 
or, if currently not browsing a directory, in the same directory as the 
current file. (Replace F2 by any other shortcut key you want to use.) 
The cursor ends up on the command line, ready for you to enter the 
filename. Hit Enter without a filename to open a [No Name] buffer; hit 
Esc to cancel.



This is great, thanks. Is there also a way to make this work only in the 
Explorer window/mode?



cheers,

roel