Friday, March 3, 2017

コマンド一発でソースコード検索&表示できる「peco」改が凄い!

lestrratさんがやってくれました。

ずいぶん前から、ソースコードを検索して読みやすいコマンドはないかなーと思っていました。個人的にはackで検索して見つかったファイルをlessで開いて再びキーワードを入れて当該行までジャンプしていたのですが、毎回毎回めんどくさい感じでした。コマンド一発でインクリメンタル検索してキーワード周辺のソースコードを読めるツールが欲しいなぁって思ってたんです。

とあるslackでお昼時に、mattnさんと「ほしいですよねー」という話から始まって、vimにあるgrepとかも物色しながら「いいのないねー」とか言ってたらkanさんが「@lestrrat 案件だ」って言い出して牧さんが召喚されてついさっきpecoに必要な機能が追加されてました。速いw

ためしにpicotlsの開発ディレクトリでpecoの一行ラッパーperoを起動し、「EVP_Digest」を検索してみました。こんな感じ。


こんなに直感的にソースコードが読める。
コマンドラインになれた人ならイメージ湧くかと思います。インデックスを作るみたいな下準備も何も必要ありません。
ただコマンドを実行するだけで対話的に検索して表示できる。
すばらしい!
こういうのが欲しかったんです。
ただまだ、pecoの本機能はまだtopic/commandブランチからマージされていませんし、バグがあるかもしれません。また高機能にするつもりもないでしょうから使用目的を選ぶのが先決かと思います。

ちなみに、こんな感じの一行ラッパーを書いて使ってます。pero --cc とやれば C のコードが、pero --java とやれば Java のコードだけが検索対象になります。

#! /bin/sh

exec ack "$@" . | peco --exec 'awk -F : '"'"'{print "+" $2 " " $1}'"'"' | xargs less '

ありがたや。ありがたや。

あわせて読みたい:「Big Sky :: ヘッダファイルだけでC++から使えるJSONパーサ「picojson」が凄い!

46 comments:

  1. Thanks for your share, hope that you will post more blog soon.
    driving directions

    ReplyDelete
  2. By default, hotmail keeps you logged in until you use the Sign Out button to end the session or 24 hours have passed since you logged on. This can mean that somebody else who passes by your computer while you're away has access to your emails, and can write some from your hotmail account.

    ReplyDelete
  3. Really a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Thanks so lot for your convene.

    - five nights at freddy's

    ReplyDelete
  4. • Your post has many fine detail information. I read your article and I actually| like it. I want to thank posting this great post.
    * Street view
    * hotmail sign
    * Boy names starting with V

    ReplyDelete
  5. Thank you so much for your suggestion and discuss these important points for blog commenting.
    The points you are listed above, really appreciable and will really help in blog commenting or commenting on other posts or topic.
    http://lootindiadeals.com
    http://Whatsappstatus33.com
    https://healthylifeandshape.com
    https://latestwhatsappstatus.blogspot.com

    ReplyDelete
  6. Truly an amazing post.I really like it.Thanks for sharing with us.
    - trump twitter

    ReplyDelete
  7. The blog or and best that is extremely useful to keep I can share the ideas of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.

    -- happy wheels --

    ReplyDelete
  8. Truly unprecedented post. I simply found your blog and foreseen that would express that I have really had a great time exploring your blog portions. Health Defect Anyway, I'll be subscribing to your maintain and I believe you post again soon

    ReplyDelete
  9. www.gmail.comIn order to access Gmail, you need to create a google account first. you heard it. So how do you think you can create a new Gmail account. Just follow the steps.
    gmail.com

    ReplyDelete
  10. Wish your blog site will grow, I look forward to your new article. metal gear survive

    ReplyDelete
  11. Similar to Bing Microsoft is not happy with just copying a few features from its rivals, but also find other persuasive ways to help users interact effectively with email. Here are some useful features of Hotmail. You can sign in hotmail.com account and use it immediately.

    ReplyDelete
  12. If you want to install the new product through the old Windows Key, you just copy the Product Key Windows and copy to windows 8.1 product key version 1511 and install the new, during the installation will automatically scan the product. Key and activate Windows for you.

    ReplyDelete
  13. In the midst of budgetary disadvantages, individuals have constantly swung to banks for help. They contract their home, auto or different properties. Some even go to charge card organizations to get cash. quick cash advance Chicago

    ReplyDelete
  14. Such intelligent work on the subject and ideal way of writing here. I am really impressed! This post is a helpful overview of the particular topic and very actionable. Interesting approach! Want to recover from an unexpected financial emergency? Get Emergency Payday Loans Online Now.

    Online Payday Loans
    Cash Advance Loan
    Emergency payday Loans Payday Loans
    Bad Credit

    ReplyDelete
  15. Thank you for this post. This is very interesting information for me. More information about the essay, see how other aspects can affect this kind of check it out
    https://www.learningcrux.com/

    ReplyDelete
  16. Thanks for sharing this nice and informative article. This is a good change. I am really impressed! All the information is dealt with clarity.
    Want to recover from an unexpected financial emergency? Get Emergency Payday Loans Online Now.



    Personal Loans
    Online Payday Loans
    Payday Loans No Credit Check
    Faxless Payday Loans
    Fast Payday Loan

    ReplyDelete
  17. Find a job now
    https://www.recruitmentnewsportal.com/npower-recruitment-form/

    ReplyDelete
  18. The reason for this Brahmin Matrimony Sites is to broaden the administrations of Jeevanrahi Matrimonial Services to go online and help the community on one stage to search the perfect life partner. It is exclusively the vision of our guides that drive our group to work.
    Brahmin Matrimony Sites
    Marwari Matrimony Sites
    Sindhi Matrimonial Sites
    Punjabi Matrimony Sites
    Sikh Matrimony Sites
    Kannada Matrimony Sites

    ReplyDelete
  19. I just want to mention I am beginner to weblog and absolutely enjoyed your web-site. More than likely I’m want to bookmark your blog . You really have very good posts. Appreciate it for revealing your website page.

    FaaastCash
    online Loans
    Cash Advance Loans
    Payday Loans
    Emergency payday Loans

    ReplyDelete
  20. I really enjoyed your blog Thanks for sharing such an informative post.



    I really enjoyed your blog Thanks for sharing such an informative post.
    Get the best help in
    birth certificate translation
    ,

    driver license translation
    ,

    marriage certificate translation
    ,

    translation services australia
    .
    If you are looking for
    translation services Adelaide



    translation services Brisbane



    translation services Melbourne



    translation services Perth



    translation services Sydney



    naati translator







    the visit our website now.

    ReplyDelete
  21. Agen Judi Bola Terbaik dan situs judi online terpercaya ialah https://13win.org/ yang telah menjadi tempat bermain judi online online populer dan kepercayaan pecinta judi online di Indonesia yang selalu menghadirkan pelayanan terbaik dan juga keuntungan besar. Adapun profile 13win bisa anda lihat di https://www.voat.co/u/situsjudi13win/

    ReplyDelete
  22. Best and gifted scholars at Students Assignment Help are giving online assignment help administrations. We never miss any of the due dates. Our expert authors are accessible online dependably for understudies help.

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. Schedule of lottery production or closing hours of Singapore lottery market is at 17.31 WIB. The HK market closed at 23.00 WIB, while the Sydney pools Lottery closed at 13.50 Wib. So, keep a track of our website for Togel expense information. Because the related websites usually overload in the initial minutes, and the official website of the production of Singapore Lottery already entered the block of Indonesian government, we will provide the mirroring result as soon as we can.

    nggrandong

    ReplyDelete
  25. Assignment help online is the online administration where students can get full learning in any scholastic session. The subjects are performed by the prerequisite of students as it were.
    Homework Help Canada

    ReplyDelete
  26. Creo Parametric is the 3D CAD solution in the industry of product design. Engineering students are often asked to solve assignments on Creo to enhance their design optimisation skills. It is not easy to solve the Creo assignment problems. You may have other coursework or homework to do or you may have a problem understanding the app. No matter what your problem is, get Creo assignment help from us now.

    ReplyDelete
  27. Have you ever stuck in a situation where you have a blank sheet of paper in your hand and having lots of anxieties? It happens if you don't prepare for speech, lack of compelling ideas, and because of lack of best and approaching speech topics.
    Talking of picking informative speech topics, there are lots of tricks to select it so that you can grab the attention of your teaches or audiences. So, I am suggesting some amazing informative speech topics that will definitely blow your mind.

    1. Speech topics on communication
    2. Informative speech topics on education
    3. Speech topics on animals
    4. Presentation speech topics for business
    5. Trending topics on economy
    These are only the area on which you can create speeches but there are various topics that are covered by these areas along with other many areas.

    So, to draft a perfect informative speech topics you can get assistance or help from MyAssignmenthelp.com

    ReplyDelete
  28. StudentsAssignmentHelp.com provides its dissertation writing services UK outstandingly to the students at the low cost. We serve online writing help services to students with the quality content which are free from plagiarism.

    ReplyDelete
  29. Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!

    Alpine payday loans

    ReplyDelete
  30. Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post. https://www.crackslive.com/

    ReplyDelete

Note: Only a member of this blog may post a comment.