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
69
70
71
72
73
74
75
76
|
# Fuzzy find and open files in vis
Use [fzf](https://github.com/junegunn/fzf) to open files in [vis](https://github.com/martanne/vis).
## Usage
In `vis`:
- `:fzf`: search all files in the current sub-tree.
- You can pass arguments to fzf, e.g. : `:fzf -p !.class`
While in `fzf`:
- `<Enter>` to open the selected file in current window
- `<C-s>` to open the selected file in a horizontal split
- `<C-v>` to open the selected file in a vertical split
## Configuration
In `visrc.lua`:
```lua
plugin_vis_open = require('plugins/vis-fzf-open')
-- Path to the fzf executable (default: "fzf")
plugin_vis_open.fzf_path = (
"FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g \"\"' fzf"
)
-- Arguments passed to fzf (default: "")
plugin_vis_open.fzf_args = "-q '!.class ' --height=40%"
-- Mapping configuration example
vis.events.subscribe(vis.events.INIT, function()
vis:command('map! normal <C-p> :fzf<Enter>')
end)
```
Complex example for `plugin_vis_open.fzf_args`:
```lua
my_fzf_args = string.gsub([[
--bind=$my_fzf_key_bindings \
--color fg:242,bg:236,hl:65,fg+:15,bg+:239,hl+:108 \
--color info:108,prompt:109,spinner:108,pointer:168,marker:168 \
--delimiter / --nth -1 \
--height=70% \
--inline-info \
--no-mouse \
--preview-window=up:70% \
--preview="(
bat --style=changes,grid,numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}
) 2> /dev/null | head -1000"
]], '%$([%w_]+)', {
my_fzf_key_bindings=table.concat({
"alt-j:preview-down",
"alt-k:preview-up",
"ctrl-f:preview-page-down",
"ctrl-b:preview-page-up",
"?:toggle-preview",
"alt-w:toggle-preview-wrap",
"ctrl-z:clear-screen"
}, ",")
})
-- Arguments passed to fzf (default: "")
plugin_vis_open.fzf_args = my_fzf_args
```
All issues, questions, complaints, or (even better!) patches
should be send via email to
[~mcepl/devel@lists.sr.ht](mailto:~mcepl/devel@lists.sr.ht) email
list (for patches you may use [git
send-email](https://git-send-email.io/)).
|