aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 606d426852577f85e3517304d73a654291e11f03 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# denote-fzf-lua

Neovim plugin that uses [`fzf-lua`](https://github.com/ibhagwan/fzf-lua) to search a directory of notes formatted with the [Emacs Denote package's file-naming scheme](https://protesilaos.com/emacs/denote#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d):

`DATE==SIGNATURE--TITLE__KEYWORDS.EXTENSION`

The nice custom table for Denote files is the only unique feature of this plugin. If you don't care about that you should just configure `fzf-lua` alone however you like it.

![](https://i.imgur.com/1lTDhOz.png)

# Installation / Config

Example config via [lazy.nvim](https://github.com/folke/lazy.nvim)

```lua
{
  "https://codeberg.org/historia/denote-fzf-lua",
  opts = {
    dir = "~/notes",

    search_fields = {
      path     = false,
      date     = true,
      time     = false,
      sig      = false,
      title    = true,
      keywords = true,
      ext      = false,
    },

    fzf_lua_opts = {
      winopts = {
        height = 0.85,
        width  = 0.80,
        row    = 0.35,
        col    = 0.50,
        preview = {
          layout = 'vertical',
          vertical = 'down:45%',
        },
      },
      fzf_opts = {
        ['--reverse']      = true,
        ['--no-info']      = true,
        ['--no-separator'] = true,
        ['--no-hscroll']   = true,
        ['-i']             = true,
      },
    },
  },
},
```

## Dependencies

* [`ibhagwan/fzf-lua`](https://github.com/ibhagwan/fzf-lua) - Neovim plugin
* `fzf` - Fuzzy finder
* (OPTIONAL) `fd` - Fast `find` replacement
* (OPTIONAL) `sd` - Fast `sed` replacement
* (OPTIONAL) [`qsv`](https://github.com/jqnatividad/qsv) - Fast `column` replacement
* (OPTIONAL) `bat` - Nicer preview than `cat`
* (OPTIONAL) `ripgrep` - Required to search note contents

```
Arch Linux: sudo pacman -S fzf ripgrep fd sd bat
            yay -S qsv-bin

Debian: sudo apt install fzf ripgrep fd-find sd bat
        export PATH=/usr/lib/cargo/bin/:$PATH (to add `fd` to path)
        Install qsv from Github
```

If the optional dependencies are missing `denote-fzf-lua` falls back to standard Unix tools (`find`, `sed`, `column`).

# :DenoteSearch command

```vim
" Searches filenames in `dir` with fzf and displays results as a table
:DenoteSearch files

" Standard rg search through file contents in `dir`.
" Nothing special about this, it's just a convenient command that uses the same fzf-lua options
:DenoteSearch contents
```

# Multi-Directory Support

When used alongside [simple-denote.nvim](https://codeberg.org/historia/simple-denote.nvim) with multiple directories configured, `denote-fzf-lua` automatically follows the active directory set by `:Denote dir`. It reads from `vim.g.denote_dir` if set, falling back to the configured `dir` option. No additional configuration is needed.

# License

GNU AGPL