Coder Social home page Coder Social logo

happygrep's Introduction

请注意

由于多年来系统变化比较大,ncurse 一般默认也会安装6,而不是我这里需要的5了,所以下面的安装步骤可能会有些过时。

命令行查找可爱多: happygrep

happygrep 采用 ncursesw 的 TUI 字符界面图形库,封装了常用的 unix 命令行查找操作,相当于 ( find + grep + 漂亮界面 )。

Inspired by tig .

Installation (Ubuntu)

需要先安装依赖库

sudo apt-get -y install libncursesw5 libncursesw5-dev
cd happygrep/
make

得到二进制文件 happygrep ,可以

mv happygrep ~/bin/xxx

以后就可以这样用了

xxx string

Installation (Mac OS X)

首选,采用 brew cask 安装:

$ brew cask update
$ brew cask install happygrep

下面是手动安装方式:

在我自己的 10.8.5 系统上

$ brew --version
0.9.5
$ brew search ncurses
homebrew/dupes/ncurses
$ brew install homebrew/dupes/ncurses
$ make -f Makefile.macosx

这样就装好了。libiconv 在 10.8.5 的系统上已经预装了,但是较老的系统上好像没有,所以在老版本的 mac 上,我自己安装的过程是:

$ brew install ncurses
$ brew install libiconv
$ make -f Makefile.macosx

并且老版本的 Makefile.macosx 中的编译语句是这样的:

gcc happygrep.c  -I/usr/local/opt/libiconv/include -I/usr/local/opt/ncurses/include -L/usr/local/opt/libiconv/lib -L/usr/local/opt/ncurses/lib -o happygrep -lncursesw  -liconv -Wall

UPDATE: 在 Yosemite 10.10.5 系统上 brew cask 中的版本是不行的,因为二进制依赖于 ncurse5 ,而 Yosemite 上是 6 。可以采用下面的安装步骤

$ brew install homebrew/dupes/ncurses
$ git clone happygrep
$ make -f Makefile.macosx

这样就成功了。

Usage

happygrep 会默认忽略 .git 目录. 另外也可以通过 -i 参数指定另一个要忽略的目录,例如

happygrep "hello world" -i "image"

这样可以忽略 image/ 目录。

在打开的 TUI 界面上,可以使用的快捷键

  • use j and k (or up/down arrows) to select the entry listed in window

  • type e character to open the file where the proper entry appeared

  • edit the opened file in vim editor

  • close vim to return to the original window to continue

  • type q character to quit

Development

有任何的问题和建议,欢迎到 issue tracker.

Contributors

License

The MIT license

happygrep's People

Contributors

billie66 avatar happypeter avatar jerryw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

happygrep's Issues

Ubuntu安装后怎么使用啊

根据README.md的指导完成了安装,目前程序在~/bin/xxx目录下存在。请问这个xxx是什么?可替代否?
下面那个命令中的xxx呢?也可替代否?现在完全是无法使用的情况中,求指导。

Ack

Ack is also nice, but only for source code search, so happygrep will be happygrep, never happyack.

hello

brew cask install failed

book git:(gh-pages) ✗ brew cask install happygrep
==> Downloading https://github.com/happypeter/happygrep/releases/download/v1.0/h

################################################################## 100.0%

==> Note: running "brew update" may fix checksum errors
Error: SHA2 mismatch
Expected: 572c3eaa6b0609c05b85c6934155b8e8943d28464438d9ec2838efbf6e29e863
Actual: 05c5f33142c9ea4559b20ca421c76fa0b081ae3edc0d6e3b8f7c3dd8ba21a518
Archive: /Library/Caches/Homebrew/happygrep-1.0.zip
To retry an incomplete download, remove the file above.

a simpler regexp

now If I want to search .tag, I have to use

happygrep "\.tag"

all of the below fails to work

happygrep ".tag"
happygrep \.tag
happygrep .tag

since happygrep is for beginners, we should make sth like this

ack -Q .tag

and set this as default, and when we do want to use regexp, mark it with a option tag

happygrep --regexp "\.tag"

Check also: vim easygrep: http://www.vim.org/scripts/script.php?script_id=2438

不知道这个是不是内存问题

[RPathN] xxx: happygrep.c:993: navigate_view: Assertion `0 <= view->lineno && view->lineno < view->lines' failed.
already at first line 已放弃 (核心已转储)

MAKE时出现错误

[root@dfrz-virtual-machine happygrep-master]#make
gcc happygrep.c -o happygrep -lncursesw
/tmp/cckqFXS3.o: In function main': happygrep.c:(.text+0x633): undefined reference tolibiconv_open'
happygrep.c:(.text+0x692): undefined reference to `libiconv_open'
collect2: ld 返回 1
make: *** [all] 错误 1

a nicer format to ignore things

now I use happygrep keyword ignore_stuff to get things ignored, this is bad format, try

happygrep keyword --exclude file1 dir2/

or maybe even better, read stuff from somefile like .gitignore

happygrep keyword --exclude-list .gitignore

有安装依赖,执行make后出现这个错误

root@Ubuntu-Server:/happygrep# make
gcc happygrep.c -o happygrep -lncursesw -Wall
happygrep.c: In function ‘init’:
happygrep.c:483:9: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
int x, y;
^
root@Ubuntu-Server:
/happygrep#

I tried to add some new 'commands' to this wonderfull stuff

Firstly, I have to say, this is a very exciting tool. Although we could still find some thing not so good, but that's nothing.

I used this tools for days, and I really love it. Besides this, i want some new 'commands' to give it more fun.

Basicly, I guess peter wanna navigate the view the same as vi, and that's exactly what i wanna too.

So, i added these commands as below, all to make a faster navigation:

  • 'H': go to the head line of the current page.
  • 'L': go to the tail line of the current page
  • 'f': page down, and highlight the first line
  • 'F': page up, and highlight the first line

In fact, I wanna more, such as, 'g' to go to the first line of the total buffer, and 'G' to go to the last line of the total buffer, not finished yet.

Also, I have read the issues above, but to be honest, i don't that care about the exact match or what, mostly because the size of my code is not that big.

But, I find that when I use happygrep, sometimes it runs too slow. I read the code, and maybe this is because the realloc function inside the while loop? I don't have that much time to debug this, and just use it for now.

Finally, thanks the author again, and I'm very interesting on this tool.

I'm a new fish to program under Linux system, and also to the git thing. I still don't get how to contribute to an interesting project. So, if U wanna, contact me by email or so. I'll be very happy to here from u.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.