This repository has been archived on 2023-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.config/nnn/plugins/gitroot

16 lines
365 B
Plaintext
Raw Permalink Normal View History

2022-11-01 19:12:15 +01:00
#!/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