I LOVE NNN
This commit is contained in:
parent
4736f730e0
commit
5a847657dc
3 changed files with 79 additions and 0 deletions
49
.zshc/completion/nnn.zsh
Executable file
49
.zshc/completion/nnn.zsh
Executable file
|
@ -0,0 +1,49 @@
|
|||
#compdef nnn
|
||||
#
|
||||
# Completion definition for nnn.
|
||||
#
|
||||
# Author:
|
||||
# Arun Prakash Jana <engineerarun@gmail.com>
|
||||
#
|
||||
|
||||
setopt localoptions noshwordsplit noksharrays
|
||||
local -a args
|
||||
args=(
|
||||
'(-a)-a[auto-create NNN_FIFO]'
|
||||
'(-A)-A[disable dir auto-enter]'
|
||||
'(-b)-b[bookmark key to open]:key char'
|
||||
'(-B)-B[use bsdtar for archives]'
|
||||
'(-c)-c[cli-only opener]'
|
||||
'(-C)-C[color by context]'
|
||||
'(-d)-d[start in detail mode]'
|
||||
'(-D)-D[dirs in context color]'
|
||||
'(-e)-e[open text files in $VISUAL/$EDITOR/vi]'
|
||||
'(-E)-E[use EDITOR for undetached edits]'
|
||||
'(-f)-f[use readline history file]'
|
||||
'(-F)-F[fifo notification mode]:mode:(( 0\:"notify as previewer" 1\:"notify as explorer" ))'
|
||||
'(-g)-g[regex filters]'
|
||||
'(-H)-H[show hidden files]'
|
||||
'(-i)-i[show current file info]'
|
||||
'(-J)-J[no auto-advance on selection]'
|
||||
'(-K)-K[detect key collision and exit]'
|
||||
'(-l)-l[lines to move per scroll]:val'
|
||||
'(-n)-n[start in type-to-nav mode]'
|
||||
'(-o)-o[open files only on Enter]'
|
||||
'(-p)-p[copy selection to file]:file name'
|
||||
'(-P)-P[plugin key to run]:key char'
|
||||
'(-Q)-Q[disable quit confirmation]'
|
||||
'(-r)-r[show cp, mv progress (Linux-only)]'
|
||||
'(-R)-R[disable rollover at edges]'
|
||||
'(-s)-s[load session]:session name'
|
||||
'(-S)-S[persistent session]'
|
||||
'(-t)-t[timeout to lock]:seconds'
|
||||
'(-T)-T[sort order]:key:(( a\:"apparent disk usasge" d\:"disk usage" e\:"extension" r\:"reverse" s\:"size" t\:"time" v\:"version" ))'
|
||||
'(-u)-u[use selection (no prompt)]'
|
||||
'(-U)-U[show user and group]'
|
||||
'(-V)-V[show program version and exit]'
|
||||
'(-x)-x[notis, sel to system clipboard, xterm title]'
|
||||
'(-0)-0[use null separator in picker mode]'
|
||||
'(-h)-h[show program help]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
_arguments -S -s $args
|
0
.zshc/func.zsh
Normal file → Executable file
0
.zshc/func.zsh
Normal file → Executable file
30
.zshc/nnn.zsh
Executable file
30
.zshc/nnn.zsh
Executable file
|
@ -0,0 +1,30 @@
|
|||
nnn n ()
|
||||
{
|
||||
# Block nesting of nnn in subshells
|
||||
[ "${NNNLVL:-0}" -eq 0 ] || {
|
||||
echo "nnn is already running"
|
||||
return
|
||||
}
|
||||
|
||||
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
||||
# If NNN_TMPFILE is set to a custom path, it must be exported for nnn to
|
||||
# see. To cd on quit only on ^G, remove the "export" and make sure not to
|
||||
# use a custom path, i.e. set NNN_TMPFILE *exactly* as follows:
|
||||
# NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
|
||||
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
||||
# stty start undef
|
||||
# stty stop undef
|
||||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
# The command builtin allows one to alias nnn to n, if desired, without
|
||||
# making an infinitely recursive alias
|
||||
command nnn -e "$@"
|
||||
|
||||
[ ! -f "$NNN_TMPFILE" ] || {
|
||||
. "$NNN_TMPFILE"
|
||||
rm -f -- "$NNN_TMPFILE" > /dev/null
|
||||
}
|
||||
}
|
Reference in a new issue