feat(nnn): set env vars as local

This commit is contained in:
Michel 2024-04-16 09:51:20 +02:00
parent a2d96c7305
commit db59542fe7
1 changed files with 37 additions and 19 deletions

56
.zshrc
View File

@ -231,23 +231,22 @@ compdef hg=rg
# To choose an existing instance for nvr, use:
# `export NVIM=$(nvr --serverlist | fzf --exit-0 --select-1) && echo $NVIM`
# nnn - n³
#
# See https://github.com/jarun/nnn/wiki/Usage#configuration
export NNN_ARCHIVE='\.(7z|bz2|cbz|cbr|gz|tar|tbz|tgz|xz|zip|zst)$'
if (( ${+commands[fuse-archive]} )); then
export NNN_ARCHMNT='fuse-archive'
fi
export NNN_BMS="d:~/Downloads"
export NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
export NNN_OPTS='ABeGo'
export NNN_ORDER="t:$HOME/Downloads"
export NNN_PLUG=';:-!bat --paging=always "$nnn"*;d:fzcd;m:mimelist;o:-!mimeopen --ask "$nnn"*;O:-!mimeopen "$nnn"*;U:umounttree;z:fzopen'
if (( ${+commands[trash-put]} )); then
export NNN_TRASH=1
elif (( ${+commands[gio]} )); then
export NNN_TRASH=2
fi
local nnn_plug=(
'b:-!bat --paging=always "$nnn"*'
'd:fzcd'
'z:fzopen'
'm:mimelist'
'o:-!mimeopen "$nnn"*'
'O:-!mimeopen --ask "$nnn"*'
'U:umounttree'
';:-!clear*'
# TODO Dump trash
)
n()
{
@ -256,10 +255,27 @@ n()
return
fi
export GUI=1 # plugins: nuke, xdgdefault
export LESS=${LESS/F}
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/cd-on-quit"
export PATH=$HOME/.config/nnn/plugins:$PATH
local -x LESS=${LESS/F}
local -x PATH=$HOME/.config/nnn/plugins:$PATH
# See https://github.com/jarun/nnn/wiki/Usage#configuration
local -x GUI=1 # plugins: nuke, xdgdefault
local -x NNN_ARCHIVE='\.(7z|bz2|cbz|cbr|gz|tar|tbz|tgz|xz|zip|zst)$'
local -x NNN_BMS="d:~/Downloads;q:~/QubesIncoming"
local -x NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
local -x NNN_OPTS='ABeGo'
local -x NNN_ORDER="t:$HOME/Downloads"
local -x NNN_PLUG=${(j:;:)nnn_plug}
local -x NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/cd-on-quit"
if (( ${+commands[fuse-archive]} )); then
local -x NNN_ARCHMNT='fuse-archive'
fi
if (( ${+commands[trash-put]} )); then
local -x NNN_TRASH=1
elif (( ${+commands[gio]} )); then
local -x NNN_TRASH=2
fi
command nnn "$@"
@ -317,6 +333,7 @@ zle -N nnn-file-widget
bindkey -M vicmd '\en' nnn-file-widget
bindkey -M viins '\en' nnn-file-widget
# Whiptail helper
#
# see https://stackoverflow.com/questions/1970180/whiptail-how-to-redirect-output-to-environment-variable
@ -380,6 +397,7 @@ whiptail_menu() {
return $res
}
###
### Aliases -- Global & automatic expansion
###