sponsor Vim development Vim logo Vim Book Ad

Find in Files, feature like Notepad++ : "Find in Files and Directories" like Notepad++

 script karma  Rating 0/0, Downloaded by 657  Comments, bugs, improvements  Vim wiki

created by
Pinaki Sekhar Gupta
 
script type
utility
 
description
This script has been written to mimic the Notepad++ 's 'Find in Files' feature.
Keeping the simplicity in mind, this script is written to be simple.
The objective of this script is to eliminate the hassle of
searching through vimgrep to the new users and provide
a quick yet easy way to do this job.

Tested on Windows 7 64-bit (Gvim official 32-bit)
Tested on Linux (UBUNTU 13.10 Saucy) (Gvim from its repository)

*EXAMPLES*
Say you have to find something (e.g. printf) in a specified directory
(e.g. C:\CodeBlocks\TDM-GCC-64\x86_64-w64-mingw32\include ) in a bunch of
C header files (i.e.,    .h).

Select the item from Menu Bar -> Edit -> Find in Files.
An input box will appear, asking for term you are looking for.
Fill it up and press OK.

This time you will see a directory browser, navigate to the directory
in which you want to perform the search operation. Press Open.

Now another input box will ask you to submit the extension
(e.g.  .txt, .h, .c etc), if you are willing to look into the

-----------------------------------------------------------------------------------
   C header files                |       give             h
-----------------------------------------------------------------------------------
   C files                           |       give             c
-----------------------------------------------------------------------------------
   C++ files                       |       give        cpp  cxx C  whichever is
                                       |             most suitable to the situation.
-----------------------------------------------------------------------------------
   text files                        |       give             txt
-----------------------------------------------------------------------------------
   extension-less files         |       sorry, this plug-in currently
                                        |    does not work with extension-less files.
-----------------------------------------------------------------------------------
   Other type of files            |       give the extension only,
                                        |        but do not use any wild-card or dot.
-----------------------------------------------------------------------------------
Never write   .h   .txt   etc, the script will fail to work.
                                            It already does the job internally.
Always write   h    txt   this way.

*LIMITATIONS*
1 . Currently this script cannot search the directory recursively,
but in future an option will be there.
2 . Currently this script cannot search into the extension-less files.
3 . vimgrep is a slow process, please be patient while searching.

*INTERNAL*
The raw method of searching something within a bunch of similar file-type is
:vimgrep /the_term_u_r_looking_4/ Directory\*.extension
Like:
:vimgrep /printf/ C:\CodeBlocks\TDM-GCC-64\x86_64-w64-mingw32\include\*.h

This script internally does this.
 
install details
Extract the zip file and copy 'Find_in_Files.txt' and 'Find_in_Files.vim' to their respective directory.
E.g., on Windows 7 64-bit you can place 'Find_in_Files.vim' into "C:\Program Files (x86)\Vim\vim74\plugin" and 'Find_in_Files.txt' into "C:\Program Files (x86)\Vim\vim74\doc".
Then Press Shift+:
then, :helptags $VIMRUNTIME/doc

On linux you can put the files  'Find_in_Files.txt' and 'Find_in_Files.vim' to
/home/your_user_account_name/.vim/doc and /home/your_user_account_name/.vim/plugin
Open file manager (nautilus etc.) press Ctrl+L then write ~/.vim and hit Enter to find these directories.
After installing, do   :helptags $HOME/.vim/doc
Read the documentations.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
Find_in_Files.zip 0.0.01 2014-05-23 7.3 Pinaki Sekhar Gupta Initial upload
ip used for rating: 3.134.78.106

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github