Permalink
Browse files

Version 2.1: Initial upload

  • Loading branch information...
0 parents commit dfc735edadc40073ea28850f68bff0e0313148e2 @pebble8888 pebble8888 committed with Oct 27, 2012
53 README
@@ -0,0 +1,53 @@
+This is a mirror of http://www.vim.org/scripts/script.php?script_id=4295
+
+smartgrep
+=======
+Grep word in source file excluding comment for vim plugin.
+
+Support OS
+=======
+Unix, MacOS X, Windows
+
+Suport Language and Comment Type
+=======
+C, C++, Objective-C, C#(CSharp), Java Script /* */, //
+
+Usage (smartgrep.vim command)
+=======
+Define g:base_dir in your .vimrc file.
+ example:
+ let g:base_dir="/develop/"
+
+,g -> recursive word grep for c,h file exclude comment by mouse cursored word
+,h -> recursive word grep for h file exclude comment by mouse cursored word
+:Rn -> recursive word grep for c,h file include comment
+:Rh -> recursive word grep for h file exclude comment
+:R -> recursive word grep for c,h file exclude comment
+:Rno -> recursive grep for c,h file include comment
+:Rho -> recursive grep for h file exclude comment
+:Ro -> recursive grep for c,h file exclude comment
+:Rl -> recursive word grep for c,h file exclude comment in sys_dir_w
+:Rw -> recursive word grep for c,h file exclude comment in sys_dir_l
+
+Usage (smartgrep binary)
+=======
+$ cd {directory-you-want-to-grep}
+$ smartgrep
+Usage: smartgrep /h {word} : recursive grep for .h excluding comment
+ /b {word} : recursive grep for .cpp .c .mm .m .cs .js .h excluding comment
+ /n {word} : recursive grep for .cpp .c .mm .m .cs .js .h including comment
+ /hw {word} : recursive word grep for .h excluding comment
+ /bw {word} : recursive word grep for .cpp .c .mm .m .cs .js .h excluding comment
+ /nw {word} : recursive word grep for .cpp .c .mm .m .cs .js .h including comment
+
+INSTALL
+=======
+If you are Windows or Mac OS X user, read ./plugin/smartgrep.vim file.
+If you are Unix user, type 'make + [enter]' and read ./plugin/smartgrep.vim file.
+
+git hub repogitory
+=======
+https://github.com/pebble8888/smartgrep
+
+If you have any comment, please issue it in github;
+
@@ -0,0 +1,45 @@
+smartgrep
+=======
+Grep word in source file excluding comment for vim plugin.
+
+Support OS
+=======
+Unix, MacOS X, Windows
+
+Suport Language and Comment Type
+=======
+C, C++, Objective-C, C#(CSharp), Java Script /* */, //
+
+Usage (smartgrep.vim command)
+=======
+Define g:base_dir in your .vimrc file.
+ example:
+ let g:base_dir="/develop/"
+
+,g -> recursive word grep for c,h file exclude comment by mouse cursored word
+,h -> recursive word grep for h file exclude comment by mouse cursored word
+:Rn -> recursive word grep for c,h file include comment
+:Rh -> recursive word grep for h file exclude comment
+:R -> recursive word grep for c,h file exclude comment
+:Rno -> recursive grep for c,h file include comment
+:Rho -> recursive grep for h file exclude comment
+:Ro -> recursive grep for c,h file exclude comment
+:Rl -> recursive word grep for c,h file exclude comment in sys_dir_w
+:Rw -> recursive word grep for c,h file exclude comment in sys_dir_l
+
+Usage (smartgrep binary)
+=======
+$ cd {directory-you-want-to-grep}
+$ smartgrep
+Usage: smartgrep /h {word} : recursive grep for .h excluding comment
+ /b {word} : recursive grep for .cpp .c .mm .m .cs .js .h excluding comment
+ /n {word} : recursive grep for .cpp .c .mm .m .cs .js .h including comment
+ /hw {word} : recursive word grep for .h excluding comment
+ /bw {word} : recursive word grep for .cpp .c .mm .m .cs .js .h excluding comment
+ /nw {word} : recursive word grep for .cpp .c .mm .m .cs .js .h including comment
+
+INSTALL
+=======
+If you are Windows or Mac OS X user, read ./plugin/smartgrep.vim file.
+If you are Unix user, type 'make + [enter]' and read ./plugin/smartgrep.vim file.
+
@@ -0,0 +1,151 @@
+"
+" Filename : smartgrep.vim
+" Brief : This file is vim plugin
+" Function : grep source file excluding comment
+" Author : pebble8888@gmail.com 2009-2012 Copyright
+" History :
+" Ver1.0.0.0 2009-09-13 initial revision for grep excluding comment
+" Ver1.1.0.0 2009-09-27 add word grep function
+" Ver1.2.0.0 2010-01-23 care .hpp file extension
+" exclude hided directory begins dot(.)
+" Ver1.3.0.0 2010-01-30 add option designate .h and .cpp
+" Ver1.4.0.0 2010-03-20 add option include comment
+" delete option only .c file
+" Ver1.5.0.0 2010-08-11 add MAC version, add .m/.mm file
+" Ver1.6.0.0 2011-01-12 fix bug doesn't operate in capital letter extension
+" Ver1.7.0.0 2011-02-02 fix bug doesn't operate in option including comment
+" Ver1.7.1.0 2011-02-10 create pgrep.vim and fix up usage
+" Ver1.7.2.0 2011-02-10 fix bug in pgrep.vim
+" Ver1.7.3.0 2011-10-15 improve help and add makefile for Unix
+" Ver2.0.0.0 2012-10-18 rename pgrep -> smartgrep
+" Ver2.1.0.0 2012-10-19 cover .cs (CSharp), .js (Java Script)
+"
+" Cover OS
+" Windows/Unix
+"
+" Cover File Extention Cover Comment Type
+" C++ : *.c *.cpp *.cxx *.tli *.inc *.rc /* */, //
+" C++ heder : *.h *.hpp *.hxx *.tlh *.inl /* */, //
+" Objective-C : *.m *.mm /* */, //
+" CSharp : *.cs /* */, //
+" JavaScript : *.js /* */, //
+"
+" How To Install
+" Put smartgrep.exe or smartgrep in C:\windows\system32\ or pathed directory.
+" Put smartgrep.vim in vim plugin directory
+" example:
+" C:\vim7\runtime\plugin\ (for windows)
+" ~/.vim/plugin/ (for Unix)
+"
+" Define g:base_dir in your .vimrc file.
+" example:
+" let g:base_dir="c:\\develop" (for windows)
+" let g:base_dir="/develop/" (for Unix)
+"
+" If you use MacVim, add smartgrep path to .vimrc file.
+" example:
+" let $PATH .= ':~/bin'
+"
+" Optional
+" Define s:sys_dir_w and s:sys_dir_l in your .vimrc file.
+" example:
+" let g:sys_dir_w="c:\\WinDDK" (for windows)
+" let g:sys_dir_l="c:\\linux\\include" (for windows)
+"
+" Implementation below
+
+function! RSmartGrepNW(word)
+ set grepprg=smartgrep\ /nw
+ execute "cd " . g:base_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepHW(word)
+ set grepprg=smartgrep\ /hw
+ execute "cd " . g:base_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepW(word)
+ set grepprg=smartgrep\ /bw
+ execute "cd " . g:base_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepN(word)
+ set grepprg=smartgrep\ /n
+ execute "cd " . g:base_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepH(word)
+ set grepprg=smartgrep\ /h
+ execute "cd " . g:base_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrep(word)
+ set grepprg=smartgrep\ /b
+ execute "cd " . g:base_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepWA(word)
+ set grepprg=smartgrep\ /bw
+ execute "cd " . g:sys_dir
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepWW(word)
+ set grepprg=smartgrep\ /bw
+ execute "cd " . g:sys_dir_w
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+function! RSmartGrepWL(word)
+ set grepprg=smartgrep\ /bw
+ execute "cd " . g:sys_dir_l
+ execute "lgrep " . a:word
+ lopen
+ set grepprg&
+endfunction
+
+" ,g : recursive word grep for c,h file exclude comment by mouse cursored word
+" ,h : recursive word grep for h file exclude comment by mouse cursored word
+noremap ,g :call RSmartGrepW("<C-R><C-W>")<CR>
+noremap ,h :call RSmartGrepHW("<C-R><C-W>")<CR>
+
+" :Rn -> recursive word grep for c,h file include comment
+" :Rh -> recursive word grep for h file exclude comment
+" :R -> recursive word grep for c,h file exclude comment
+" :Rno -> recursive grep for c,h file include comment
+" :Rho -> recursive grep for h file exclude comment
+" :Ro -> recursive grep for c,h file exclude comment
+command! -nargs=1 -complete=file Rn call RSmartGrepNW("<args>")
+command! -nargs=1 -complete=file Rh call RSmartGrepHW("<args>")
+command! -nargs=1 -complete=file R call RSmartGrepW("<args>")
+command! -nargs=1 -complete=file Rno call RSmartGrepN("<args>")
+command! -nargs=1 -complete=file Rho call RSmartGrepH("<args>")
+command! -nargs=1 -complete=file Ro call RSmartGrep("<args>")
+
+" :Rl -> recursive word grep for c,h file exclude comment in sys_dir_w
+" :Rw -> recursive word grep for c,h file exclude comment in sys_dir_l
+command! -nargs=1 -complete=file Rl call RSmartGrepWL("<args>")
+command! -nargs=1 -complete=file Rw call RSmartGrepWW("<args>")
+
@@ -0,0 +1,21 @@
+#
+# makefile for Unix / Linux / MacOS
+# Copyright (C) 2011-2012 pebble8888@gmail.com
+#
+CC=gcc
+TARGET=smartgrep
+
+all:$(TARGET)
+
+OBJS=smartgrep.o
+
+$(TARGET): $(OBJS)
+ $(CC) -o $@ $?
+ rm -f $(OBJS)
+
+.c.o:
+ $(CC) -c $<
+
+clean:
+ rm -f $(OBJS) $(TARGET)
+
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by smartgrep.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
Binary file not shown.
Oops, something went wrong.

0 comments on commit dfc735e

Please sign in to comment.