aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: a59c87c39187e9885a90537c6e3a40377c919636 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Bibiman

<!-- [![noMSgithub badge](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page/) -->

`bibiman` is a simple terminal user interface for handling your BibLaTeX
database as part of a terminal-based scientific workflow.

Here's a small impression how it looks and works:

[![bibiman.gif](https://i.postimg.cc/7YTMFkkn/bibiman.gif)](https://postimg.cc/Ln21PGhJ)

## Installation

You can install `bibiman` directly from `crates.io` using `cargo`:

```bash
cargo install bibiman
```

To use the version including the newest commits, you can clone the repo and
build it from source using `cargo`:

```bash
git clone https://codeberg.org/lukeflo/bibiman
cd bibiman

# Build the binary to /target/release
cargo build --release

# OR
# Install the binary to CARGO_HOME/bin which normally is in PATH
cargo install --path=. --locked

```

## Usage

`bibiman` needs bibfiles (with `.bib` extension) passed as positional arguments.
You can pass a single file, multiple files, the path of a directory containing
bibfiles, or mix files and directories.

Directories will be searched recursively for files with the `.bib` extension and
add them to the entry list. Other files will be ignored.Thus, be careful not to
pass a directory with multiple subdirectories (like eg `/home/usr/`), because
this could be to some delay while parsing GBs of data.

The following lines are all valid CLI calls to run `bibiman`:

```bash
# single file
bibiman bibfile-1.bib

# multiple files
bibiman bibfile-1.bib bibfile-2.bib

# directory containing bibfiles
bibman /my/cool/library/

# mixed arguments
bibiman bibfile-1.bib /my/cool/library/ bibfile-2.bib
```

## Features

For now, `bibiman` only has mainly features implemented which are important for
my personal workflow. There are more to come, the list will be updated:

- [x] **Browse** through the bib entries using _Vim-like keybindings_ and a
      _fuzzy search_ mode.
- [x] **Filter** the bib entries by _keywords_ (and afterwards filter further by
      fuzzy searching).
- [x] **Edit** the current entry by opening a _terminal-based editor_ at the
      specific line.
- [x] **Yank/Copy** the citekey of the current entry to the system clipboard.
- [x] **Open related PDF** file (`file` BibLaTeX key) with keypress.
- [x] **Open related URL/DOI** with keypress.
- [x] **Scrollbar** for better navigating.
- [x] **Sort Entries** by each column (`Authors`, `Title`, `Year`, `Pubtype`)
- [x] **Load multiple files** into one session.
- [ ] **Open related notes file** for specific entry.
- [ ] **Add Entry via DOI** as formatted code.
- [ ] **Implement config file** for setting some default values like main
      bibfile, PDF-opener, or editor
- [ ] **Support Hayagriva(`.yaml`)** format as input (_on hold for now_, because
      the Hayagriva Yaml style doesn't offer keywords; s. issue in
      [Hayagriva repo](https://github.com/typst/hayagriva/issues/240)).

**Please feel free to suggest further features through the issue
functionality.**

## Keybindings

Use the following keybindings to manage the TUI:

| Key                                    | Action                                                   |
| -------------------------------------- | -------------------------------------------------------- |
| `j`,`k` \| `Down`,`Up`                 | Move down/up by 1                                        |
| `Ctrl-d`,`Ctrl-u`                      | Move down/up by 5                                        |
| `g`,`G`                                | Go to first/last entry                                   |
| `h`,`k` \| `Left`,`Right`              | Select previous/next entry column                        |
| `s`                                    | Sort current column (toggles)                            |
| `PageDown`,`PageUp` \| `Alt-j`,`Alt-k` | Scroll Info window                                       |
| `y`                                    | Yank/copy citekey of selected entry                      |
| `e`                                    | Open editor at selected entry                            |
| `o`                                    | Open related PDF or URL/DOI                              |
| `TAB`                                  | Switch between entries and keywords                      |
| `/`,`Ctrl-f`                           | Enter search mode                                        |
| `Enter`                                | Filter by selected keyword / Confirm search or selection |
| `ESC`                                  | Abort search / Reset current list                        |
| `q`,`Ctrl-c`                           | Quit TUI                                                 |

## Search

The search mode uses the `nucleo-matcher` crate. Thus, _fuzzy searching_ is
enabled by default. You can use some special chars to alter pattern matching:

- `^...` matches literally at beginning of the string.
- `...$` matches literally at end of the string.
- `'...` matches literally everywhere in string.

## Edit bib entry

For now, the TUI only supports editors set through the environment variables
`VISUAL` and `EDITOR` in this order. The fallback solution is `vi`.

I've tested the following editors (set as value of `VISUAL`):

- [x] **Helix**: `export VISUAL="hx"`
- [x] **Vim/Neovim**: `export VISUAL="vim/nvim"`
- [x] **Emacs (Terminal)**: `export VISUAL="emacs -nw"`
- [x] **Nano**: `export VISUAL="nano"`
- [x] **Emacs (GUI)**: `export VISUAL="emacs"` (open emacs in separate window,
      blocks the terminal running `bibiman` as long as emacs is opened)

Feel free to try other editors and report. Important is that the editor supports
the argument `+..` to set the line number that the cursor should be placed at.
Otherwise, the functionality might not work properly.

While this behaviour is most likely supported on UNIX-based systems (Linux,
MacOS), it might not work under Windows. I can't test it on a Windows machine,
thus, there might be unexpected errors with it.

## Open connected files or links

Now, `bibiman` also provides the possibility to open PDFs (as value of the
`file` BibLaTeX field), as well as DOIs and URLs.

For selecting the right program, it uses `xdg-open` on Linux, `open` on MacOS,
and `start` on Windows. Thanks to the report from @bastislack in #2 MacOS seems
to work.

_However, Windows does not work. Have to figure this out. Reports from some
Windows users are very welcome._

Furthermore, DOIs have to begin with either `https://doi...` as full URL or
`10.(...)` as regular DOI style. URLs work if they begin with either `http...`
or with `www...`.

## Issues and code improvement

This is my first Rust project and, thus, also a learning process. If you find
any issues or code flaws, please open an issue.

## Alternatives

`bibiman` is a project tailored to my personal needs. I use a single main file
for all my bib entries and want to use `bibiman` mainly as kind of
(terminal)-graphical wrapper for often emerging tasks, since I work in the
terminal most of the time.

I used `JabRef` for many years, but its way to bloated in my eyes. There exists
a bunch of other graphical tools...

But there are also some TUI alternatives with slightly different approaches.
Maybe one of these might fit _your_ personal needs better:

- [bibman (Haskell)](https://codeberg.org/KMIJPH/bibman): A very nice CLI
  program including a TUI I also used for some times. It has way more CLI
  features (export etc.) at the moment. The main difference is that its based on
  a multi file approach. If you also use a separate file per entry, look there!
- [bibman (Python)](https://github.com/ductri/bibman): A TUI written in Python
  with focus on Zotero-like functions. If you're used to Zotero, this might be a
  good fit.
- [bibman (Perl)](https://github.com/maciejjan/bibman): A fast and simple TUI
  written in good ol' Perl. It looks like back in the days, but seems not being
  maintained anymore.
- [cobib](https://github.com/mrossinek/cobib): Very elaborated bib manager with
  CLI and TUI functions.
- [papis](https://github.com/papis/papis): Powerful CLI tool for managing
  bibliographies and documents. Has also some TUI features.