mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 03:41:27 +00:00
Plugin finder: run custom find/fd/grep/rg/fzf and list
This commit is contained in:
parent
ebb6f153b5
commit
af71d470f5
|
@ -31,7 +31,7 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
|
||||||
- Edit and preview markdown, man page, html
|
- Edit and preview markdown, man page, html
|
||||||
- Open a file and auto-advance to the next
|
- Open a file and auto-advance to the next
|
||||||
- Export (filtered) list of visible files
|
- Export (filtered) list of visible files
|
||||||
- Find files by mime-type and list in `nnn`
|
- Find and list in `nnn` from `nnn`
|
||||||
- Unlimited bookmarks, plugins, commands with custom hotkeys
|
- Unlimited bookmarks, plugins, commands with custom hotkeys
|
||||||
- Write a plugin in any language you know
|
- Write a plugin in any language you know
|
||||||
- Configure the middle mouse click to do anything
|
- Configure the middle mouse click to do anything
|
||||||
|
|
|
@ -32,6 +32,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
|
||||||
| chksum | Create and verify checksums | sh | md5sum,<br>sha256sum |
|
| chksum | Create and verify checksums | sh | md5sum,<br>sha256sum |
|
||||||
| diffs | Diff for selection (limited to 2 for directories) | sh | vimdiff |
|
| diffs | Diff for selection (limited to 2 for directories) | sh | vimdiff |
|
||||||
| dragdrop | Drag/drop files from/into nnn | sh | [dragon](https://github.com/mwh/dragon) |
|
| dragdrop | Drag/drop files from/into nnn | sh | [dragon](https://github.com/mwh/dragon) |
|
||||||
|
| finder | Run custom find command and list | sh | - |
|
||||||
| fzcd | Change to the directory of a fuzzy-selected file/dir | sh | fzf/fzy<br>fd/fdfind/find |
|
| fzcd | Change to the directory of a fuzzy-selected file/dir | sh | fzf/fzy<br>fd/fdfind/find |
|
||||||
| fzhist | Fuzzy-select a cmd from history, edit in `$EDITOR` and run | sh | fzf/fzy |
|
| fzhist | Fuzzy-select a cmd from history, edit in `$EDITOR` and run | sh | fzf/fzy |
|
||||||
| fzopen | Fuzzy find a file in dir subtree and edit or open | sh | fzf/fzy, xdg-open |
|
| fzopen | Fuzzy find a file in dir subtree and edit or open | sh | fzf/fzy, xdg-open |
|
||||||
|
@ -172,7 +173,7 @@ The `ctxcode` indicates the context to change the active directory of.
|
||||||
|:---:| --- |
|
|:---:| --- |
|
||||||
| `1`-`4` | context number |
|
| `1`-`4` | context number |
|
||||||
| `0` | current context |
|
| `0` | current context |
|
||||||
| `+` | next inactive context or current (if all active) |
|
| `+` | smart context (next inactive else current) |
|
||||||
|
|
||||||
The `opcode` indicates the operation type.
|
The `opcode` indicates the operation type.
|
||||||
|
|
||||||
|
|
28
plugins/finder
Executable file
28
plugins/finder
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Description: Run custom search and list results in smart context
|
||||||
|
#
|
||||||
|
# Note: To enable multi select in fzf, export the following:
|
||||||
|
# - export FZF_DEFAULT_OPTS='--bind ctrl-a:select-all,ctrl-d:deselect-all'
|
||||||
|
#
|
||||||
|
# Shell: POSIX compliant
|
||||||
|
# Author: Arun Prakash jana
|
||||||
|
|
||||||
|
. "$(dirname "$0")"/.nnn-plugin-helper
|
||||||
|
|
||||||
|
printf "Examples:\n"
|
||||||
|
printf " find . -name \"pattern*\" -print0\n"
|
||||||
|
printf " fd pattern -0\n"
|
||||||
|
printf " find -maxdepth 1 -size +100M -print0\n"
|
||||||
|
printf " fd -d 2 -S +100M -0\n"
|
||||||
|
printf " grep -rlZ pattern\n"
|
||||||
|
printf " rg -l0 pattern\n"
|
||||||
|
printf " fzf -m | tr %s %s\n\n" "'\n'" "'\0'"
|
||||||
|
|
||||||
|
printf "cmd: "
|
||||||
|
read -r cmd
|
||||||
|
|
||||||
|
if ! [ -z "$cmd" ]; then
|
||||||
|
printf "%s" "+l" > "$NNN_PIPE"
|
||||||
|
eval "$cmd" > "$NNN_PIPE"
|
||||||
|
fi
|
Loading…
Reference in a new issue