Giter Club home page Giter Club logo

search-and-view's Introduction

Tools to make searching and viewing easy.

For a Chinese introduction, see my blog article.

阅读中文版介绍,请看我的博客文章(有点旧了)。

Overview

  • rgg/rgv: ripgrep wrappers to make it easy to open files as matching places
  • vv: A Vim / gVim wrapper to open files in existing gVim instances and then move the cursor to specified location

image

Dependencies

  • Python >= 3.8
  • ripgrep
  • the setproctitle Python library (optional)
  • vv requires Vim or gVim with +clientserver feature

Arch Linux users can install search-and-view-git from AUR (thanks to @acgtyrant).

Configuration

Use the RGV_EDITOR environmental variable to spefify your preferred editor for rgv. It's taken as a shell command template string and the following is recognized:

  • $file: The file path.
  • $line: The line number.
  • $col: The column number.

For example:

# uses 'vv'
export RGV_EDITOR='vv $file:$line:$col'
# uses 'vim'
export RGV_EDITOR='vim +$line $file'

Usage

rgg and rgv

Just use rgg as rg to search text (Searching in filenames -g won't work).

Use rgv N to open the result numbered N. You can use rgv without arguments to view the list again. The list is per terminal (tty).

If your terminal supports hyperlinks, you'll be able to click the highlighted match to jump to it, provided that vv.desktop is properly installed (i.e. copied to ~/.local/share/applications).

vv

you can give a line number and a column number after a colon, like this:

vv file:33
vv file:12:902

Or paste the line from a Python traceback:

vv 'File "/usr/lib/python3.4/sre_parse.py", line 358, in _parse_sub'

You don't need the full line. Just enough info will do:

vv '/usr/lib/python3.4/sre_parse.py", line 358'

If you are on Linux and use zsh, I suggest the following alias:

alias -g XS='"$(xsel)"'

Then you can just select the line and do:

vv XS

You can pass the --wait flag to wait for Vim to finish editing the file (useful for programs that waits for editing to finish).

Use the --vim NAME option to spefify a Vim instance (default is the first one found).

License

GPLv3+.

search-and-view's People

Contributors

firedfox avatar lilydjwg 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

Watchers

 avatar  avatar  avatar  avatar

search-and-view's Issues

agg 会一直记住不存在的搜索路径

大概。

我曾执行 agg size() == 0, 当时忘记加上双引号,结果后来不管搜什么,均返回 agg:8: = not found, 且每次搜索都会递增数字,我猜 agg= 当成搜索路径并记住了。

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.