Search and edit those results instantly. (Named comes from search-ack, now ag).
Search for specific terms in files using AG (the-silver-searcher) and then jump to instantly edit those lines in VIM.
Sack outputs those shortcuts into ~/.sack_shortcuts
for easy editing/re-use across any terminal on the system.
It's a reimplementation of sack, which was a ruby re-implementation of the original bash script sack.
wget -o ~/bin/sack https://github.com/zph/go-sack/releases/download/v0.3.0/sack && chmod +x ~/bin/sack
Or for the reckless:
curl -sSL https://github.com/zph/go-sack/raw/master/src/install | bash -s
Install script will try to match for the right version of binary (only amd64 arch):
curl -sSL https://github.com/zph/go-sack/raw/master/src/install | bash -s
Check for your platform's bin on repo's Release Page.
Install that into somewhere in your $PATH and chmod +x that puppy.
OR:
Install from source using usual go build. Clone it && make build
or make install
.
For shell integration (sets up two aliases) add the following to your .zshrc or .bashrc
eval "$(sack init)"
To search in a directory:
sack -s SEARCH_TERM [DIRECTORY: defaults to current]
OR (with shell integration)
S SEARCH_TERM [DIRECTORY: defaults to current]
To edit one of those results by index number (zero indexed):
sack -e 1
OR (with shell integration)
F 1
To display current shortcuts:
sack -p
NAME:
Sack - sack [searchterm] [optional directory]
USAGE:
sack [global options] command [command options] [arguments...]
VERSION:
0.4.0
COMMANDS:
init shell init script
eval shell eval command to insert into .{zsh,bash}rc
GLOBAL OPTIONS:
--edit, -e edit a given shortcut
--search, -s search-ack/ag it
--print, -p display existing shortcuts
--debug, -d show all the texts
--flags value, -f value flags to pass to ag
--help, -h show help
--version, -v print the version
Original idea & implementation belong to @sampson-chen: https://github.com/sampson-chen/sack.
Rewritten for cleanliness in go-lang for speed b/c Ruby standalone scripts with dependencies aren't convenient, & b/c Shell scripts past a certain length are unwieldy.
- ag the-silver-searcher
- Falls back to use grep... but don't do that :P.
MIT License (MIT) Copyright (c) 2014 Zander Hill
Input and pull requests are welcomed!
- Fork it ( http://github.com/zph/go-sack/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request