commit 435d7a8da14003848dcf43153189d03de2c036b3
parent d6c384f8e1f0add3125232fd8346bf0800ee498f
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Fri, 24 Apr 2020 22:22:27 +0200

New shortcuts that get created automatically

Diffstat:
Adot_local/bin/executable_,update-shortcuts | 29+++++++++++++++++++++++++++++
Ameta/shortcuts/directories | 4++++
Ameta/shortcuts/files | 5+++++
Ameta/shortcuts/files-chezmoi | 7+++++++
Arun_post_chezmoi.sh | 3+++
5 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/dot_local/bin/executable_,update-shortcuts b/dot_local/bin/executable_,update-shortcuts @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Source paths +FILES="$XDG_DATA_HOME/chezmoi/meta/shortcuts/files" +FILES_CM="$XDG_DATA_HOME/chezmoi/meta/shortcuts/files-chezmoi" +DIRS="$XDG_DATA_HOME/chezmoi/meta/shortcuts/directories" + +# Shortcut files paths +ZSH_SC="$XDG_CONFIG_HOME/zsh/aliases-auto" +VIM_SC="$XDG_CONFIG_HOME/nvim/shortcuts.vim" + +# Document files +echo "# vim: filetype=zsh" > "$ZSH_SC" +echo "# This file has been created automatically from the contents in" >> "$ZSH_SC" +echo "# $XDG_DATA_HOME/chezmoi/shortcuts" >> "$ZSH_SC" +echo "\" vim: filetype=vim" > "$VIM_SC" +echo "\" This file has been created automatically from the contents in" >> "$VIM_SC" +echo "\" $XDG_DATA_HOME/chezmoi/shortcuts" >> "$VIM_SC" + +[ -f "$FILES" ] && sed "s/\s*#.*$//;/^\s*$/d" "$FILES" | tee \ + >(awk '{print "alias " $1 "=\"$EDITOR " $2 "\""}' >> "$ZSH_SC") \ + |(awk '{print "nmap " $1 " :e " $2 "<CR>" }' >> "$VIM_SC") + +[ -f "$FILES_CM" ] && sed "s/\s*#.*$//;/^\s*$/d" "$FILES_CM" | tee \ + >(awk '{print "alias " $1 "=\"chezmoi edit --apply " $2 "\""}' >> "$ZSH_SC") \ + |(awk '{print "nmap " $1 " :e " $2 "<CR>" }' >> "$VIM_SC") + +[ -f "$DIRS" ] && sed "s/\s*#.*$//;/^\s*$/d" "$DIRS" | \ + awk '{print "alias " $1 "=\"cd " $2 " && ls\""}' >> "$ZSH_SC" diff --git a/meta/shortcuts/directories b/meta/shortcuts/directories @@ -0,0 +1,4 @@ +# shortcuts for directories +dc $HOME/Documents +dg $HOME/Git +dw $HOME/Downloads diff --git a/meta/shortcuts/files b/meta/shortcuts/files @@ -0,0 +1,5 @@ +# shortcuts for files +cfd $XDG_DATA_HOME/chezmoi/chezmoi/directories +cff $XDG_DATA_HOME/chezmoi/chezmoi/files +cffc $XDG_DATA_HOME/chezmoi/chezmoi/files-chezmoi +cfx $HOME/.Xresources diff --git a/meta/shortcuts/files-chezmoi b/meta/shortcuts/files-chezmoi @@ -0,0 +1,7 @@ +# shortcuts for files that should be edited with chezmoi +cfa $XDG_CONFIG_HOME/zsh/aliases +cfb $XDG_CONFIG_HOME/i3blocks/config +cfe $HOME/.zshenv +cfi $XDG_CONFIG_HOME/i3/config +cfv $XDG_CONFIG_HOME/nvim/init.vim +cfz $XDG_CONFIG_HOME/zsh/.zshrc diff --git a/run_post_chezmoi.sh b/run_post_chezmoi.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +$HOME/.local/bin/,update-shortcuts