about summary refs log tree commit diff stats
path: root/contrib/vim/README.md
blob: f108c89396c39977ba379749cb85534747c20dd3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# rf-vim

> Simple `rf` Vim integration

### Installation

__Manual installation:__

If you are using default Vim paths (so not Neovim for example) you can
just run `make install`. Otherwise you should just be able to modify your
`runtimepath` and add `~/.vim/after/`.

__Using vim-plug, Vundle, et al:__

```viml
Plug 'roryrjb/rf', { 'rtp': 'contrib/vim' }  " vim-plug
Plugin 'roryrjb/rf', { 'rtp': 'contrib/vim' }  " Vundle
```

Other plugin systems will likely have very similar options. In a nutshell
the vim plugin provided here isn't in the root of the repo and assumes
you have `rf` already installed and present in your `$PATH`.

### Usage

The plugin provides two functions:

__RF:__

This function runs a getchar() loop, allowing you to search from the
root of the current working directory, using only substring patterns,
the idea being that it is very quick and simple to use, rather than
exposing more of the functionality that rf provides.

I usually bind the function like so:

```
map <c-p> :RF <CR>
```

The function is very simple and will call rf with your pattern
*at every key stroke*. Usually this is performant enough, but
with extremely large directory trees, you may have to wait several
seconds for results, which isn't great. Aside from any improvements
to the implementation, just make sure that any `.rfignore` files,
whether local or global are ignoring everything that can be ignored.

__RFGrep:__

```
:RFGrep search-pattern filename-pattern
```

This function is a wrapper around `grep -r` and rf. It allows you
to grep recursively over a smaller subset of files. Again the
implementation is very simple but with very large directory trees
or with filename patterns that match a lot of files you may
hit the argument limit for grep.

### Issues

Aside from the above mentioned limitations and issues, if you
are using anything other than a "Bourne" shell (bash, ksh, zsh, sh)
the functions may not work, in that case you may want to explictly:

```
set shell=sh
```