mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-06 16:50:22 +00:00
- install-composer.sh: use $DOTFILES instead of $HOME/.dotfiles - install-macos-defaults.sh: use $DOTFILES, replace which with command -v - install-xcode-cli-tools.sh: quote command substitution - create-nvim-keymaps.sh: quote $DEST in nvim redir command
34 lines
829 B
Bash
Executable File
34 lines
829 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# @description Create file containing key mappings for Neovim
|
|
# Usage: ./create-nvim-keymaps.sh
|
|
#
|
|
# shellcheck source=shared.sh
|
|
source "${DOTFILES}/config/shared.sh"
|
|
DEST="$HOME/.dotfiles/docs/nvim-keybindings.md"
|
|
|
|
main()
|
|
{
|
|
msg "Generating Neovim keybindings documentation"
|
|
|
|
{
|
|
printf "# nvim keybindings\n\n"
|
|
printf "\`\`\`txt"
|
|
} > "$DEST"
|
|
|
|
nvim -c "redir! >> \"$DEST\"" -c 'silent verbose map' -c 'redir END' -c 'q'
|
|
|
|
printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
|
|
|
# Remove unnecessary information from the output and the last line
|
|
sed -E \
|
|
-e 's/<Lua [^:]+: ([^:>]+):[0-9]+>/\1/' \
|
|
-e '/^ Last set from/d' "$DEST" \
|
|
> "${DEST}.tmp" \
|
|
&& mv "${DEST}.tmp" "$DEST"
|
|
|
|
msg "Neovim keybindings documentation generated at $DEST"
|
|
}
|
|
|
|
main "$@"
|