mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-09 23:51:34 +00:00
feat(dfm): Add dfm docs tmux
This command will update docs/tmux-keybindings.md file that contains all configured tmux keybindings.
This commit is contained in:
@@ -175,6 +175,20 @@ function section_brew
|
||||
! have brew && menu_section "$USAGE_PREFIX" "brew not available on this system"
|
||||
}
|
||||
|
||||
function section_docs
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT docs <command>"
|
||||
|
||||
MENU=(
|
||||
"tmux:Update tmux keybindings documentation"
|
||||
)
|
||||
|
||||
case "$1" in
|
||||
tmux) bash "$DOTFILES/local/bin/x-dfm-docs-xterm-keybindings" ;;
|
||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
function section_dotfiles
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT dotfiles <command>"
|
||||
@@ -307,6 +321,8 @@ function usage
|
||||
section_check
|
||||
echo ""
|
||||
section_dotfiles
|
||||
echo ""
|
||||
section_docs
|
||||
}
|
||||
|
||||
# The main loop. first keyword after $0 triggers section, or help.
|
||||
@@ -315,6 +331,7 @@ case "$1" in
|
||||
brew) section_brew "$2" ;;
|
||||
check) section_check "$2" ;;
|
||||
dotfiles) section_dotfiles "$2" ;;
|
||||
docs) section_docs "$2" ;;
|
||||
tests) section_tests "$2" ;;
|
||||
*) usage && exit 0 ;;
|
||||
esac
|
||||
|
||||
22
local/bin/x-dfm-docs-xterm-keybindings
Executable file
22
local/bin/x-dfm-docs-xterm-keybindings
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# x-xterm-update-keybindings
|
||||
# Updates $HOME/.dotfiles/docs/tmux.md with my keybindings.
|
||||
|
||||
# shellcheck source=./../../scripts/shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
have tmux || {
|
||||
msg_err "tmux not found" && exit 0
|
||||
}
|
||||
|
||||
TMUX_KEYBINDINGS_DOCS="$DOTFILES/docs/tmux-keybindings.md"
|
||||
|
||||
CB="\n\`\`\`\n"
|
||||
KB=$(tmux list-keys)
|
||||
H="# tmux keybindings\n"
|
||||
L="\n\nLeader: \`<ctrl><space>\`\n\n"
|
||||
|
||||
msg "Outputting tmux keybindings to $TMUX_KEYBINDINGS_DOCS"
|
||||
echo -e "${H}${L}${CB}${KB}${CB}" > "$TMUX_KEYBINDINGS_DOCS"
|
||||
msg_done "Done!"
|
||||
Reference in New Issue
Block a user