From 62c95ef2f3a2374ddda52302d54801cfe442484d Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Wed, 25 Oct 2023 19:17:11 +0500 Subject: [nnn] Add getplugs plugin and update all plugins --- files/.config/nnn/plugins/gitroot | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 files/.config/nnn/plugins/gitroot (limited to 'files/.config/nnn/plugins/gitroot') diff --git a/files/.config/nnn/plugins/gitroot b/files/.config/nnn/plugins/gitroot new file mode 100755 index 0000000..4428d1e --- /dev/null +++ b/files/.config/nnn/plugins/gitroot @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# Description: cd to the top level of the current git repository in the current context +# Dependencies: git +# Shell: sh +# Author: https://github.com/PatrickF1 + +root="$(git rev-parse --show-toplevel 2>/dev/null)" +if [ -n "$root" ]; then + printf "%s" "0c$root" > "$NNN_PIPE" +else + printf "Not in a git repository" + read -r _ + exit 1 +fi -- cgit v1.2.3