Skip to content

firedfox/search-and-view

This branch is 27 commits behind lilydjwg/search-and-view:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e5e99b5 · Aug 26, 2017

History

25 Commits
Aug 26, 2017
Aug 9, 2016
Sep 28, 2016
Sep 28, 2016
Aug 26, 2017

Repository files navigation

Tools to make searching and viewing easy.

For a Chinese introduction, see my blog article.

阅读中文版介绍,请移步我的博客文章

Overview

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

Dependencies

  • agg: Bash, ag, and several other common command-line tools.
  • rgg: Bash, ripgrep, and several other common command-line tools.
  • agv: Python 3, setproctitle library for changing the process name (optional).
  • vv: Python 3, the zenity utility, Vim or gVim with +clientserver feature.

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

Configuration

Use the AGV_EDITOR environmental variable to spefify your preferred editor for agv. 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 AGV_EDITOR='vv $file:$line:$col'
# uses 'vim'
export AGV_EDITOR='vim +$line $file'

Usage

agg / rgg and agv

Just use agg as ag to search text (Searching in filenames -g won't work). Use rgg if you want to use the ripgrep tool.

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

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).

License

GPLv3+.

About

Tools to make searching and viewing easy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.6%
  • Shell 9.4%