Skip to content

Commit dd50319

Browse files
simegsb2nov
authored andcommitted
Clean up and refresh iTerm sub pages (sb2nov#212)
1 parent ae3db58 commit dd50319

File tree

3 files changed

+54
-44
lines changed

3 files changed

+54
-44
lines changed

iTerm/ack.md

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# `ack`
22

3-
`ack` is a search tool designed for code. It's built to be a replacement for `grep` with higher speed and more options.
3+
`ack` is a search tool designed for code. It's built to be a replacement for
4+
`grep` with higher speed and more options.
45

56
## Installation
67

78
To install the latest version, use homebrew.
89

910
```bash
10-
brew install ack
11+
$ brew install ack
1112
```
1213

1314
## Why use `ack` over `grep`
@@ -20,24 +21,28 @@ brew install ack
2021
## Usage
2122

2223
```bash
23-
ack [OPTION]... PATTERN [FILES OR DIRECTORIES]
24+
$ ack [OPTION]... PATTERN [FILES OR DIRECTORIES]
2425
```
2526

26-
Let's say you want to find all JavaScript files that are using the module `pancakes` in your project, with `ack` it's as easy as
27+
Let's say you want to find all JavaScript files that are using the module
28+
`pancakes` in your project, with `ack` it's as easy as
2729
```sh
28-
ack --js pancakes
30+
$ ack --js pancakes
2931
```
3032

3133
Or you may want to find all files that _does not_ contain the word _brew_
3234
```bash
33-
ack -L brew
35+
$ ack -L brew
3436
```
3537

3638
## Customization
3739

38-
You can customize `ack` to behave the way you want it to, this configuration is stored in `/.ackrc`.
40+
You can customize `ack` to behave the way you want it to, this configuration i
41+
s stored in `/.ackrc`.
3942

40-
For example, you can add a custom type to use as a flag when searching. The following configuration will allow you to only search in `.md`, `.mkd` and `.markdown` files using the `--markdown` flag.
43+
For example, you can add a custom type to use as a flag when searching. The
44+
following configuration will allow you to only search in `.md`, `.mkd` and
45+
`.markdown` files using the `--markdown` flag.
4146
```bash
4247
--type-set=markdown=.md,.mkd,.markdown
4348
```
@@ -51,7 +56,7 @@ You can also tell ack to always sort and use colors in the result.
5156
To see what configuration `ack` uses you can use the `dump` flag.
5257

5358
```bash
54-
ack --dump
59+
$ ack --dump
5560
```
5661

5762
## Alternatives to `ack`

iTerm/fzf.md

+38-33
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,57 @@
11
# `fzf`
22

3-
[`fzf`](https://github.com/junegunn/fzf) is a general-purpose command-line fuzzy finder.
4-
5-
## Why use `fzf`
6-
7-
- Speed
8-
- Rich feature set
9-
- Highly customizable
3+
[`fzf`](https://github.com/junegunn/fzf) is a general-purpose command-line
4+
fuzzy finder. On it's own it's not very useful but when combined with other
5+
tools it becomes super powerful.
106

117
## Installation
128

13-
Use [homebrew](http://sourabhbajaj.com/mac-setup/Homebrew/README.html) to install `fzf`:
14-
15-
brew install fzf
16-
17-
If you want to use shell extensions:
18-
19-
/usr/local/opt/fzf/install
20-
21-
which are:
22-
23-
- Key bindings (`CTRL-T`, `CTRL-R`, and `ALT-C`) (available for bash, zsh and fish)
24-
- Fuzzy auto-completion (available for bash and zsh)
9+
Use [homebrew](http://sourabhbajaj.com/mac-setup/Homebrew/README.html) to
10+
install `fzf`:
2511

26-
## Usage
12+
$ brew install fzf
2713

28-
### Fuzzy completion
14+
If you want to use shell extensions (better shell integration):
2915

30-
>hit tab (↹) after:
16+
$ /usr/local/opt/fzf/install
3117

32-
#### File search
18+
which gives you:
3319

34-
vim **
20+
- Key bindings (`CTRL-T`, `CTRL-R`, and `ALT-C`) (available for _bash_, _zsh_
21+
and _fish_)
22+
- Fuzzy auto-completion (available for _bash_ and _zsh_)
3523

36-
or
24+
## Example Usages
3725

38-
subl **
26+
Add any of these functions to your shell configuration file and apply the
27+
changes to try them out. Or just paste the function in your terminal if you
28+
just want to try it out without saving it.
3929

40-
#### Host name search
30+
```sh
31+
# fd - cd to selected directory
32+
fd() {
33+
local dir
34+
dir=$(find ${1:-.} -path '*/\.*' -prune \
35+
-o -type d -print 2> /dev/null | fzf +m) &&
36+
cd "$dir"
37+
}
38+
```
4139

42-
ssh **
40+
```sh
41+
# fh - search in your command history and execute selected command
42+
fh() {
43+
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
44+
}
45+
```
4346

44-
>**Note**: for more fuzzy search things head over [official repo](https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh)
47+
**For more fuzzy search examples see the
48+
[official repo](https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh).**
4549

46-
### Chrome history from CLI
50+
### Chrome history from your terminal
4751

48-
>**Note**: original [blog post](https://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/)
52+
**Note**: original [blog post](https://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/)
4953

50-
Open up shell config (most likely `~/.zshrc` or command `zshconfig`) and add following function:
54+
Open up your shell config and add following function:
5155

5256
```sh
5357
# ch - browse chrome history
@@ -66,4 +70,5 @@ ch() {
6670
}
6771
```
6872

69-
>**Note**: Ensure that path to `History` file is correct; read more information on [StackOverflow](https://stackoverflow.com/a/16742333/1564365)
73+
**Note**: Ensure that path to `History` file is correct; read more information
74+
on [StackOverflow](https://stackoverflow.com/a/16742333/1564365).

iTerm/tree.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
To install the latest version, use homebrew:
88

99
```bash
10-
brew install tree
10+
$ brew install tree
1111
```
1212

1313
## Usage
@@ -42,7 +42,7 @@ Running `tree` will produce output like this:
4242
To limit the recursion you can pass an `-L` flag and specify the maximum depth `tree` will use when searching.
4343

4444
```bash
45-
tree -L 1
45+
$ tree -L 1
4646
```
4747
will output:
4848

0 commit comments

Comments
 (0)