RE: Search all text files in a directory for text

2006-11-07 Thread Chuck Mason
Sorry to bring this up again.  Was there every any solution to this?  Do
I just need the latest netrw?  I was trying to get :Explore **/pattern
working
But as I do see the Match n of N in the lower right, the cursor never
moves in the browse buffer (with S-Down/S-Up) and occasionally I get
errors:

Error detected while processing function netrw#Explore:
line 165:
E121: Undefined variable: w:netrw_longlist
E15: Invalid expression: w:netrw_longlist == 0 || w:netrw_longlist == 1

I'm using vim7.0 (2006 may 7), and tried this with -N -u NONE.  Maybe
someone here knows how to get this working?  



-Original Message-
From: Gary Johnson [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 28, 2006 1:14 PM
To: vim@vim.org
Subject: Re: Search all text files in a directory for text

FWIW, I just tried this on Windows using vim-7.0 without patches, 
downloaded from vim.sf.net, and netrw 103g.  I started vim from the 
Command Prompt in a directory that contained one Python file and a 
number of subdirectories, each containing several Python files.

vim -N -u NONE -i NONE

:runtime plugin/netrwPlugin.vim
:Explore **/*.py
Error detected while processing function netrw#Explore:
line 178:
E63: invalid use of \_

the buffer was empty and the status line contained Match 1 of 222.

Regards,
Gary

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


Re: Search all text files in a directory for text

2006-11-07 Thread Charles E Campbell Jr

Chuck Mason wrote:


Sorry to bring this up again.  Was there every any solution to this?  Do
I just need the latest netrw?  I was trying to get :Explore **/pattern
working
But as I do see the Match n of N in the lower right, the cursor never
moves in the browse buffer (with S-Down/S-Up) and occasionally I get
errors:

Error detected while processing function netrw#Explore:
line 165:
E121: Undefined variable: w:netrw_longlist
E15: Invalid expression: w:netrw_longlist == 0 || w:netrw_longlist == 1

I'm using vim7.0 (2006 may 7), and tried this with -N -u NONE.  Maybe
someone here knows how to get this working?  
 



netrw is up to v107g (Nov 03, 2006).

I suggest upgrading!

You'll also need an up-to-date version of vimball to extract netrw, 
which is also available at:


http://vim.sourceforge.net/scripts/script.php?script_id=1502
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
see Vimball Archiver

Also, to make these new plugins work, you first need to completely remove
all older vestiges of netrw and vimball from your runtimepath.  Under Linux,
that usually means

   cd /usr/local/share/vim/vim70
   /bin/rm plugin/netrw*.vim   plugin/vimball*.vim
   /bin/rm autolaod/netrw*.vim autoload/vimball*.vim

Under Windows, check your runtimepath to determine where your vim 7.0's
runtime directories are:

   vim
   :echo rtp
   :q

should give you a clue.

Regards,
Chip Campbell




Re: Search all text files in a directory for text

2006-11-07 Thread Gary Johnson
On 2006-11-07, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 Chuck Mason wrote:
 
  Sorry to bring this up again.  Was there every any solution to this?  Do
  I just need the latest netrw?  I was trying to get :Explore **/pattern
  working
  But as I do see the Match n of N in the lower right, the cursor never
  moves in the browse buffer (with S-Down/S-Up) and occasionally I get
  errors:
 
  Error detected while processing function netrw#Explore:
  line 165:
  E121: Undefined variable: w:netrw_longlist
  E15: Invalid expression: w:netrw_longlist == 0 || w:netrw_longlist == 1
 
  I'm using vim7.0 (2006 may 7), and tried this with -N -u NONE.  Maybe
  someone here knows how to get this working?  
   
 
 
 netrw is up to v107g (Nov 03, 2006).
 
 I suggest upgrading!

I just updated to vim 7.0.161 from the Cream site and to netrw 107g 
from your (Chip's) web site.  I don't know how to get anything more 
up-to-date than that.  I renamed all the *netrw* files under vim70 
with a .orig extension to hide them.  I had already downloaded a 
recent vimball.vim, which is version 18a.  Repeating my experiment,

vim -N -u NONE -i NONE
:runtime plugin/netrwPlugin.vim
:Explore **/*.py

from a Command Prompt in a directory with no .py files below it, 
yields

Match 1 of 0

in the status line and the following messages:

***netrw***  no more files match Explore pattern
Error detected while processing function netrw#Explore:
line  192:
E684: list index out of range: 0
E15: Invalid expression: w:netrw_explore_list[0]
line  194:
E121: Undefined variable: dirfile
E116: Invalid arguments for function substitute(dirfile,'/[^/]*$','','e')
E15: Invalid expression: substitute(dirfile,'/[^/]*$','','e')
line  198:
E121: Undefined variable: newdir
E116: Invalid arguments for function netrw#LocalBrowseCheck
line  203:
E121: Undefined variable: dirfile
E116: Invalid arguments for function 
substitute(dirfile,^.*/,,).'\',W)
E116: Invalid arguments for function search

Then I exited vim, cd'd to a directory with a bunch of .py files
under it and repeated the commands above.  This time there were no
error messages and the status line said Match 1 of 394.  However,
the status line also showed a buffer name of [No Name] and the
buffer itself was empty.

HTH,
Gary

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


Re: Search all text files in a directory for text

2006-08-24 Thread Charles E Campbell Jr

Gary Johnson wrote:


On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 


Gary Johnson wrote:

   

Thanks.  That removes the error and gives me a list of files, but 
included in that list are non-*.c names such as


  INSTALL
  Makefile
  README.txt


 

:Explore **/*.c  doesn't give a list of just *.c files.  Instead, it 
opens a browser listing of every directory
with *.c files in it.  The cursor will be on the first such .c file; you 
may edit it if you wish.
If its not the one you want, shift-down will move the cursor to the 
next .c file, repeat at will.
One may go back with shiftup .  Directory displays will change as 
necessary.
   



OH!  Got it.

I found another problem, though.  Following my previous example and 
proceeding from


   $ vim -N -u NONE

I execute the following commands and the cursor moves to the file 
indicated.


   +-+-+
   | Command | Resulting   |
   | | Cursor Location |
   +=+=+
   | :Explore **/*.c | arabic.c|
   | | |
   | :Nexplore   | auto/pathdef.c  |
   | :Nexplore   | buffer.c|
   | :Nexplore   | charset.c   |
   | :Nexplore   | diff.c  |
   | | |
   | :Pexplore   | diff.c  |
   | :Pexplore   | diff.c  |
   | :Pexplore   | auto/pathdef.c  |
   | :Pexplore   | arabic.c|
   +-+-+

So there seems to be a pointer traversing an internal list of 
files that is moved by the :Nexplore and :Pexplore commands.  The 
:Nexplore and :Pexplore commands both control this pointer 
correctly, but only the :Nexplore command updates the cursor 
location correctly, unless the directory is changed.
 

I'm seeing the cursor move to the next/previous matching file for both 
:Nexplore and :Pexplore.
I do see one odd behavior, however:  :Nex doesn't move the cursor, 
instead a vim error gets
issued: E163: There is only one file to edit.  :Nexp (and longer) 
works.  There are two commands
that also begin with :Ne... (:NetUserPass and :NetrwSettings) which I 
assume are causing this

behavior.  Perhaps its a vim bug?

Regards,
Chip Campbell



Re: Search all text files in a directory for text

2006-08-24 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Gary Johnson wrote:


On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 


Gary Johnson wrote:

  
Thanks.  That removes the error and gives me a list of files, but 
included in that list are non-*.c names such as


  INSTALL
  Makefile
  README.txt



:Explore **/*.c  doesn't give a list of just *.c files.  Instead, it 
opens a browser listing of every directory
with *.c files in it.  The cursor will be on the first such .c file; 
you may edit it if you wish.
If its not the one you want, shift-down will move the cursor to the 
next .c file, repeat at will.
One may go back with shiftup .  Directory displays will change as 
necessary.
  


OH!  Got it.

I found another problem, though.  Following my previous example and 
proceeding from


   $ vim -N -u NONE

I execute the following commands and the cursor moves to the file 
indicated.


   +-+-+
   | Command | Resulting   |
   | | Cursor Location |
   +=+=+
   | :Explore **/*.c | arabic.c|
   | | |
   | :Nexplore   | auto/pathdef.c  |
   | :Nexplore   | buffer.c|
   | :Nexplore   | charset.c   |
   | :Nexplore   | diff.c  |
   | | |
   | :Pexplore   | diff.c  |
   | :Pexplore   | diff.c  |
   | :Pexplore   | auto/pathdef.c  |
   | :Pexplore   | arabic.c|
   +-+-+

So there seems to be a pointer traversing an internal list of files 
that is moved by the :Nexplore and :Pexplore commands.  The :Nexplore 
and :Pexplore commands both control this pointer correctly, but only 
the :Nexplore command updates the cursor location correctly, unless 
the directory is changed.
 

I'm seeing the cursor move to the next/previous matching file for both 
:Nexplore and :Pexplore.
I do see one odd behavior, however:  :Nex doesn't move the cursor, 
instead a vim error gets
issued: E163: There is only one file to edit.  :Nexp (and longer) 
works.  There are two commands
that also begin with :Ne... (:NetUserPass and :NetrwSettings) which I 
assume are causing this

behavior.  Perhaps its a vim bug?

Regards,
Chip Campbell





It's not a bug, it's a feature: :N[ext] is a predefined Vim-command, 
synonymous with :prev[ious]. It opens in the current window the previous 
file from the argument list.



Best regards,
Tony.


Re: Search all text files in a directory for text

2006-08-24 Thread Gary Johnson
On 2006-08-24, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 Gary Johnson wrote:

  I found another problem, though.  Following my previous example and 
  proceeding from
 
 $ vim -N -u NONE
 
  I execute the following commands and the cursor moves to the file 
  indicated.
 
 +-+-+
 | Command | Resulting   |
 | | Cursor Location |
 +=+=+
 | :Explore **/*.c | arabic.c|
 | | |
 | :Nexplore   | auto/pathdef.c  |
 | :Nexplore   | buffer.c|
 | :Nexplore   | charset.c   |
 | :Nexplore   | diff.c  |
 | | |
 | :Pexplore   | diff.c  |
 | :Pexplore   | diff.c  |
 | :Pexplore   | auto/pathdef.c  |
 | :Pexplore   | arabic.c|
 +-+-+
 
  So there seems to be a pointer traversing an internal list of 
  files that is moved by the :Nexplore and :Pexplore commands.  The 
  :Nexplore and :Pexplore commands both control this pointer 
  correctly, but only the :Nexplore command updates the cursor 
  location correctly, unless the directory is changed.
   
 
 I'm seeing the cursor move to the next/previous matching file for both 
 :Nexplore and :Pexplore.

That's really weird.  I see the same broken :Pexplore behavior with 
both my SunOS and Linux versions.  Maybe the problem has been fixed
with a patch.

--
VIM - Vi IMproved 7.0 (2006 May 7, compiled May  8 2006 16:40:23)
Compiled by [EMAIL PROTECTED]
Normal version with GTK 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_gui +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 +reltime -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
  system gvimrc file: $VIM/gvimrc
user gvimrc file: $HOME/.gvimrc
system menu file: $VIMRUNTIME/menu.vim
  fall-back for $VIM: /home/garyjohn/src/SunOS/vim-7.0/share/vim
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  
-I/opt/TWWfsw/gtk+12/include/gtk-1.2 -I/opt/TWWfsw/glib12/include/glib-1.2 
-I/opt/TWWfsw/glib12/lib/glib/include -I/usr/openwin/include 
-I/home/garyjohn/src/SunOS/ncurses-5.4/include/ncurses  -g -O2  
-I/usr/openwin/include   
Linking: gcc  -L/usr/openwin/lib -R/usr/openwin/lib   
-L/home/garyjohn/src/SunOS/ncurses-5.4/lib -o vim   -L/opt/TWWfsw/gtk+12/lib 
-R/opt/TWWfsw/gtk+12/lib -L/usr/openwin/lib -R/usr/openwin/lib -lgtk -lgdk 
-L/opt/TWWfsw/glib12/lib -R/opt/TWWfsw/glib12/lib -lgmodule -lglib -lXext -lm 
-lXt -lX11 -lSM -lICE -lnsl -lsocket  -lncurses -ldl
--

s I do see one odd behavior, however:  :Nex doesn't move the cursor, 
 instead a vim error gets
 issued: E163: There is only one file to edit.  :Nexp (and longer) 
 works.  There are two commands
 that also begin with :Ne... (:NetUserPass and :NetrwSettings) which I 
 assume are causing this
 behavior.  Perhaps its a vim bug?

I've been spelling them out in full just to be sure.

Regards,
Gary

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


Re: Search all text files in a directory for text

2006-08-24 Thread A.J.Mechelynck

Gary Johnson wrote:
[...]
That's really weird.  I see the same broken :Pexplore behavior with 
both my SunOS and Linux versions.  Maybe the problem has been fixed

with a patch.

--
VIM - Vi IMproved 7.0 (2006 May 7, compiled May  8 2006 16:40:23)
Compiled by [EMAIL PROTECTED]
Normal version with GTK GUI.  Features included (+) or not (-):

[...]

That's 7.0.000

There are 66 official bugfixes so far:

  SIZE  NAME FIXES
  1627  7.0.001  'spellsuggest' could not be added to
  2007  7.0.002  C omni complete has problem with % and # in tags file path
  1876  7.0.003  GUI: click in tab pages label may warp mouse pointer
  1596  7.0.004  Compiler warning for debug_saved used before set
  1579  7.0.005  (extra) Win32: uninstall didn't delete spell and 
autoload dirs

  1347  7.0.006  Mac: make shadow didn't link infplist.xml
  1919  7.0.007  AIX: compiling failed for message.c
  2081  7.0.008  Can't call a function that uses both SID and {expr}
  1625  7.0.009  ml_get errors when 'spell' is set
  3705  7.0.010  spellfile plugin required typing login name and password
  1989  7.0.011  can't compile with eval feature without folding feature
  2532  7.0.012  matchparen plugin changed cursor column in Insert mode
  4614  7.0.013  Insert mode completion: CTRL-L jumped back to original 
text

  5712  7.0.014  Motif: doesn't compile with Motif 1.2 and earlier
  4485  7.0.015  Athena: type casts for lvalues
  1810  7.0.016  recognize encodings mac-roman, dec-mcs and hp-roman8
  2302  7.0.017  (after 7.0.014) Motif: doesn't link with Motif 1.2 and 
earlier

  1649  7.0.018  VMS: plugins are not loaded on startup
  1425  7.0.019  crash for VjA789 and repeating
  1470  7.0.020  GUI: crash when using 'mousefocus'
  4240  7.0.021  crash when using \\[ and \\] in 'errorformat
  5471  7.0.022  Ruby: buffer.append() could append to the wrong buffer
  5351  7.0.023  crash after Insert mode completion without matches
  1619  7.0.024  it is possible to set arbitrary v: variables
  2606  7.0.025  crash when deleting an item from a:000
  1800  7.0.026  Unix: when using libcall() and old error may be shown
  1344  7.0.027  (extra) Win32: hang on exit when compiled with SNiFF+
  3014  7.0.028  (extra) OS/2: compilation problem
  1494  7.0.029  cursor position may be wrong when using getchar()
  1664  7.0.030  the :compiler command can't be used in a 
FileChangedRO event

  1808  7.0.031  after deleting a buffer its Select mode mappings remain
  1424  7.0.032  (extra, after 7.0.027) missing semicolon
  2431  7.0.033  pasting after autoindent removes the indent
  2042  7.0.034  repeating completion was wrong after typing text or 
using BS

  5905  7.0.035  repeating Insert mode completion doesn't work properly
  3990  7.0.036  can't compile with small features and syntax HL
  1880  7.0.037  crash when resizing Vim window when a line doesn't fit
  3236  7.0.038  complete() can be used from expr. mapping after 
inserting text
  3240  7.0.039  third argument for inputdialog() doesn't work in the 
console

  1946  7.0.040  mouse selection with z= and inputlist() gets wrong entry
  2229  7.0.041  cursor([1, 2]) failed, required third item in the list
  1603  7.0.042  crash or hang when pasting a block in Insert mode
  1534  7.0.043  %! at start of 'statusline' didn't work
  5277  7.0.044  Perl: changing a line in a non-current buffer may not work
  1741  7.0.045  (extra) Win32: MSVC 2005 compiler warnings for OLE version
  2318  7.0.046  the matchparen plugin didn't handle parens in single 
quotes

  2219  7.0.047  the exit status of the configure script can be wrong
  2173  7.0.048  the gzip plugin can't handle file names that have a paren
  2221  7.0.049  some Tcl scripts are not recognized
  1437  7.0.050  can't properly close a buffer through the NetBeans 
interface
  6097  7.0.051  (after 7.0.44) compile and/or run problem with Perl 
interface

  2237  7.0.052  the Vim server may expose more functionality than expected
  1379  7.0.053  shortening multi-byte directory name may fail
  2464  7.0.054  using an empty menu name may cause a crash
  2204  7.0.055  :startins in CmdwinEnter autocmd doesn't work 
immediately

  1484  7.0.056  can't use #! in Vim scripts to make them executable
  1779  7.0.057  (extra, after 7.0.45) compilation trouble with Borland 
C 5.5

  1423  7.0.058  gbk and gb18030 encodings are not recognized
  2110  7.0.059  Perl interface doesn't compile with ActiveState Perl 5.8.8
 18082  7.0.060  code for switching buffers is repeated in several places
  2249  7.0.061  crash in Vim command completion when nothing to complete
  4075  7.0.062  Mac: crash when using popup menu with spell error
  1295  7.0.063  tiny chance for a memory leak
  1818  7.0.064  compiler warnings for unused variables
  1750  7.0.065  (extra) Mac: horizontal scroll wheel caused vertical 
scroll

  1407  7.0.066  tab pages line not redrawn after removing the popup menu




Best regards,
Tony.


Re: Search all text files in a directory for text

2006-08-22 Thread Charles E Campbell Jr

Bram Moolenaar wrote:


Charles E Campbell wrote:

 


Sigh -- I'm not sure what to do about this one.  Turns out that:

 com! ... -complete=dir Explore ...

causes the E77 with Too many file names.  Simply removing the 
-complete=dir

from the command fixes things.
   



You have  -nargs=?  which means only 0 or 1 arguments are allowed.
Perhaps you want to use  -nargs=* .

 

Yes -- that works!  I don't mind having Explore ignore any extra 
strings.  Who knows, maybe I'll find a use for it...


Regards,
Chip Campbell



Re: Search all text files in a directory for text

2006-08-22 Thread Bram Moolenaar

Charles E Campbell wrote:

 Sigh -- I'm not sure what to do about this one.  Turns out that:
 
   com! ... -complete=dir Explore ...
 
 causes the E77 with Too many file names.  Simply removing the 
 -complete=dir
 from the command fixes things.

You have  -nargs=?  which means only 0 or 1 arguments are allowed.
Perhaps you want to use  -nargs=* .

-- 
Press any key to continue, press any other key to quit.

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


Search all text files in a directory for text

2006-08-18 Thread Jerin Joy

Hi,

I have a lot of source code distributed over a directory hierarchy
structure. I always need to find class declarations, instances where
variables are set etc. Usually I just go to command line and run
something like
find . -name *.vr -print | xargs grep 'class foo'

Isn't there an easier way to do this in vim? I can't use cscope since
the source is not in C.

Jerin


--
http://jerinj.blogspot.com/
--


Re: Search all text files in a directory for text

2006-08-18 Thread Marius Roets

On 8/18/06, Jerin Joy [EMAIL PROTECTED] wrote:

Hi,

I have a lot of source code distributed over a directory hierarchy
structure. I always need to find class declarations, instances where
variables are set etc. Usually I just go to command line and run
something like
find . -name *.vr -print | xargs grep 'class foo'

Isn't there an easier way to do this in vim? I can't use cscope since
the source is not in C.

Jerin


--
http://jerinj.blogspot.com/
--



Exuberant ctags supports 33 languages. Maybe yours is one of them:

http://ctags.sourceforge.net/

Marius


Re: Search all text files in a directory for text

2006-08-18 Thread A.J.Mechelynck

Jerin Joy wrote:

Hi,

I have a lot of source code distributed over a directory hierarchy
structure. I always need to find class declarations, instances where
variables are set etc. Usually I just go to command line and run
something like
find . -name *.vr -print | xargs grep 'class foo'

Isn't there an easier way to do this in vim? I can't use cscope since
the source is not in C.

Jerin




:vimgrep /\class\_s\+foo\/ *.vr

which applies to Vim 7 only; in earlier versions of Vim you can use 
external grep though. The pattern between slashes is a Vim regular 
expression; I have arbitrarily put in \ (start of word), \ (end of 
word) and \_s\+ (one or more spaces, tabs and/or line breaks).


The results of vimgrep (or grep) end up in a quickfix error list and 
can be viewed using :cfirst, :cnext, :cprev, :clast, etc.


See
:help quickfix.txt
and in particular
:help :vimgrep
:help :grep
:help :cnext
etc.


Best regards,
Tony.


Re: Search all text files in a directory for text

2006-08-18 Thread A.J.Mechelynck

Jerin Joy wrote:

Hi,

I'll try the ctags. Both vera and verilog are supported. I'm running
vim 6.4 so no vimgrep. Can't change it since I work on a remote login.

thanks,
Jerin


You can still invoke grep from Vim 6.4 (since you have an external grep 
 program installed): see :help :grep. Tags may be faster if you use 
them repeatedly in the same directories, but you have to generate the 
tags file first using Exuberant ctags or similar.


Best regards,
Tony.



On 8/18/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Jerin Joy wrote:
 Hi,

 I have a lot of source code distributed over a directory hierarchy
 structure. I always need to find class declarations, instances where
 variables are set etc. Usually I just go to command line and run
 something like
 find . -name *.vr -print | xargs grep 'class foo'

 Isn't there an easier way to do this in vim? I can't use cscope since
 the source is not in C.

 Jerin



:vimgrep /\class\_s\+foo\/ *.vr

which applies to Vim 7 only; in earlier versions of Vim you can use
external grep though. The pattern between slashes is a Vim regular
expression; I have arbitrarily put in \ (start of word), \ (end of
word) and \_s\+ (one or more spaces, tabs and/or line breaks).

The results of vimgrep (or grep) end up in a quickfix error list and
can be viewed using :cfirst, :cnext, :cprev, :clast, etc.

See
:help quickfix.txt
and in particular
:help :vimgrep
:help :grep
:help :cnext
etc.


Best regards,
Tony.








Re: Search all text files in a directory for text

2006-08-18 Thread Gary Johnson
On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 Jerin Joy wrote:,
 
 
  I have a lot of source code distributed over a directory hierarchy
  structure. I always need to find class declarations, instances where
  variables are set etc. Usually I just go to command line and run
  something like
  find . -name *.vr -print | xargs grep 'class foo'
 
  Isn't there an easier way to do this in vim? I can't use cscope since
  the source is not in C.
 
 Read   :help netrw-starstarpat  :
 
   :Explore **//class foo
 
 for example.  You'll be presented with an netrw browser display in each 
 subdirectory
 with matching files and the cursor on the first file that matches.  Use 
 shift-up and shift-down
 to move the cursor to previous or subsequent files with matches.  Hit 
 the cr when your
 cursor is on an interesting file to select and edit it.

I've never used the netrw's :Explore command before, but seeing 
this, I read the help sections on pattern-searching and tried the 
example from *netrw-starstar*.  It doesn't seem to work.  I'm using 
Vim-7.0 and netrw v103 on SunOS 5.8.

$ cd /home/garyjohn/src/SunOS/vim-7.0/vim70/src
$ vim -N -u NONE
:runtime plugin/netrwPlugin.vim
:Explore **/*.c
E77: Too many file names

Gary

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


Re: Search all text files in a directory for text

2006-08-18 Thread Charles E Campbell Jr

Gary Johnson wrote:


On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 


Read   :help netrw-starstarpat  :

 :Explore **//class foo

for example.  You'll be presented with an netrw browser display in each 
subdirectory
with matching files and the cursor on the first file that matches.  Use 
shift-up and shift-down
to move the cursor to previous or subsequent files with matches.  Hit 
the cr when your

cursor is on an interesting file to select and edit it.
   



I've never used the netrw's :Explore command before, but seeing 
this, I read the help sections on pattern-searching and tried the 
example from *netrw-starstar*.  It doesn't seem to work.  I'm using 
Vim-7.0 and netrw v103 on SunOS 5.8.


   $ cd /home/garyjohn/src/SunOS/vim-7.0/vim70/src
   $ vim -N -u NONE
   :runtime plugin/netrwPlugin.vim
   :Explore **/*.c
   E77: Too many file names
 


Sigh -- I'm not sure what to do about this one.  Turns out that:

 com! ... -complete=dir Explore ...

causes the E77 with Too many file names.  Simply removing the 
-complete=dir

from the command fixes things.

Regards,
Chip Campbell



Re: Search all text files in a directory for text

2006-08-18 Thread Gary Johnson
On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 Gary Johnson wrote:
 
  On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
   
 
  Read   :help netrw-starstarpat  :
 
   :Explore **//class foo
 
  for example.  You'll be presented with an netrw browser display in each 
  subdirectory
  with matching files and the cursor on the first file that matches.  Use 
  shift-up and shift-down
  to move the cursor to previous or subsequent files with matches.  Hit 
  the cr when your
  cursor is on an interesting file to select and edit it.
 
 
 
  I've never used the netrw's :Explore command before, but seeing 
  this, I read the help sections on pattern-searching and tried the 
  example from *netrw-starstar*.  It doesn't seem to work.  I'm using 
  Vim-7.0 and netrw v103 on SunOS 5.8.
 
 $ cd /home/garyjohn/src/SunOS/vim-7.0/vim70/src
 $ vim -N -u NONE
 :runtime plugin/netrwPlugin.vim
 :Explore **/*.c
 E77: Too many file names
   
 
 Sigh -- I'm not sure what to do about this one.  Turns out that:
 
  com! ... -complete=dir Explore ...
 
 causes the E77 with Too many file names.  Simply removing the 
 -complete=dir
 from the command fixes things.

Thanks.  That removes the error and gives me a list of files, but 
included in that list are non-*.c names such as

INSTALL
Makefile
README.txt

Regards,
Gary

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


Re: Search all text files in a directory for text

2006-08-18 Thread Charles E Campbell Jr

Gary Johnson wrote:



Thanks.  That removes the error and gives me a list of files, but 
included in that list are non-*.c names such as


   INSTALL
   Makefile
   README.txt
 



:Explore **/*.c  doesn't give a list of just *.c files.  Instead, it 
opens a browser listing of every directory
with *.c files in it.  The cursor will be on the first such .c file; you 
may edit it if you wish.
If its not the one you want, shift-down will move the cursor to the 
next .c file, repeat at will.
One may go back with shiftup .  Directory displays will change as 
necessary.


Regards,
Chip Campbell



Re: Search all text files in a directory for text

2006-08-18 Thread Gary Johnson
On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote:
 Gary Johnson wrote:
 
 
  Thanks.  That removes the error and gives me a list of files, but 
  included in that list are non-*.c names such as
 
 INSTALL
 Makefile
 README.txt
   
 
 
 :Explore **/*.c  doesn't give a list of just *.c files.  Instead, it 
 opens a browser listing of every directory
 with *.c files in it.  The cursor will be on the first such .c file; you 
 may edit it if you wish.
 If its not the one you want, shift-down will move the cursor to the 
 next .c file, repeat at will.
 One may go back with shiftup .  Directory displays will change as 
 necessary.

OH!  Got it.

I found another problem, though.  Following my previous example and 
proceeding from

$ vim -N -u NONE

I execute the following commands and the cursor moves to the file 
indicated.

+-+-+
| Command | Resulting   |
| | Cursor Location |
+=+=+
| :Explore **/*.c | arabic.c|
| | |
| :Nexplore   | auto/pathdef.c  |
| :Nexplore   | buffer.c|
| :Nexplore   | charset.c   |
| :Nexplore   | diff.c  |
| | |
| :Pexplore   | diff.c  |
| :Pexplore   | diff.c  |
| :Pexplore   | auto/pathdef.c  |
| :Pexplore   | arabic.c|
+-+-+

So there seems to be a pointer traversing an internal list of 
files that is moved by the :Nexplore and :Pexplore commands.  The 
:Nexplore and :Pexplore commands both control this pointer 
correctly, but only the :Nexplore command updates the cursor 
location correctly, unless the directory is changed.

Regards,
Gary

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