GithubHelp home page GithubHelp logo

agl's Introduction

agl / agv

Helper script for the_silver_surfer (https://github.com/ggreer/the_silver_searcher).

Uses 'ag' to search given files, then opens matches with either 'less' or 'vim'.

This script uses 'ag' to

  1. Find a list of files matching the given pattern, and then
  2. Passes that list into 'less' with the search pattern applied. You can then navigate the results using less (e.g. n,N,:n,:p commands).

At it's simplest you can just use it with a search string. agl will open all the matching files in less:

agl somestring

or

agl "some longer string"

You can also feed in some of ag's options:

agl --python some_function

Using vim instead of less

If the script is named 'agv' it will use vim instead of less to open the file results.

The intended way to use this feature is to create a symlink from agl to agv:

% ln -s agl agv

Now use 'agv' to search and edit the results in vim.

Detailed help

From the help:

% agl -h

Uses 'ag' to search given files, opens matches with 'less'

Usage: agl [-h] ['ag' arguments]

['ag' arguments] :
                A set of arguments to ag, including the search expression
                e.g. [FILE-TYPE] [OPTIONS] PATTERN [PATH]
                Note: any multi-field [OPTIONS] need to be quoted (eg "--ignore PATTERN" or "-G PATTERN")

Examples:
agl somestring
agl "some longer string"
agl --java SomeClass
agl --xml '<artifact'
agl --java -i someclass
        Note: arguments are not passed into less, so in this case
        you would need to immediately use '-i' command in less.
agl "-G '.log'" "some string"
        Note: the -G option needs to be quoted so as to be treated as a single ag option.
agl "--ignore '*.log'" "some string"
        Note: the --ignore option needs to be quoted so as to be treated as a single ag option.

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.