Re: File browsing in Vim

2006-06-22 Thread Aaron Griffin

On 6/21/06, Nick Lo [EMAIL PROTECTED] wrote:

Textmate, that I mentioned, also works on a Project basis and my only
qualms about that approach is that I'm often jumping between
projects ...eg I may open a file from one project to use in another
and so on.


That's what tabs are for!


Re: File browsing in Vim

2006-06-22 Thread Nick Lo
Ha yeah thanks Aaron, of course but I was kind of referring to the  
Textmate and jEdit approaches as I've not tried the project plugin.


True enough Vim has tabs now, unfortunately as I mentioned in  
previous posts I've been having a few small bugs with split windows  
in different tabs. Of course this may be a netrw issue that wouldn't  
apply to the the project plugin. Anyhow I'm having a go with the  
simpler :Ex when needed approach which I quite like.


Thanks,

Nick


On 6/21/06, Nick Lo [EMAIL PROTECTED] wrote:

Textmate, that I mentioned, also works on a Project basis and my only
qualms about that approach is that I'm often jumping between
projects ...eg I may open a file from one project to use in another
and so on.


That's what tabs are for!






Re: File browsing in Vim

2006-06-21 Thread Luc Hermitte
Hello,

* On Tue, Jun 20, 2006 at 07:43:19PM -0700, Suresh Govindachar [EMAIL 
PROTECTED] wrote:
 
 I can type :find  (with space) and hit tab to see the list of files
 in the present directory.  If I know there is an 'o' in the file's
 name, I can type :find *o* and hit tab to see all files (in some
 search path that includes the present directory) with 'o' in their
 name;  etc.  Sorry I can't give you the specific details to set things
 up this way.

Setting 'path' should be enough. 'wildignore' does also have some
interesting impacts. And there is also an option, which I don't remember
the name, that automatically appends the file extension when not
specified.

Lately, I've enhanced my plugin SearchInRuntime, (#229 on SF IIRC) to
define some new commands that, like :find, search for files in 'path',
and also:
- ask us which file to open (if several match)
- (v)split-open in a new windows the file chosen.


Now, I set my 'path' on a projects basis. And quite exclusively use
SearchInRuntime and a.vim to search and open my projects files.


-- 
Luc Hermitte
http://hermitte.free.fr/vim/


Re: File browsing in Vim

2006-06-21 Thread Bram Moolenaar

Nick Lo wrote:

 Also, after playing with the new tabs I found a bug where the 4  
 window split would disappear if I opened a few tabs and came back to  
 the 4 windowed one. This was in fact the point where I asked ...well  
 do I actually NEED the static file browser.

Do you have a reproducable example for the disappearing windows?

-- 
If R is Reverse, how come D is FORWARD?

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: File browsing in Vim

2006-06-21 Thread Eric Arnold

To further stretch the use of the Ex prompt for this, try CD_Plus.vim.

On 6/20/06, Nick Lo [EMAIL PROTECTED] wrote:

Thanks Matt,

I did have the feeling that I could bend Vim to my old ways, but this
revelation was more about realising that I wasn't using features that
make Vim different from other editors. I like the fact that it's now
simpler both in terms of visual clutter and use.

Also, after playing with the new tabs I found a bug where the 4
window split would disappear if I opened a few tabs and came back to
the 4 windowed one. This was in fact the point where I asked ...well
do I actually NEED the static file browser.

Cheers,

Nick


 Nick,

 The article is good and illustrates a good point. However, I would
 like
 to point out that what you were origionally trying to do is very
 possible.

 The simplest way (and there are probably others) is to make a simple
 mapping that does all the stuff you describe (jump to the correct
 window, jump back to the file explorer pane, and then hit P). You
 could bind something like Alt-p (m-p) to do all that. This way you
 would never have to worry about the file being opened in the wrong
 window, because it's your own logic that decides the target window.

 --Matt

 On Wed, Jun 21, 2006 at 11:17:20AM +1000, Nick Lo wrote:
 After spending a frustrating evening that stretched into the night, I
 had one of those moments of revelation that I have a feeling all Vim
 users get now and again.

 In this case it was breaking from my previous text editor way of
 thinking to suddenly get the vim way of file browsing. Hardened Vim
 users will not see it as anything new as it's really about the
 using :Ex while editing rather than assigning specific windows the
 role of file browser.

 Anyway, since it really needed an image or two, I wrote it up here...

 http://www.ingredients.com.au/nick/2006/06/21/file-browsing-in-vim/

 I hope that it will help others in the same boat.

 Comments welcome,

 Nick






Re: File browsing in Vim

2006-06-21 Thread Nick Lo

Hi Bram,

Yes it's reproducible:

I'm using the OS X Universal binary...

http://macvim.org/OSX/files/binaries/OSX10.4/Vim7.0-univ.tar.bz2

...from...

http://macvim.org/OSX/index.php

and have upgraded netrw to v100. It's files reside in my .vim  
directory while the OS X package still has the ones it came with.


- Open a horizontally split window with netrw in one and a file in  
the other

- :tabnew
- Drag and drop a file from the finder into the new tab  
window ...or... Drag and drop onto the Vim icon
- Go back to the first tab and the netrw split will have closed  
leaving just the file window


Note if you open a file via Vim (:e :Ex etc) in the new tab window  
and go back to the first tab the netrw window will still be there so  
this bug seems specific to drag and drop actions.


Nick



Nick Lo wrote:


Also, after playing with the new tabs I found a bug where the 4
window split would disappear if I opened a few tabs and came back to
the 4 windowed one. This was in fact the point where I asked ...well
do I actually NEED the static file browser.


Do you have a reproducable example for the disappearing windows?

--
If R is Reverse, how come D is FORWARD?

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http:// 
www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/ 
sponsor/ \\\
\\\download, build and distribute -- http://www.A-A- 
P.org///
 \\\help me help AIDS victims -- http://ICCF- 
Holland.org///







Re: File browsing in Vim

2006-06-21 Thread Bram Moolenaar

Nick Lo wrote:

 Actually on a bit more exploration it also seems that if you:
 
 - Open that split file/netrw window
 - :tabnew with a new file in
 - Go to another OS X application
 - Return to Vim
 - Click the the split window and again the netrw window will have  
 disappeared
 
 If you just leave the split window alone open and return to Vim from  
 another app the window flickers/refreshes momentarily.
 
 Nick
 
  Hi Bram,
 
  Yes it's reproducible:
 
  I'm using the OS X Universal binary...
 
  http://macvim.org/OSX/files/binaries/OSX10.4/Vim7.0-univ.tar.bz2
 
  ...from...
 
  http://macvim.org/OSX/index.php
 
  and have upgraded netrw to v100. It's files reside in my .vim  
  directory while the OS X package still has the ones it came with.
 
  - Open a horizontally split window with netrw in one and a file in  
  the other
  - :tabnew
  - Drag and drop a file from the finder into the new tab  
  window ...or... Drag and drop onto the Vim icon
  - Go back to the first tab and the netrw split will have closed  
  leaving just the file window
 
  Note if you open a file via Vim (:e :Ex etc) in the new tab window  
  and go back to the first tab the netrw window will still be there  
  so this bug seems specific to drag and drop actions.

I can reproduce it.  Very strange.  I'll add a remark to the todo list
and look into it later.

-- 
An indication you must be a manager:
You feel sorry for Dilbert's boss.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: File browsing in Vim

2006-06-21 Thread Nick Lo

Hi Chip,

Via the GUI  menu Netrw  Settings/Options I see I do have:

let g:netrw_fastbrowse = 0

I tried setting it to 1 (not knowing what it should be set otherwise  
be set to) and no change in the flicker.


As I mentioned I do have v100 installed in .vim over whatever was  
built into the package from macvim.org


Nick



Nick Lo wrote:

And further to that: This does not happen in the non-gui/terminal   
version of Vim 7 I installed last night.


Nick


Actually on a bit more exploration it also seems that if you:

- Open that split file/netrw window
- :tabnew with a new file in
- Go to another OS X application
- Return to Vim
- Click the the split window and again the netrw window will  
have  disappeared


If you just leave the split window alone open and return to Vim   
from another app the window flickers/refreshes momentarily.



With Fedora Core 5, I didn't see anything untoward.
The window flicker/refresh could be due to a g:netrw_fastbrowse=0  
-- what is yours set to?


Regards,
Chip Campbell







Re: File browsing in Vim

2006-06-21 Thread Nick Lo

Hi Tom,

I know you're probably sick of suggestions by now, but I have also  
spent

a lot of time in the same boat as you.


No, no, not sick of suggestions at all, getting suggestions was part  
of the reason I posted.



In the end, I determined that
the built-in file browser for vim (even in vim 7) doesn't work very  
well

as a file browser window like you displayed in your blog.

For me, a very good solution to your needs it the Project plugin:

http://www.vim.org/scripts/script.php?script_id=69

There's a slight learning curve to use it, but it has the following
advantages:

* You don't have to type some funky command to open a file in the  
edit

window.  You just move your cursor over the file name and hit return.
* You can explicitly specify the pwd of a list of files, even if those
files are in different directories.  This can be very useful.
* You can define which files are present in the Project window in an
arbitrary way.
* This basically gives you a project-based view of your files, similar
to what you would see in an IDE like Eclipse.
* Just trust me when I say that it's a terribly useful and robust  
plugin

enables you to do exactly what you want :)

If you would like to see a screenshot of what my setup looks like,  
then

check out the following:

* http://static.flickr.com/61/171982939_c636495ffc.jpg?v=0

Good luck, and have fun learning about what you can do with Vim


Thanks for that run through. I had looked at it on vim.org and I used  
to work with something similar in jEdit. For now I'm going to try out  
the method of using :Ex (and :find now thanks to Suresh) where needed  
and see how I go with that.


Textmate, that I mentioned, also works on a Project basis and my only  
qualms about that approach is that I'm often jumping between  
projects ...eg I may open a file from one project to use in another  
and so on.


Nick


Re: File browsing in Vim

2006-06-20 Thread Nick Lo

Thanks Matt,

I did have the feeling that I could bend Vim to my old ways, but this  
revelation was more about realising that I wasn't using features that  
make Vim different from other editors. I like the fact that it's now  
simpler both in terms of visual clutter and use.


Also, after playing with the new tabs I found a bug where the 4  
window split would disappear if I opened a few tabs and came back to  
the 4 windowed one. This was in fact the point where I asked ...well  
do I actually NEED the static file browser.


Cheers,

Nick



Nick,

The article is good and illustrates a good point. However, I would  
like

to point out that what you were origionally trying to do is very
possible.

The simplest way (and there are probably others) is to make a simple
mapping that does all the stuff you describe (jump to the correct
window, jump back to the file explorer pane, and then hit P). You
could bind something like Alt-p (m-p) to do all that. This way you
would never have to worry about the file being opened in the wrong
window, because it's your own logic that decides the target window.

--Matt

On Wed, Jun 21, 2006 at 11:17:20AM +1000, Nick Lo wrote:

After spending a frustrating evening that stretched into the night, I
had one of those moments of revelation that I have a feeling all Vim
users get now and again.

In this case it was breaking from my previous text editor way of
thinking to suddenly get the vim way of file browsing. Hardened Vim
users will not see it as anything new as it's really about the
using :Ex while editing rather than assigning specific windows the
role of file browser.

Anyway, since it really needed an image or two, I wrote it up here...

http://www.ingredients.com.au/nick/2006/06/21/file-browsing-in-vim/

I hope that it will help others in the same boat.

Comments welcome,

Nick







RE: File browsing in Vim

2006-06-20 Thread Suresh Govindachar


If your main use of Ex is to find a file to open, there are more direct ways to 
do so.  I don't recall all the options I have set,
but I can type :find  (with space) and hit tab to see the list of files in 
the present directory.  If I know there is an 'o' in
the file's name, I can type :find *o* and hit tab to see all files (in some 
search path that includes the present directory) with
'o' in their name;  etc.  Sorry I can't give you the specific details to set 
things up this way.

--Suresh  
 

-Original Message-
From: Nick Lo [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 20, 2006 7:13 PM
To: vim@vim.org
Subject: Re: File browsing in Vim

Thanks Matt,

I did have the feeling that I could bend Vim to my old ways, but this  
revelation was more about realising that I wasn't using features that  
make Vim different from other editors. I like the fact that it's now  
simpler both in terms of visual clutter and use.

Also, after playing with the new tabs I found a bug where the 4  
window split would disappear if I opened a few tabs and came back to  
the 4 windowed one. This was in fact the point where I asked ...well  
do I actually NEED the static file browser.

Cheers,

Nick


 Nick,

 The article is good and illustrates a good point. However, I would  
 like
 to point out that what you were origionally trying to do is very
 possible.

 The simplest way (and there are probably others) is to make a simple
 mapping that does all the stuff you describe (jump to the correct
 window, jump back to the file explorer pane, and then hit P). You
 could bind something like Alt-p (m-p) to do all that. This way you
 would never have to worry about the file being opened in the wrong
 window, because it's your own logic that decides the target window.

 --Matt

 On Wed, Jun 21, 2006 at 11:17:20AM +1000, Nick Lo wrote:
 After spending a frustrating evening that stretched into the night, I
 had one of those moments of revelation that I have a feeling all Vim
 users get now and again.

 In this case it was breaking from my previous text editor way of
 thinking to suddenly get the vim way of file browsing. Hardened Vim
 users will not see it as anything new as it's really about the
 using :Ex while editing rather than assigning specific windows the
 role of file browser.

 Anyway, since it really needed an image or two, I wrote it up here...

 http://www.ingredients.com.au/nick/2006/06/21/file-browsing-in-vim/

 I hope that it will help others in the same boat.

 Comments welcome,

 Nick





Re: File browsing in Vim

2006-06-20 Thread Nick Lo

Ah yes, thanks Suresh, it works for me too, very useful.

Nick




If your main use of Ex is to find a file to open, there are more  
direct ways to do so.  I don't recall all the options I have set,
but I can type :find  (with space) and hit tab to see the list of  
files in the present directory.  If I know there is an 'o' in
the file's name, I can type :find *o* and hit tab to see all  
files (in some search path that includes the present directory) with
'o' in their name;  etc.  Sorry I can't give you the specific  
details to set things up this way.


--Suresh


-Original Message-
From: Nick Lo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 20, 2006 7:13 PM
To: vim@vim.org
Subject: Re: File browsing in Vim

Thanks Matt,

I did have the feeling that I could bend Vim to my old ways, but this
revelation was more about realising that I wasn't using features that
make Vim different from other editors. I like the fact that it's now
simpler both in terms of visual clutter and use.

Also, after playing with the new tabs I found a bug where the 4
window split would disappear if I opened a few tabs and came back to
the 4 windowed one. This was in fact the point where I asked ...well
do I actually NEED the static file browser.

Cheers,

Nick



Nick,

The article is good and illustrates a good point. However, I would
like
to point out that what you were origionally trying to do is very
possible.

The simplest way (and there are probably others) is to make a simple
mapping that does all the stuff you describe (jump to the correct
window, jump back to the file explorer pane, and then hit P). You
could bind something like Alt-p (m-p) to do all that. This way you
would never have to worry about the file being opened in the wrong
window, because it's your own logic that decides the target window.

--Matt

On Wed, Jun 21, 2006 at 11:17:20AM +1000, Nick Lo wrote:
After spending a frustrating evening that stretched into the  
night, I

had one of those moments of revelation that I have a feeling all Vim
users get now and again.

In this case it was breaking from my previous text editor way of
thinking to suddenly get the vim way of file browsing. Hardened  
Vim

users will not see it as anything new as it's really about the
using :Ex while editing rather than assigning specific windows the
role of file browser.

Anyway, since it really needed an image or two, I wrote it up  
here...


http://www.ingredients.com.au/nick/2006/06/21/file-browsing-in-vim/

I hope that it will help others in the same boat.

Comments welcome,

Nick