1
1
mirror of https://github.com/jarun/nnn.git synced 2024-11-22 15:20:59 +03:00

Updated Concepts (markdown)

Terminator X 2021-10-23 03:36:47 +05:30
parent bfce9e3e49
commit de7fcc5792

@ -284,6 +284,36 @@ Notes:
1. You can only use either `%j` or `%J` inside a single command. If both are encountered the prompt will close. No command will be executed.
2. When using `%J` `nnn` won't quote the file paths from selection. Quoting `%J` will just place quotes around the entire selection, it won't quote each item individually.
#### Copy command from spawned shell to native command prompt
The prompt (non-readline `nnn`-internal one) can remember the last executed command. Sometimes it may be desirable copy a command from shell history to the prompt. Keybinds can be configured to copy a command from bash/zsh prompt to the system clipboard. You can use these at the subshell prompt and paste the command at the prompt with <kbd>Ctrl-Shift-V</kbd>.
```bash
# bash: add in ~/.bashrc
# copy current line to clipboard with ^]
if [[ -n $DISPLAY ]]; then
copy_line_to_x_clipboard () {
printf %s "$READLINE_LINE" | xsel -ib
}
bind -x '"\C-]": copy_line_to_x_clipboard'
fi
```
```zsh
# zsh: add in ~/.zshrc
# copy current line to clipboard with ^U
if [[ -n $DISPLAY ]]; then
x-kill-whole-line () {
zle kill-whole-line
print -rn -- "$CUTBUFFER" | xsel -ib
}
zle -N x-kill-whole-line
bindkey '\C-u' x-kill-whole-line
fi
```
## Design
`nnn` (the core C utility) is, generally speaking, _feature-restricted_. It includes features which you _really_ need so it can remain light enough to finish your workflow accurately before your train of thought is lost.