aboutsummaryrefslogtreecommitdiffstats
path: root/misc/auto-completion
diff options
context:
space:
mode:
authorGravatar Anna Arad <4895022+annagrram@users.noreply.github.com>2019-10-19 01:11:39 +0300
committerGravatar Mischievous Meerkat <engineerarun@gmail.com>2019-10-19 03:41:39 +0530
commit60dac94a5e3727d7c8bf0f02f3d6f8b53f8d1d02 (patch)
tree3db311f182889799ef16a16c05d87644e84c61ca /misc/auto-completion
parent2da5602a4f7bff17d43c939e7329aab34e2a85f9 (diff)
downloadnnn-60dac94a5e3727d7c8bf0f02f3d6f8b53f8d1d02.tar.gz
Implementing sessions support (#360)
* Initial commit of sessions implementation * Reduce code duplication * Move load session to program flag -e * Fix context initialization problem when loading session * Add pinned directory to session and reduce session file size * Make load_session print an error if exists and few minor adjustments * Refactor session's file structure * Initialize required structures in load_session before loading * Add load session dynamically, restore last session, and extra fixes * Fix indentation * Add sessions documentation to man page * Update fish completions with sessions and make some improvements * Move to single keybinding session management and add help info * ESC when asked to insert session name behaves better * Add sessions completion for bash * Remove pinned dir from session and minor code refactors
Diffstat (limited to 'misc/auto-completion')
-rw-r--r--misc/auto-completion/bash/nnn-completion.bash3
-rw-r--r--misc/auto-completion/fish/nnn.fish11
2 files changed, 12 insertions, 2 deletions
diff --git a/misc/auto-completion/bash/nnn-completion.bash b/misc/auto-completion/bash/nnn-completion.bash
index d97b144..22180e5 100644
--- a/misc/auto-completion/bash/nnn-completion.bash
+++ b/misc/auto-completion/bash/nnn-completion.bash
@@ -34,6 +34,9 @@ _nnn () {
COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
elif [[ $prev == -p ]]; then
COMPREPLY=( $(compgen -f -d -- "$cur") )
+ elif [[ $prev == -e ]]; then
+ local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
+ COMPREPLY=( $(compgen -W "$(ls $sessions_dir)" -- "$cur") )
elif [[ $cur == -* ]]; then
COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
else
diff --git a/misc/auto-completion/fish/nnn.fish b/misc/auto-completion/fish/nnn.fish
index ee3768a..7119644 100644
--- a/misc/auto-completion/fish/nnn.fish
+++ b/misc/auto-completion/fish/nnn.fish
@@ -5,17 +5,24 @@
# Arun Prakash Jana <engineerarun@gmail.com>
#
+if test -n "$XDG_CONFIG_HOME"
+ set sessions_dir $XDG_CONFIG_HOME/.config/nnn/sessions
+else
+ set sessions_dir $HOME/.config/nnn/sessions
+end
+
complete -c nnn -s a -d 'use access time'
-complete -c nnn -s b -r -d 'bookmark key to open'
+complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')'
complete -c nnn -s c -d 'cli-only opener'
complete -c nnn -s d -d 'start in detail mode'
+complete -c nnn -s e -r -d 'load session by name' -x -a '@\t"last session" (ls $nnn_config)'
complete -c nnn -s f -d 'run filter as cmd on prompt key'
complete -c nnn -s H -d 'show hidden files'
complete -c nnn -s i -d 'start in navigate-as-you-type mode'
complete -c nnn -s K -d 'detect key collision'
complete -c nnn -s n -d 'use version compare to sort files'
complete -c nnn -s o -d 'open files only on Enter'
-complete -c nnn -s p -r -d 'copy selection to file'
+complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout'
complete -c nnn -s r -d 'show cp, mv progress (Linux-only)'
complete -c nnn -s s -d 'use substring match for filters'
complete -c nnn -s S -d 'start in disk usage analyzer mode'