Skip to content

Commit

Permalink
Add documentation for position number alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
dajva committed Oct 20, 2018
1 parent d1f4ec4 commit 68b0ec2
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions README.md
Expand Up @@ -29,23 +29,17 @@ load path and add this to `init.el`

``` el
(require 'rg)
(rg-enable-default-bindings (kbd "M-s"))
(rg-enable-default-bindings)
```

`rg` and friends is an autoloaded symbol so it's also possible to
defer loading if you have autoloading setup.
`rg` and friends are autoloaded symbols which means it's also possible
to defer loading if you have autoloading setup.

### wgrep

The default configuration of this package is compatible with `wgrep`.
If grouped mode and/or show columns is enabled you need to install the
[wgrep-ag](http://melpa.org/#/wgrep-ag) package from MELPA and
configure it like this:

``` el
(add-hook 'rg-mode-hook 'wgrep-ag-setup)
```

This package use [wgrep](https://github.com/mhayashi1120/Emacs-wgrep)
for doing changes to matched files from the rg results buffer. No
setup is needed.


## Usage
Expand Down Expand Up @@ -193,6 +187,42 @@ Controls if the search info header is shown in the result
buffer. This is enabled by default but can be disabled by setting this
variable to `nil`.

### Position numbers alignment
It's possible to control how the line and column numbers are displayed
in the result buffer.

Example settings:
``` emacs-lisp
(setq rg-align-position-numbers t)
(setq rg-align-line-number-field-length 3)
(setq rg-align-column-number-field-length 3)
(setq rg-align-line-column-separator "#")
(setq rg-align-position-content-separator "|")
```
Will yield the following format:

```
1# 2|match1
888# 10|match2
```

#### `rg-align-position-numbers`
Setting this to `t` will align line and column numbers in columns
padded with whitespace.

#### `rg-align-line-number-field-length`
Defines the length of the line number field.

#### `rg-align-column-number-field-length`
Defines the length of the column number field.

#### `rg-align-line-column-separator`
Separator string used between line and column numbers.

#### `rg-align-position-content-separator`
Separator string used between the position numbers and matched
content.

### `rg-define-toggle`
This is a macro that can be used to define custom `ripgrep` flag
toggling functions in the rg result buffer. The macro takes the flag
Expand Down

0 comments on commit 68b0ec2

Please sign in to comment.