rufio 1.5.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -0
- data/README.md +18 -6
- data/README_ja.md +18 -6
- data/Rakefile +5 -0
- data/SECURITY.md +16 -8
- data/docs/csv_cell_preview_design_ja.md +682 -0
- data/docs/guide.md +115 -20
- data/docs/guide_ja.md +116 -21
- data/docs/image_preview_design_ja.md +335 -0
- data/docs/native_fuzzy_search_design_ja.md +684 -0
- data/examples/config.rb +23 -0
- data/info/help.md +32 -18
- data/info/keybindings.md +43 -11
- data/info/welcome.md +4 -6
- data/lib/rufio/background_status.rb +7 -0
- data/lib/rufio/bookmark_controller.rb +0 -45
- data/lib/rufio/clipboard.rb +162 -0
- data/lib/rufio/command_locator.rb +49 -0
- data/lib/rufio/config.rb +7 -4
- data/lib/rufio/config_loader.rb +66 -11
- data/lib/rufio/csv_table_source.rb +125 -0
- data/lib/rufio/encoding_detector.rb +152 -0
- data/lib/rufio/file_operation_controller.rb +41 -0
- data/lib/rufio/file_preview.rb +92 -19
- data/lib/rufio/fuzzy_candidate_block.rb +131 -0
- data/lib/rufio/fuzzy_file_source.rb +180 -0
- data/lib/rufio/fuzzy_search.rb +327 -0
- data/lib/rufio/fuzzy_search_session.rb +426 -0
- data/lib/rufio/graphics_layer.rb +223 -0
- data/lib/rufio/health_checker.rb +27 -32
- data/lib/rufio/help_menu.rb +16 -10
- data/lib/rufio/image_preview_view.rb +421 -0
- data/lib/rufio/image_source.rb +158 -0
- data/lib/rufio/keybind_handler.rb +21 -34
- data/lib/rufio/kitty_graphics.rb +128 -0
- data/lib/rufio/native/aarch64-linux-gnu/librufio_zig.so +0 -0
- data/lib/rufio/native/aarch64-linux-musl/librufio_zig.so +0 -0
- data/lib/rufio/native/aarch64-macos/librufio_zig.dylib +0 -0
- data/lib/rufio/native/aarch64-windows/rufio_zig.dll +0 -0
- data/lib/rufio/native/x86_64-linux-gnu/librufio_zig.so +0 -0
- data/lib/rufio/native/x86_64-linux-musl/librufio_zig.so +0 -0
- data/lib/rufio/native/x86_64-macos/librufio_zig.dylib +0 -0
- data/lib/rufio/native/x86_64-windows/rufio_zig.dll +0 -0
- data/lib/rufio/native_content_search.rb +44 -8
- data/lib/rufio/native_image.rb +177 -0
- data/lib/rufio/native_scanner_zig.rb +39 -0
- data/lib/rufio/navigation_controller.rb +47 -16
- data/lib/rufio/preview_registry.rb +86 -0
- data/lib/rufio/preview_view.rb +363 -0
- data/lib/rufio/renderer.rb +8 -8
- data/lib/rufio/screen.rb +38 -1
- data/lib/rufio/search_prompt.rb +50 -0
- data/lib/rufio/search_screen.rb +680 -0
- data/lib/rufio/sheet_picker.rb +87 -0
- data/lib/rufio/sqlite_table_source.rb +205 -0
- data/lib/rufio/tab_mode_manager.rb +1 -3
- data/lib/rufio/table_cursor.rb +117 -0
- data/lib/rufio/table_document.rb +261 -0
- data/lib/rufio/table_layout.rb +231 -0
- data/lib/rufio/table_preview_view.rb +376 -0
- data/lib/rufio/table_query.rb +240 -0
- data/lib/rufio/table_source.rb +46 -0
- data/lib/rufio/terminal_graphics.rb +168 -0
- data/lib/rufio/terminal_ui.rb +74 -60
- data/lib/rufio/text_utils.rb +27 -0
- data/lib/rufio/ui_renderer.rb +380 -17
- data/lib/rufio/version.rb +1 -1
- data/lib/rufio/xlsx_table_source.rb +112 -0
- data/lib/rufio.rb +21 -1
- data/lib_zig/rufio_native/Makefile +21 -5
- data/lib_zig/rufio_native/build.zig +18 -0
- data/lib_zig/rufio_native/src/fuzzy.zig +520 -0
- data/lib_zig/rufio_native/src/fuzzy_test.zig +212 -0
- data/lib_zig/rufio_native/src/image.zig +525 -0
- data/lib_zig/rufio_native/src/image_bmp.zig +111 -0
- data/lib_zig/rufio_native/src/image_jpeg.zig +878 -0
- data/lib_zig/rufio_native/src/image_png.zig +561 -0
- data/lib_zig/rufio_native/src/image_resize.zig +170 -0
- data/lib_zig/rufio_native/src/image_test.zig +401 -0
- data/lib_zig/rufio_native/src/main.zig +28 -0
- data/lib_zig/rufio_native/src/search.zig +260 -64
- data/lib_zig/rufio_native/src/search_test.zig +35 -0
- data/lib_zig/rufio_native/src/testdata/alpha.png +0 -0
- data/lib_zig/rufio_native/src/testdata/gradient.bmp +0 -0
- data/lib_zig/rufio_native/src/testdata/gradient.jpg +0 -0
- data/lib_zig/rufio_native/src/testdata/gradient.png +0 -0
- data/retag.sh +4 -4
- metadata +44 -5
- data/lib/rufio/global_search.rb +0 -412
- data/lib/rufio/search_controller.rb +0 -92
- data/lib_zig/rufio_native/src/main.zig.sync +0 -205
data/docs/guide.md
CHANGED
|
@@ -13,7 +13,7 @@ Inside rufio, press `?` to open the help menu at any time.
|
|
|
13
13
|
- [File Operations](#file-operations)
|
|
14
14
|
- [ZIP Archives](#zip-archives)
|
|
15
15
|
- [Filter and Search](#filter-and-search)
|
|
16
|
-
- [
|
|
16
|
+
- [Search Screen (`/` in the file list)](#search-screen--in-the-file-list)
|
|
17
17
|
- [Bookmarks and History](#bookmarks-and-history)
|
|
18
18
|
- [Command Mode](#command-mode)
|
|
19
19
|
- [Scripts](#scripts)
|
|
@@ -69,8 +69,95 @@ The right pane previews the selected file. Code is highlighted when `bat` is ins
|
|
|
69
69
|
| `P` | Fullscreen preview (hides the file list) |
|
|
70
70
|
| `j` / `k` | Scroll |
|
|
71
71
|
| `Ctrl+D` / `Ctrl+U` | Page down / up |
|
|
72
|
+
| `y` | Copy the file path to the clipboard |
|
|
72
73
|
| `ESC` | Back to the file list |
|
|
73
74
|
|
|
75
|
+
### Images
|
|
76
|
+
|
|
77
|
+
Images (`.png`, `.jpg`, `.gif`, `.bmp`) are drawn in the preview pane by the terminal itself, using the Kitty graphics protocol. kitty, Ghostty, WezTerm and Konsole support it; rufio asks the terminal once at startup and silently falls back when the answer is no.
|
|
78
|
+
|
|
79
|
+
| Situation | What you see |
|
|
80
|
+
|-----------|--------------|
|
|
81
|
+
| Supported terminal, `.png` / `.jpg` / `.bmp` up to 32 MiB | The picture, fitted to the pane (split view and `P` both work) |
|
|
82
|
+
| No native library (or `RUFIO_NATIVE_IMAGE=0`), PNG up to 8 MiB | The picture, sent as-is and scaled by the terminal |
|
|
83
|
+
| `.gif`, progressive JPEG, interlaced PNG | Format, pixel size and file size as text |
|
|
84
|
+
| Unsupported terminal, or inside tmux | The same text |
|
|
85
|
+
|
|
86
|
+
The bundled native library (Zig, no third-party image code) decodes the image, scales it down to the pane's real pixel size and re-encodes it as PNG before sending, so a 12 MP photo reaches the terminal as a few hundred KB in about 30 ms, off the main loop. While it works the pane shows `decoding...`.
|
|
87
|
+
|
|
88
|
+
In preview mode (`P`) the picture can be zoomed:
|
|
89
|
+
|
|
90
|
+
| Key | Action |
|
|
91
|
+
|-----|--------|
|
|
92
|
+
| `+` / `-` | Zoom in 25% steps, up to 4x (the terminal is asked for part of the picture, so nothing is decoded here) |
|
|
93
|
+
| `0` | Fit the picture to the pane |
|
|
94
|
+
| `h` / `j` / `k` / `l` or arrows | Move around the picture while zoomed |
|
|
95
|
+
|
|
96
|
+
The cells behind a picture are kept blank so the file list and the status line stay readable, and the picture is removed when you select another file, open the help menu, the search screen or command mode, and when rufio exits. Moving to another file removes the picture immediately and sends the new one about 80 ms later, so holding `j` through a folder of images does not flood the terminal; a picture that was painted over (by a notification, say) is put back; and a file you come back to is not read or encoded again. `RUFIO_IMAGE_PREVIEW=0` turns images off entirely. The design and the remaining phases are in [image_preview_design_ja.md](./image_preview_design_ja.md).
|
|
97
|
+
|
|
98
|
+
### Searching inside a preview (`/`)
|
|
99
|
+
|
|
100
|
+
`/` in a preview searches the previewed file. Type to jump to the first match from where you are, `Enter` keeps the search, `n` and `N` move to the next and previous match (wrapping around), and `ESC` clears it (a second `ESC` leaves the preview). Every match is highlighted and the current one is drawn in a different colour. Preview mode reads up to 20,000 lines of the first 64 KiB of the file, so the search covers what the preview can show.
|
|
101
|
+
|
|
102
|
+
### Tables as a Grid
|
|
103
|
+
|
|
104
|
+
`.csv`, `.tsv`, `.tab`, `.xlsx`, `.xlsm` and `.ods` files, and SQLite databases when the `sqlite3` command is installed, are shown as rows and columns:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
sales.csv [PREVIEW MODE]
|
|
108
|
+
R3C2 price | hjkl: move y: copy ESC: back
|
|
109
|
+
| A name | B price | C stock |
|
|
110
|
+
1 | apple | 120 | 30 |
|
|
111
|
+
2 | mikan | 150 | 8 |
|
|
112
|
+
3 | banana | 80 | 12 |
|
|
113
|
+
3 rows 3 cols
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Column letters sit beside the header names, the header row stays in place while you scroll, and the last line reports the row and column counts, the character encoding that was detected, any limit that was reached and how many columns do not fit the pane.
|
|
117
|
+
|
|
118
|
+
In preview mode the cell cursor moves:
|
|
119
|
+
|
|
120
|
+
| Key | Action |
|
|
121
|
+
|-----|--------|
|
|
122
|
+
| `h` / `j` / `k` / `l` or arrows | Move the cell cursor (the grid scrolls in both directions to follow it) |
|
|
123
|
+
| `Ctrl+D` / `Ctrl+U` | Move one screen of rows |
|
|
124
|
+
| `g` / `}` | First / last row |
|
|
125
|
+
| `0` / `$` | First / last column |
|
|
126
|
+
| `Space` | Select / unselect the column under the cursor |
|
|
127
|
+
| `/` | Filter the rows (see below) |
|
|
128
|
+
| `y` | Copy the cell under the cursor, or the cursor row's selected columns joined with commas |
|
|
129
|
+
| `Y` | Copy the whole row as one CSV line |
|
|
130
|
+
| `[` / `]` | Previous / next sheet, for a workbook's sheets or a database's tables |
|
|
131
|
+
| `t` | Open the list of sheets or tables (`j`/`k` to move, `Enter` to open, `ESC` to close) |
|
|
132
|
+
| `ESC` | Back to the file list |
|
|
133
|
+
|
|
134
|
+
`Space` marks the column under the cursor the way a selected file is marked, and the line under the file name lists the selection (`cols A,C`). With columns selected, `y` copies the cursor row's cells from those columns, in column order, joined with commas as one CSV line (`apple,30`), so a cell holding a comma or a newline is quoted. `Y` still copies the whole row, and switching sheets clears the selection.
|
|
135
|
+
|
|
136
|
+
### Filtering rows (`/`)
|
|
137
|
+
|
|
138
|
+
`/` in a table preview filters its rows. Write conditions separated by commas:
|
|
139
|
+
|
|
140
|
+
| Input | Means |
|
|
141
|
+
|-------|-------|
|
|
142
|
+
| `price > 100` | A comparison (`=`, `!=`, `<>`, `>`, `>=`, `<`, `<=`); numeric when both sides are numbers |
|
|
143
|
+
| `name a%` | `LIKE 'a%'`: `%` is any text, `_` is one character |
|
|
144
|
+
| `name apple` | `LIKE '%apple%'`: matches anywhere in the column |
|
|
145
|
+
| `note "red, sweet"` | Quote a value to keep its commas and spaces |
|
|
146
|
+
| `apple` | No column named: searched in every column |
|
|
147
|
+
| `price > 100, name a%` | Several conditions, all of which must match |
|
|
148
|
+
|
|
149
|
+
Column names ignore case and the column letters (`A`, `B`, …) work too. `Enter` applies the filter, and the line under the file name shows it (`filter: price > 100 (2 rows)`). `ESC` clears the filter; a second `ESC` leaves the preview. Switching sheets clears it as well.
|
|
150
|
+
|
|
151
|
+
For a SQLite table the conditions become a read-only `SELECT ... WHERE` run inside the database, so the filter finds rows past the preview's row limit. Values are always passed as quoted literals and the column names are resolved against the table's own columns, so the input cannot become SQL of its own. A spreadsheet or CSV is filtered in Ruby over the rows that were read.
|
|
152
|
+
|
|
153
|
+
`t` lists a workbook's sheets or a database's tables, with `>` beside the one on screen; `Ctrl+D`/`Ctrl+U` page through a long list and `g`/`}` jump to its first and last entry. A file with a single sheet has no list.
|
|
154
|
+
|
|
155
|
+
Cell movement follows your `move_up` / `move_down` / `navigate_parent` / `navigate_enter` keybinds, so rebinding `hjkl` applies here too.
|
|
156
|
+
|
|
157
|
+
UTF-8, UTF-16 (with a BOM), CP932 and EUC-JP are decoded automatically, so a Shift_JIS CSV reads as text rather than replacement characters. A `.csv` or `.tsv` is read up to 512 KiB and 1000 rows; only the sheet on screen is read, so a workbook's other sheets and a database's other tables cost nothing until you switch to them. A spreadsheet over 10 MiB, or one that cannot be parsed, falls back to the ZIP entry list.
|
|
158
|
+
|
|
159
|
+
Copying uses `pbcopy`, `clip`, `wl-copy`, `xclip` or `xsel` when one is available, and OSC 52 otherwise, which works over SSH if your terminal supports it (in tmux, also `set -g set-clipboard on`). `CLIPBOARD_COMMAND` in `config.rb` sets a command of your own, and `rufio -c` reports which one is used. `TABLE_PREVIEW` changes the limits and the header, delimiter and encoding handling.
|
|
160
|
+
|
|
74
161
|
## File Operations
|
|
75
162
|
|
|
76
163
|
| Key | Action |
|
|
@@ -107,26 +194,34 @@ With nothing selected, `z` opens zoxide history instead.
|
|
|
107
194
|
| Key | Action |
|
|
108
195
|
|-----|--------|
|
|
109
196
|
| `f` | Filter the current list as you type (`Enter` keeps the filter, `ESC` clears it) |
|
|
110
|
-
|
|
|
111
|
-
| `F` | Search file contents with rga |
|
|
112
|
-
| `G` | Global search across all bookmarks (no external tools needed) |
|
|
197
|
+
| `/` | Search, scoped to where you are |
|
|
113
198
|
|
|
114
|
-
|
|
199
|
+
`/` is the only search key, and what it searches depends on the mode:
|
|
115
200
|
|
|
116
|
-
|
|
201
|
+
| Where you press `/` | What it searches |
|
|
202
|
+
|---------------------|------------------|
|
|
203
|
+
| The file list | Every file under the current directory: names (fuzzy) or contents (literal) |
|
|
204
|
+
| A preview (`P`) | Inside the previewed file |
|
|
205
|
+
| A table preview | Filters the rows of the sheet or table on screen |
|
|
206
|
+
|
|
207
|
+
## Search Screen (`/` in the file list)
|
|
208
|
+
|
|
209
|
+
`/` searches recursively under the current directory; bookmarks are not searched. File names are matched with fuzzy matching (best matches first, matched characters highlighted, filtered in the background); content search stays literal and case-insensitive. Hidden files and links to regular files are included, and results appear while the tree is still being scanned.
|
|
117
210
|
|
|
118
211
|
| Key | Action |
|
|
119
212
|
|-----|--------|
|
|
120
|
-
| Type | Literal, case-insensitive search |
|
|
213
|
+
| Type | File names: fuzzy search. Content: Literal, case-insensitive search |
|
|
121
214
|
| `Tab` | Switch between **File names** and **Content** |
|
|
122
215
|
| `Up` / `Down`, `Ctrl+J` / `Ctrl+K`, `Ctrl+N` / `Ctrl+P` | Select a result |
|
|
123
216
|
| `Enter` | Go to the file in Files mode |
|
|
124
217
|
| `Ctrl+U` | Clear the query |
|
|
125
|
-
| `ESC` | Return to
|
|
218
|
+
| `ESC` | Return to Files mode |
|
|
126
219
|
|
|
220
|
+
- Fuzzy matching means the query characters must appear in order but need not be adjacent (`sctrl` finds `search_controller.rb`). ASCII letters ignore case and Japanese text is matched as is.
|
|
127
221
|
- Matches are highlighted. Content results show the file, line number and matching text.
|
|
128
222
|
- A yellow `Searching...` indicator animates while scanning and turns into a green `Search complete` when done.
|
|
129
223
|
- Inaccessible directories and directory symlinks are skipped. Plain text is read as UTF-8, and files with NUL bytes in the first 8 KB are treated as binary.
|
|
224
|
+
- The matching uses the bundled Zig library when available and falls back to Ruby otherwise (`RUFIO_NATIVE_FUZZY=0` forces Ruby).
|
|
130
225
|
|
|
131
226
|
### Documents
|
|
132
227
|
|
|
@@ -145,7 +240,7 @@ Extracted text is cached in memory (up to 64 documents, about 16 MiB) and re-ext
|
|
|
145
240
|
Add this to `~/.config/rufio/config.rb` and restart rufio. It applies to both file names and contents:
|
|
146
241
|
|
|
147
242
|
```ruby
|
|
148
|
-
|
|
243
|
+
SEARCH_EXCLUDED_EXTENSIONS = %w[.png .jpg .zip .tar.gz .log /.git /node_modules /.DS_Store].freeze
|
|
149
244
|
```
|
|
150
245
|
|
|
151
246
|
Extensions ignore case, the leading dot is optional, and the default `[]` excludes nothing. An entry starting with `/` is a name: a directory with that name is skipped with everything under it, and a file with exactly that name is skipped.
|
|
@@ -157,7 +252,6 @@ Extensions ignore case, the leading dot is optional, and the default `[]` exclud
|
|
|
157
252
|
| `b` | Bookmark the current directory |
|
|
158
253
|
| `B` | Bookmark menu |
|
|
159
254
|
| `1`–`9` | Jump to bookmark 1–9 |
|
|
160
|
-
| `Tab` / `Shift+Tab` | Next / previous bookmark (Files and Config modes) |
|
|
161
255
|
| `z` | zoxide history (when nothing is selected) |
|
|
162
256
|
|
|
163
257
|
The `B` menu has four items:
|
|
@@ -323,19 +417,23 @@ APPLICATIONS = {
|
|
|
323
417
|
:default => 'open'
|
|
324
418
|
}.freeze
|
|
325
419
|
|
|
326
|
-
# Extensions (and /names of directories or files) excluded from
|
|
327
|
-
|
|
420
|
+
# Extensions (and /names of directories or files) excluded from the / search
|
|
421
|
+
SEARCH_EXCLUDED_EXTENSIONS = %w[.log /node_modules].freeze
|
|
328
422
|
```
|
|
329
423
|
|
|
424
|
+
The older name `GLOBAL_SEARCH_EXCLUDED_EXTENSIONS` is still read if `SEARCH_EXCLUDED_EXTENSIONS` is not set.
|
|
425
|
+
|
|
330
426
|
Action names for `KEYBINDS`:
|
|
331
427
|
|
|
332
428
|
| Group | Actions (default key) |
|
|
333
429
|
|-------|-----------------------|
|
|
334
430
|
| Navigation | `move_up` (k), `move_down` (j), `navigate_parent` (h), `navigate_enter` (l), `top` (g), `bottom` (}), `refresh` (R) |
|
|
335
431
|
| Files | `open_file` (o), `preview` (P), `rename` (r), `delete` (d), `create_file` (a), `create_dir` (A), `move_selected` (m), `copy_selected` (c), `delete_selected` (x), `open_explorer` (e) |
|
|
336
|
-
| Selection and search | `select` (Space), `filter` (f), `
|
|
432
|
+
| Selection and search | `select` (Space), `filter` (f), `search` (/) |
|
|
337
433
|
| Bookmarks | `add_bookmark` (b), `bookmark_menu` (B), `zoxide` (z), `start_dir` (0) |
|
|
338
|
-
| Modes | `job_mode` (J), `
|
|
434
|
+
| Modes | `job_mode` (J), `config_mode` (C), `help` (?), `log_viewer` (L), `command_mode` (:), `quit` (q), `quit_cd` (T) |
|
|
435
|
+
|
|
436
|
+
The former names `fzf_search`, `fzf_search_alt`, `file_search`, `file_search_alt`, `rga_search` and `global_search` are all accepted as aliases of `search`.
|
|
339
437
|
|
|
340
438
|
### script_paths.yml and bookmarks.yml
|
|
341
439
|
|
|
@@ -370,18 +468,15 @@ All tools are optional. Without them, rufio disables the feature or falls back t
|
|
|
370
468
|
|
|
371
469
|
| Tool | Used for | Key |
|
|
372
470
|
|------|----------|-----|
|
|
373
|
-
| fzf | File name search | `s`, `/` |
|
|
374
|
-
| rga | File content search | `F` |
|
|
375
471
|
| zoxide | Directory history | `z` |
|
|
376
472
|
| bat | Syntax highlighting in the preview | — |
|
|
377
473
|
|
|
378
474
|
```bash
|
|
379
475
|
# macOS
|
|
380
|
-
brew install
|
|
476
|
+
brew install bat zoxide
|
|
381
477
|
|
|
382
478
|
# Ubuntu/Debian
|
|
383
|
-
apt install
|
|
384
|
-
# rga: https://github.com/phiresky/ripgrep-all
|
|
479
|
+
apt install bat zoxide
|
|
385
480
|
```
|
|
386
481
|
|
|
387
482
|
## Command-line Options
|
|
@@ -401,7 +496,7 @@ rufio -h # Help
|
|
|
401
496
|
|
|
402
497
|
The gem bundles a Zig library for macOS (arm64/x86_64), Linux (x86_64/aarch64, glibc 2.17+ or musl) and Windows (x64/arm64). Other platforms use the Ruby implementation automatically.
|
|
403
498
|
|
|
404
|
-
- **
|
|
499
|
+
- **Content search**: parallel scanning with an in-memory file cache. Repeated searches are about 10x faster than `rg`. Queries with non-ASCII cased letters use the Ruby search. Set `RUFIO_NATIVE_SEARCH=0` to disable it.
|
|
405
500
|
- **ZIP**: decompresses entries and compresses files of 1 MiB or more in parallel (about 4.6x faster to compress and 3.2x faster to extract than Ruby on 8 × 64 MB files with 4 CPUs). Archive validation always stays in Ruby. Set `RUFIO_NATIVE_ZIP=0` to disable it.
|
|
406
501
|
|
|
407
502
|
To rebuild the bundled binaries (requires Zig 0.17):
|
data/docs/guide_ja.md
CHANGED
|
@@ -13,7 +13,7 @@ rufio の中ではいつでも `?` でヘルプメニューを開けます。
|
|
|
13
13
|
- [ファイル操作](#ファイル操作)
|
|
14
14
|
- [ZIP の展開・圧縮](#zip-の展開圧縮)
|
|
15
15
|
- [フィルターと検索](#フィルターと検索)
|
|
16
|
-
- [
|
|
16
|
+
- [検索画面(ファイル一覧の `/`)](#検索画面ファイル一覧の-)
|
|
17
17
|
- [ブックマークと履歴](#ブックマークと履歴)
|
|
18
18
|
- [コマンドモード](#コマンドモード)
|
|
19
19
|
- [スクリプト](#スクリプト)
|
|
@@ -69,8 +69,95 @@ Files モードでは、最上段に現在のパス、その下にブックマ
|
|
|
69
69
|
| `P` | 全画面プレビュー(ファイル一覧を隠す) |
|
|
70
70
|
| `j` / `k` | スクロール |
|
|
71
71
|
| `Ctrl+D` / `Ctrl+U` | 1 ページ下 / 上 |
|
|
72
|
+
| `y` | ファイルパスをクリップボードへコピー |
|
|
72
73
|
| `ESC` | ファイル一覧に戻る |
|
|
73
74
|
|
|
75
|
+
### 画像
|
|
76
|
+
|
|
77
|
+
画像(`.png` / `.jpg` / `.gif` / `.bmp`)は、Kitty グラフィックスプロトコルで端末に描かせます。kitty・Ghostty・WezTerm・Konsole が対応しており、起動時に 1 回だけ端末へ問い合わせて、対応していなければ黙ってテキスト表示に戻します。
|
|
78
|
+
|
|
79
|
+
| 状況 | 表示 |
|
|
80
|
+
|------|------|
|
|
81
|
+
| 対応端末・32 MiB までの `.png` / `.jpg` / `.bmp` | ペインに収めた画像(分割表示と `P` のどちらでも) |
|
|
82
|
+
| ネイティブライブラリが無い(または `RUFIO_NATIVE_IMAGE=0`)・8 MiB までの PNG | そのまま送り、端末側で拡縮 |
|
|
83
|
+
| `.gif`・プログレッシブ JPEG・インターレース PNG | 形式・寸法・ファイルサイズをテキストで表示 |
|
|
84
|
+
| 非対応端末・tmux の中 | 同じテキスト表示 |
|
|
85
|
+
|
|
86
|
+
同梱のネイティブライブラリ(Zig。第三者の画像コードは使っていません)が、画像をペインの実ピクセルまで縮小して PNG に符号化し直してから送ります。1200 万画素の写真でも数百 KB・約 30ms(メインループの外)で端末に届きます。処理中はペインに `decoding...` と出ます。
|
|
87
|
+
|
|
88
|
+
プレビューモード(`P`)では画像を拡大できます。
|
|
89
|
+
|
|
90
|
+
| キー | 操作 |
|
|
91
|
+
|------|------|
|
|
92
|
+
| `+` / `-` | 25% 刻みで拡大・縮小(最大 4 倍)。元画像の一部を端末に出してもらう方式なので、デコードは要りません |
|
|
93
|
+
| `0` | ペインに収める |
|
|
94
|
+
| `h` / `j` / `k` / `l` または矢印 | 拡大中の表示位置を動かす |
|
|
95
|
+
|
|
96
|
+
画像の下のセルは空白のまま確保するので、ファイル一覧やステータス行が読めなくなりません。別のファイルを選んだとき、ヘルプ・検索画面・コマンドモードを開いたとき、rufio を終了したときには画像を消します。別のファイルへ移るときは先に画像を消し、約 80ms 後に次を送るので、`j` を押し続けて画像のフォルダを辿っても転送が溢れません。通知などでセルが上書きされた画像は置き直し、一度見た画像に戻ったときは読み直しも符号化もしません。`RUFIO_IMAGE_PREVIEW=0` で画像表示を完全に無効化できます。設計と残りのフェーズは [image_preview_design_ja.md](./image_preview_design_ja.md) にあります。
|
|
97
|
+
|
|
98
|
+
### プレビュー内の検索(`/`)
|
|
99
|
+
|
|
100
|
+
プレビュー中の `/` は、そのファイルの中を検索します。入力すると現在位置以降の最初の一致へ飛び、`Enter` で確定、`n` / `N` で次 / 前の一致へ(端では反対側へ回ります)、`ESC` で解除します(もう一度押すとプレビューを抜けます)。一致箇所はハイライトされ、現在の一致だけ別の色で表示します。プレビューモードではファイルの先頭 64 KiB・最大 20,000 行を読み込むため、検索はその範囲が対象です。
|
|
101
|
+
|
|
102
|
+
### 表を行列で表示
|
|
103
|
+
|
|
104
|
+
`.csv` / `.tsv` / `.tab` / `.xlsx` / `.xlsm` / `.ods`、および `sqlite3` コマンドがある場合は SQLite のデータベースを、行と列で表示します。
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
sales.csv [PREVIEW MODE]
|
|
108
|
+
R3C2 price | hjkl: move y: copy ESC: back
|
|
109
|
+
| A name | B price | C stock |
|
|
110
|
+
1 | apple | 120 | 30 |
|
|
111
|
+
2 | みかん | 150 | 8 |
|
|
112
|
+
3 | banana | 80 | 12 |
|
|
113
|
+
3 rows 3 cols
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
見出しには列ラベル(A・B・C…)が付き、スクロール中もヘッダ行は固定されます。最下行には行数・列数・判定した文字コード・読み込み上限に達したか・ペインに収まらない列数が出ます。
|
|
117
|
+
|
|
118
|
+
プレビューモードではセルカーソルを動かせます。
|
|
119
|
+
|
|
120
|
+
| キー | 操作 |
|
|
121
|
+
|------|------|
|
|
122
|
+
| `h` / `j` / `k` / `l` または矢印 | セルを移動(カーソルに合わせて縦横にスクロール) |
|
|
123
|
+
| `Ctrl+D` / `Ctrl+U` | 1 画面分の行移動 |
|
|
124
|
+
| `g` / `}` | 先頭行 / 最終行 |
|
|
125
|
+
| `0` / `$` | 先頭列 / 最終列 |
|
|
126
|
+
| `Space` | カーソル位置のカラムを選択 / 解除 |
|
|
127
|
+
| `/` | 行を絞り込む(下記) |
|
|
128
|
+
| `y` | カーソル位置のセル、またはカーソル行の選択カラムをカンマ区切りでコピー |
|
|
129
|
+
| `Y` | 行全体を CSV の 1 行としてコピー |
|
|
130
|
+
| `[` / `]` | 前 / 次のシート(Excel のシート、SQLite のテーブル) |
|
|
131
|
+
| `t` | シート/テーブル一覧を開く(`j`/`k` で移動、`Enter` で開く、`ESC` で閉じる) |
|
|
132
|
+
| `ESC` | ファイル一覧に戻る |
|
|
133
|
+
|
|
134
|
+
`Space` でカーソル位置のカラムを選択すると、ファイル一覧の選択済みアイテムと同じ印が付き、ファイル名の下の行に選択中のカラム(`cols A,C`)が出ます。カラムを選んでいる状態で `y` を押すと、カーソル行のそのカラムのセルを列の順にカンマ区切りで連結して(`apple,30`)コピーします。カンマや改行を含むセルは CSV として読み戻せるようクォートします。`Y` は選択に関係なく行全体をコピーし、シートを切り替えると選択は解除されます。
|
|
135
|
+
|
|
136
|
+
### 行の絞り込み(`/`)
|
|
137
|
+
|
|
138
|
+
表プレビューの `/` は行を絞り込みます。条件はカンマ区切りで並べます。
|
|
139
|
+
|
|
140
|
+
| 入力 | 意味 |
|
|
141
|
+
|------|------|
|
|
142
|
+
| `price > 100` | 比較(`=`、`!=`、`<>`、`>`、`>=`、`<`、`<=`)。両辺が数値なら数値として比較 |
|
|
143
|
+
| `name a%` | `LIKE 'a%'`。`%` は任意の文字列、`_` は 1 文字 |
|
|
144
|
+
| `name apple` | `LIKE '%apple%'`。列のどこかに含まれれば一致 |
|
|
145
|
+
| `note "red, sweet"` | 引用符で囲むと、カンマや空白を含む値をそのまま渡せる |
|
|
146
|
+
| `apple` | 列を書かなければ全列が対象 |
|
|
147
|
+
| `price > 100, name a%` | 複数条件(すべて満たす行だけ残る) |
|
|
148
|
+
|
|
149
|
+
列名は大文字小文字を区別せず、列ラベル(`A`、`B`…)でも指定できます。`Enter` で適用すると、ファイル名の下の行に `filter: price > 100 (2 rows)` のように出ます。`ESC` で絞り込みを解除し、もう一度押すとプレビューを抜けます。シートを切り替えても解除されます。
|
|
150
|
+
|
|
151
|
+
SQLite のテーブルでは、条件を読み取り専用の `SELECT ... WHERE` に組み立ててデータベース側で実行するため、プレビューの読み込み上限より後ろの行も見つかります。値は必ず引用符付きのリテラルとして渡し、列名は実在する列に解決してから使うので、入力がそのまま SQL になることはありません。Excel や CSV は読み込み済みの行を Ruby 側で判定します。
|
|
152
|
+
|
|
153
|
+
`t` で Excel のシートや SQLite のテーブルの一覧を開けます。表示中のシートには `>` が付き、長い一覧は `Ctrl+D` / `Ctrl+U` でページ送り、`g` / `}` で先頭・末尾へ移動できます。シートが 1 枚だけのファイルには一覧がありません。
|
|
154
|
+
|
|
155
|
+
セル移動は `move_up` / `move_down` / `navigate_parent` / `navigate_enter` のキーバインド設定に従うため、`hjkl` を変更していればそれが反映されます。
|
|
156
|
+
|
|
157
|
+
UTF-8・UTF-16(BOM つき)・CP932・EUC-JP を自動判定するので、Shift_JIS の CSV も文字化けしません。`.csv` / `.tsv` は先頭 512 KiB・1000 行まで読み込みます。表示しているシートだけを読み込むため、Excel の他のシートや SQLite の他のテーブルは切り替えるまで読み込みません。10 MiB を超える表計算ファイルや、解析できないファイルは ZIP のエントリ一覧表示に戻ります。
|
|
158
|
+
|
|
159
|
+
コピーは `pbcopy` / `clip` / `wl-copy` / `xclip` / `xsel` があればそれを使い、無ければ OSC 52 を使います(SSH 越しでも端末が対応していれば動作。tmux では `set -g set-clipboard on` も必要)。`config.rb` の `CLIPBOARD_COMMAND` で任意のコマンドを指定でき、`rufio -c` でどれが使われるか確認できます。読み込み上限や区切り文字、ヘッダ行の扱い、文字コードは `TABLE_PREVIEW` で変更できます。
|
|
160
|
+
|
|
74
161
|
## ファイル操作
|
|
75
162
|
|
|
76
163
|
| キー | 操作 |
|
|
@@ -107,26 +194,34 @@ Files モードでは、最上段に現在のパス、その下にブックマ
|
|
|
107
194
|
| キー | 操作 |
|
|
108
195
|
|------|------|
|
|
109
196
|
| `f` | 入力に合わせて一覧を絞り込む(`Enter` で確定、`ESC` で解除) |
|
|
110
|
-
|
|
|
111
|
-
| `F` | rga でファイル内容検索 |
|
|
112
|
-
| `G` | 全ブックマークを横断検索(外部ツール不要) |
|
|
197
|
+
| `/` | 検索(いる場所によって対象が変わる) |
|
|
113
198
|
|
|
114
|
-
|
|
199
|
+
検索キーは `/` だけで、対象はモードによって変わります。
|
|
115
200
|
|
|
116
|
-
|
|
201
|
+
| `/` を押す場所 | 検索する対象 |
|
|
202
|
+
|----------------|--------------|
|
|
203
|
+
| ファイル一覧 | 現在のディレクトリ配下の全ファイル。ファイル名(あいまい)か内容(リテラル) |
|
|
204
|
+
| プレビュー(`P`) | プレビュー中のファイルの中 |
|
|
205
|
+
| 表プレビュー | 表示中のシート/テーブルの行を絞り込む |
|
|
206
|
+
|
|
207
|
+
## 検索画面(ファイル一覧の `/`)
|
|
208
|
+
|
|
209
|
+
`/` は現在のディレクトリ配下を再帰的に検索します(ブックマークは検索しません)。ファイル名はあいまい検索(よく一致したものから並び、一致文字をハイライト、絞り込みはバックグラウンド)で、内容検索は大文字小文字を区別しないリテラル検索です。隠しファイルと通常ファイルへのリンクも含め、走査しながら結果を表示します。
|
|
117
210
|
|
|
118
211
|
| キー | 操作 |
|
|
119
212
|
|------|------|
|
|
120
|
-
| 文字入力 |
|
|
213
|
+
| 文字入力 | ファイル名: あいまい検索。内容: 大文字・小文字を区別しないリテラル(部分一致)検索 |
|
|
121
214
|
| `Tab` | **File names(ファイル名)** と **Content(内容)** を切り替え |
|
|
122
215
|
| `↑` / `↓`、`Ctrl+J` / `Ctrl+K`、`Ctrl+N` / `Ctrl+P` | 結果を選択 |
|
|
123
216
|
| `Enter` | Files モードでそのファイルの場所へ移動 |
|
|
124
217
|
| `Ctrl+U` | 検索語をクリア |
|
|
125
|
-
| `ESC` |
|
|
218
|
+
| `ESC` | Files モードに戻る |
|
|
126
219
|
|
|
220
|
+
- あいまい検索は、文字が順番どおりに現れれば離れていても一致します(`sctrl` で `search_controller.rb` が見つかります)。ASCII の英字は大文字小文字を区別せず、日本語はそのまま照合します。
|
|
127
221
|
- 一致箇所はハイライトされます。内容検索ではファイル・行番号・一致した行を表示します。
|
|
128
222
|
- 検索中は黄色の `Searching...` が動き、完了すると緑の `Search complete` に変わります。
|
|
129
223
|
- アクセスできないディレクトリとディレクトリのシンボリックリンクはスキップします。通常のテキストは UTF-8 として読み、先頭 8 KB に NUL バイトがあるファイルはバイナリとして扱います。
|
|
224
|
+
- 照合には同梱の Zig ライブラリを使い、利用できない場合は Ruby 実装に切り替えます(`RUFIO_NATIVE_FUZZY=0` で Ruby を強制)。
|
|
130
225
|
|
|
131
226
|
### 文書の内容検索
|
|
132
227
|
|
|
@@ -145,7 +240,7 @@ Python・Microsoft Office・変換ツールなしで文書の中も検索でき
|
|
|
145
240
|
`~/.config/rufio/config.rb` に次を追加して rufio を再起動します。ファイル名・内容の両方に適用されます。
|
|
146
241
|
|
|
147
242
|
```ruby
|
|
148
|
-
|
|
243
|
+
SEARCH_EXCLUDED_EXTENSIONS = %w[.png .jpg .zip .tar.gz .log /.git /node_modules /.DS_Store].freeze
|
|
149
244
|
```
|
|
150
245
|
|
|
151
246
|
大文字・小文字は区別せず、先頭のドットは省略できます。デフォルトの `[]` は何も除外しません。`/` で始まる要素は名前の指定になり、その名前のディレクトリは配下ごと、名前が完全に一致するファイルは単体で除外します。
|
|
@@ -157,7 +252,6 @@ GLOBAL_SEARCH_EXCLUDED_EXTENSIONS = %w[.png .jpg .zip .tar.gz .log /.git /node_m
|
|
|
157
252
|
| `b` | 現在のディレクトリをブックマーク |
|
|
158
253
|
| `B` | ブックマークメニュー |
|
|
159
254
|
| `1`〜`9` | ブックマーク 1〜9 へ移動 |
|
|
160
|
-
| `Tab` / `Shift+Tab` | 次 / 前のブックマークへ(Files・Config モード) |
|
|
161
255
|
| `z` | zoxide 履歴(何も選択していないとき) |
|
|
162
256
|
|
|
163
257
|
`B` のメニュー:
|
|
@@ -314,7 +408,7 @@ COLORS = {
|
|
|
314
408
|
# キーの変更はアクション名で指定する。値は 1 キーの文字列
|
|
315
409
|
KEYBINDS = {
|
|
316
410
|
bottom: 'G',
|
|
317
|
-
|
|
411
|
+
search: 'S'
|
|
318
412
|
}.freeze
|
|
319
413
|
|
|
320
414
|
# `o` で使うアプリ(拡張子ごと)
|
|
@@ -323,19 +417,23 @@ APPLICATIONS = {
|
|
|
323
417
|
:default => 'open'
|
|
324
418
|
}.freeze
|
|
325
419
|
|
|
326
|
-
#
|
|
327
|
-
|
|
420
|
+
# `/` の検索から除外する拡張子(/ 始まりはディレクトリ・ファイル名)
|
|
421
|
+
SEARCH_EXCLUDED_EXTENSIONS = %w[.log /node_modules].freeze
|
|
328
422
|
```
|
|
329
423
|
|
|
424
|
+
`SEARCH_EXCLUDED_EXTENSIONS` を設定していない場合は、旧名の `GLOBAL_SEARCH_EXCLUDED_EXTENSIONS` も読み込みます。
|
|
425
|
+
|
|
330
426
|
`KEYBINDS` で使えるアクション名:
|
|
331
427
|
|
|
332
428
|
| 分類 | アクション(デフォルトキー) |
|
|
333
429
|
|------|------------------------------|
|
|
334
430
|
| 移動 | `move_up` (k), `move_down` (j), `navigate_parent` (h), `navigate_enter` (l), `top` (g), `bottom` (}), `refresh` (R) |
|
|
335
431
|
| ファイル | `open_file` (o), `preview` (P), `rename` (r), `delete` (d), `create_file` (a), `create_dir` (A), `move_selected` (m), `copy_selected` (c), `delete_selected` (x), `open_explorer` (e) |
|
|
336
|
-
| 選択・検索 | `select` (Space), `filter` (f), `
|
|
432
|
+
| 選択・検索 | `select` (Space), `filter` (f), `search` (/) |
|
|
337
433
|
| ブックマーク | `add_bookmark` (b), `bookmark_menu` (B), `zoxide` (z), `start_dir` (0) |
|
|
338
|
-
| モード | `job_mode` (J), `
|
|
434
|
+
| モード | `job_mode` (J), `config_mode` (C), `help` (?), `log_viewer` (L), `command_mode` (:), `quit` (q), `quit_cd` (T) |
|
|
435
|
+
|
|
436
|
+
以前のアクション名 `fzf_search`・`fzf_search_alt`・`file_search`・`file_search_alt`・`rga_search`・`global_search` は、いずれも `search` の別名として引き続き使えます。
|
|
339
437
|
|
|
340
438
|
### script_paths.yml と bookmarks.yml
|
|
341
439
|
|
|
@@ -370,18 +468,15 @@ script_paths:
|
|
|
370
468
|
|
|
371
469
|
| ツール | 用途 | キー |
|
|
372
470
|
|--------|------|------|
|
|
373
|
-
| fzf | ファイル名検索 | `s`、`/` |
|
|
374
|
-
| rga | ファイル内容検索 | `F` |
|
|
375
471
|
| zoxide | ディレクトリ履歴 | `z` |
|
|
376
472
|
| bat | プレビューのシンタックスハイライト | — |
|
|
377
473
|
|
|
378
474
|
```bash
|
|
379
475
|
# macOS
|
|
380
|
-
brew install
|
|
476
|
+
brew install bat zoxide
|
|
381
477
|
|
|
382
478
|
# Ubuntu/Debian
|
|
383
|
-
apt install
|
|
384
|
-
# rga: https://github.com/phiresky/ripgrep-all
|
|
479
|
+
apt install bat zoxide
|
|
385
480
|
```
|
|
386
481
|
|
|
387
482
|
## コマンドラインオプション
|
|
@@ -401,7 +496,7 @@ rufio -h # ヘルプ
|
|
|
401
496
|
|
|
402
497
|
gem には macOS(arm64/x86_64)、Linux(x86_64/aarch64、glibc 2.17 以降または musl)、Windows(x64/arm64)向けの Zig ライブラリが同梱されています。その他のプラットフォームでは自動的に Ruby 実装を使います。
|
|
403
498
|
|
|
404
|
-
-
|
|
499
|
+
- **内容検索**: 並列スキャンとメモリ上のファイルキャッシュで、再検索は `rg` の約 10 倍速くなります。大文字・小文字のある非 ASCII 文字を含む検索語は Ruby で検索します。`RUFIO_NATIVE_SEARCH=0` で無効化できます。
|
|
405
500
|
- **ZIP**: エントリの伸長と 1 MiB 以上のファイルの圧縮を並列に行います(4 CPU・64 MB × 8 ファイルの計測で、Ruby より圧縮が約 4.6 倍、展開が約 3.2 倍高速)。アーカイブの検証は常に Ruby 側で行います。`RUFIO_NATIVE_ZIP=0` で無効化できます。
|
|
406
501
|
|
|
407
502
|
同梱バイナリの再ビルド(Zig 0.17 が必要):
|