mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
Set hovered and file as
This commit is contained in:
parent
ca7405311f
commit
5d0af863b5
|
@ -58,6 +58,7 @@ Add to that an awesome [Wiki](https://github.com/jarun/nnn/wiki)!
|
||||||
- Copy (as), move (as), delete, archive, link selection
|
- Copy (as), move (as), delete, archive, link selection
|
||||||
- Create (with parents), rename, duplicate (anywhere) files and dirs
|
- Create (with parents), rename, duplicate (anywhere) files and dirs
|
||||||
- Spawn a shell, run apps, run commands, execute file
|
- Spawn a shell, run apps, run commands, execute file
|
||||||
|
- Hovered file set as `$nnn` at prompt and spawned shell
|
||||||
- Lock terminal (needs a locker)
|
- Lock terminal (needs a locker)
|
||||||
- Minimal deps, minimal config
|
- Minimal deps, minimal config
|
||||||
- Widely available
|
- Widely available
|
||||||
|
@ -147,7 +148,7 @@ There is no config file. Associated files are stored under `${XDG_CONFIG_HOME:-$
|
||||||
| Example `export` | Description |
|
| Example `export` | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | key-bookmark pairs [max 10] |
|
| `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | key-bookmark pairs [max 10] |
|
||||||
| `NNN_PLUG='m:nmount;t:imgthumb;x:_chmod +x $NNN'` | key-plugin (or cmd) pairs (<kbd>:key</kbd> to run) [max 15] |
|
| `NNN_PLUG='m:nmount;t:imgthumb;x:_chmod +x $nnn'` | key-plugin (or cmd) pairs (<kbd>:key</kbd> to run) [max 15] |
|
||||||
| `NNN_USE_EDITOR=1` | open text files in `$VISUAL` (else `$EDITOR`, fallback vi) |
|
| `NNN_USE_EDITOR=1` | open text files in `$VISUAL` (else `$EDITOR`, fallback vi) |
|
||||||
| `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] |
|
| `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] |
|
||||||
| `NNN_SSHFS_OPTS='sshfs -o reconnect,idmap=user'` | specify SSHFS options |
|
| `NNN_SSHFS_OPTS='sshfs -o reconnect,idmap=user'` | specify SSHFS options |
|
||||||
|
|
6
nnn.1
6
nnn.1
|
@ -192,11 +192,11 @@ when dealing with the !, e and p commands respectively. A single combination to
|
||||||
To assign keys to arbitrary non-background non-shell-interpreted cli
|
To assign keys to arbitrary non-background non-shell-interpreted cli
|
||||||
commands and invoke like plugins, add \fI_\fR (underscore) before the command.
|
commands and invoke like plugins, add \fI_\fR (underscore) before the command.
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
export NNN_PLUG='x:_chmod +x $NNN;g:_git log;s:_smplayer $NNN;o:fzopen'
|
export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn;o:fzopen'
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
1. Use single quotes for $NNN_PLUG so $NNN is not interpreted
|
1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
|
||||||
2. $NNN should be the last argument (IF you want to pass the hovered file name)
|
2. $nnn should be the last argument (IF you want to pass the hovered file name)
|
||||||
3. (Again) add \fI_\fR before the command
|
3. (Again) add \fI_\fR before the command
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -79,14 +79,14 @@ Now plugin `fzopen` can be run with the keybind <kbd>:o</kbd>, `mocplay` can be
|
||||||
|
|
||||||
To assign keys to arbitrary non-background cli commands (non-shell-interpreted) and invoke like plugins, add `_` (underscore) before the command. For example:
|
To assign keys to arbitrary non-background cli commands (non-shell-interpreted) and invoke like plugins, add `_` (underscore) before the command. For example:
|
||||||
|
|
||||||
export NNN_PLUG='x:_chmod +x $NNN;g:_git log;s:_smplayer $NNN;o:fzopen'
|
export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn;o:fzopen'
|
||||||
|
|
||||||
Now <kbd>:x</kbd> can be used to make a file executable, <kbd>:g</kbd> can be used to the git log of a git project directory, <kbd>:s</kbd> can be used to preview a partially downloaded media file.
|
Now <kbd>:x</kbd> can be used to make a file executable, <kbd>:g</kbd> can be used to the git log of a git project directory, <kbd>:s</kbd> can be used to preview a partially downloaded media file.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
1. Use single quotes for `$NNN_PLUG` so `$NNN` is not interpreted
|
1. Use single quotes for `$NNN_PLUG` so `$nnn` is not interpreted
|
||||||
2. `$NNN` should be the last argument (IF you want to pass the hovered file name)
|
2. `$nnn` should be the last argument (IF you want to pass the hovered file name)
|
||||||
3. (_Again_) add `_` before the command
|
3. (_Again_) add `_` before the command
|
||||||
|
|
||||||
## Access level of plugins
|
## Access level of plugins
|
||||||
|
|
|
@ -516,7 +516,7 @@ static const char * const envs[] = {
|
||||||
"VISUAL",
|
"VISUAL",
|
||||||
"EDITOR",
|
"EDITOR",
|
||||||
"PAGER",
|
"PAGER",
|
||||||
"NNN",
|
"nnn",
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -5086,9 +5086,9 @@ nochange:
|
||||||
|
|
||||||
if (tmp[0] == '_' && tmp[1]) {
|
if (tmp[0] == '_' && tmp[1]) {
|
||||||
xstrlcpy(newpath, ++tmp, PATH_MAX);
|
xstrlcpy(newpath, ++tmp, PATH_MAX);
|
||||||
if (is_suffix(newpath, " $NNN")) {
|
if (is_suffix(newpath, " $nnn")) {
|
||||||
tmp = (ndents ? dents[cur].name : NULL);
|
tmp = (ndents ? dents[cur].name : NULL);
|
||||||
/* Set `\0` to clear ' $NNN' suffix */
|
/* Set `\0` to clear ' $nnn' suffix */
|
||||||
newpath[strlen(newpath) - 5] = '\0';
|
newpath[strlen(newpath) - 5] = '\0';
|
||||||
} else
|
} else
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
|
|
Loading…
Reference in a new issue