From 22551e79feae77eddd6f7db3860630246979f0c0 Mon Sep 17 00:00:00 2001 From: Jeff LANCE Date: Fri, 19 Feb 2021 23:23:31 +0100 Subject: [PATCH] update and clean --- .../modules/sudo/functions/sudo-command-line | 34 ++++++++++++++++++ conf.d/zim/modules/sudo/init.zsh | 6 ++++ conf.d/zim/modules/sudo/init.zsh.zwc | Bin 0 -> 608 bytes helpers/install_zsh.sh | 33 +++++++++++++++++ meta/tasks/aacskeys.yaml | 14 ++++---- meta/tasks/nvim.yaml | 2 +- meta/tasks/zim.yaml | 28 +++------------ meta/tasks/zim.yaml.old | 18 ++++++++++ 8 files changed, 103 insertions(+), 32 deletions(-) create mode 100644 conf.d/zim/modules/sudo/functions/sudo-command-line create mode 100644 conf.d/zim/modules/sudo/init.zsh create mode 100644 conf.d/zim/modules/sudo/init.zsh.zwc create mode 100755 helpers/install_zsh.sh create mode 100644 meta/tasks/zim.yaml.old diff --git a/conf.d/zim/modules/sudo/functions/sudo-command-line b/conf.d/zim/modules/sudo/functions/sudo-command-line new file mode 100644 index 0000000..f70b1f1 --- /dev/null +++ b/conf.d/zim/modules/sudo/functions/sudo-command-line @@ -0,0 +1,34 @@ +[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)" + +# Save beginning space +local WHITESPACE="" +if [[ ${LBUFFER:0:1} == " " ]] ; then + WHITESPACE=" " + LBUFFER="${LBUFFER:1}" +fi + +if [[ -n $EDITOR && $BUFFER == $EDITOR\ * ]]; then + if [[ ${#LBUFFER} -le ${#EDITOR} ]]; then + RBUFFER=" ${BUFFER#$EDITOR }" + LBUFFER="sudoedit" + else + LBUFFER="sudoedit ${LBUFFER#$EDITOR }" + fi +elif [[ $BUFFER == sudoedit\ * ]]; then + if [[ ${#LBUFFER} -le 8 ]]; then + RBUFFER=" ${BUFFER#sudoedit }" + LBUFFER="$EDITOR" + else + LBUFFER="$EDITOR ${LBUFFER#sudoedit }" + fi +elif [[ $BUFFER == sudo\ * ]]; then + if [[ ${#LBUFFER} -le 4 ]]; then + RBUFFER="${BUFFER#sudo }" + LBUFFER="" + else + LBUFFER="${LBUFFER#sudo }" + fi +else + LBUFFER="sudo $LBUFFER" +fi + diff --git a/conf.d/zim/modules/sudo/init.zsh b/conf.d/zim/modules/sudo/init.zsh new file mode 100644 index 0000000..a76c6bf --- /dev/null +++ b/conf.d/zim/modules/sudo/init.zsh @@ -0,0 +1,6 @@ +zle -N sudo-command-line + +# Defined shortcut keys: [Esc] [Esc] +bindkey -M emacs '\e\e' sudo-command-line +bindkey -M vicmd '\e\e' sudo-command-line +bindkey -M viins '\e\e' sudo-command-line diff --git a/conf.d/zim/modules/sudo/init.zsh.zwc b/conf.d/zim/modules/sudo/init.zsh.zwc new file mode 100644 index 0000000000000000000000000000000000000000..b8686d3631e9e0e7468b1b15bdfccc41e4d713b1 GIT binary patch literal 608 zcmbV|KW@S>6o+5TzqJEnZh#b*0d=leI0Or|9mOSf28T+pAy#extel{G2X4Tc%kXnx zFj1uzBK`9G^giV|U$5I~(`!Vd? z-9i>zTU{nAmr+dbU|FANgPI~|F=$mKqX_4Eh6Q6ZNAwe<${A&-Yb0bg4Q3xQ3_I|h zQ-k>q7#zvpZ6^w2W>)TUZ54fJE9YuS%FKkL!&FVxfxfgb5^rrCQM=Rau?Ku%&9BP- z=gZ&HYw6>UuF6^iaVAz)=x;h=%%U;+t1_1RSwmUPc;z7zC}Y@BGp7b~r|cPD7sTpm A#{d8T literal 0 HcmV?d00001 diff --git a/helpers/install_zsh.sh b/helpers/install_zsh.sh new file mode 100755 index 0000000..c93d9ab --- /dev/null +++ b/helpers/install_zsh.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +ZIMDIR=${HOME}/.zim +ZIMFILES="zimrc zshenv zlogin zshrc" + +echo "Creating directory" +[[ ! -d ${ZIMDIR} ]] && mkdir ${ZIMDIR} + +echo "Getting Zim Framework" +curl -fsSL https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh -o ${ZIMDIR}/zimfw.zsh + +echo "Treating links" +for FILE in ${ZIMFILES} +do + [[ -L ~/.${FILE} ]] && unlink ~/.${FILE} + ln -s ${PWD}/conf.d/zim/${FILE} ~/.${FILE} +done + +echo "Making modules directory" +[[ ! -d ${ZIMDIR}/modules ]] && mkdir ${ZIMDIR}/modules + +echo "Populating modules" +for MOD in conf.d/zim/modules/* +do + DIR=$(basename ${MOD}) + [[ -L ${ZIMDIR}/modules/${DIR} ]] && unlink ${ZIMDIR}/modules/${DIR} + ln -s ${PWD}/conf.d/zim/modules/${DIR} ${ZIMDIR}/modules/${DIR} +done + +echo "Installing Zim Framework" +$(which zsh) ${ZIMDIR}/zimfw.zsh install + +exit 0 diff --git a/meta/tasks/aacskeys.yaml b/meta/tasks/aacskeys.yaml index ff6f656..0b06c5f 100644 --- a/meta/tasks/aacskeys.yaml +++ b/meta/tasks/aacskeys.yaml @@ -1,13 +1,13 @@ - shell: - - command: '[[ ! -d ${HOME}/.config/aacs ]] && mkdir ${HOME}/.config/aacs' - stdout: true - stderr: true - description: Testing directory + command: '[[ ! -d ${HOME}/.config/aacs ]] && mkdir ${HOME}/.config/aacs || true' + #stdout: true + #stderr: true + description: Creating directory - - command: '[[ ! -f ${HOME}/.config/aacs/KEYDB.cfg ]] && /bin/bash -c "curl -fsSL http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg -o ${HOME}/.config/aacs/KEYDB.cfg"' - stdout: true - stderr: true + command: '[[ ! -e ${HOME}/.config/aacs/KEYDB.cfg ]] && /bin/bash -c "curl -kfsSL https://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg -o ${HOME}/.config/aacs/KEYDB.cfg" || true' + #stdout: true + #stderr: true description: Downloading AACS db keys diff --git a/meta/tasks/nvim.yaml b/meta/tasks/nvim.yaml index aa86a9f..6cb8b3b 100644 --- a/meta/tasks/nvim.yaml +++ b/meta/tasks/nvim.yaml @@ -7,5 +7,5 @@ - command: '/bin/bash -c "$(which nvim) -es -u ${HOME}/.config/nvim/init.vim -i NONE -c PlugInstall -c qa || true"' stdout: true stdin: true - stderre: true + stderr: true description: Installing Nvim plugins diff --git a/meta/tasks/zim.yaml b/meta/tasks/zim.yaml index 65e8299..c72ccb2 100644 --- a/meta/tasks/zim.yaml +++ b/meta/tasks/zim.yaml @@ -1,26 +1,6 @@ -- defaults: - link: - relink: true - - shell: - #- command: '/bin/bash -c "curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshenv https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshrc https://raw.githubusercontent.com/zimfw/install/master/src/templates/zlogin https://raw.githubusercontent.com/zimfw/install/master/src/templates/zimrc -o $HOME/.zshenv -o $HOME/.zshrc -o $HOME/.zlogin -o $HOME/.zimrc"' - # description: Getting dotfiles for Zsh IMproved FrameWork - - command: '[[ ! -d "${HOME}/.zim" ]] && mkdir "${HOME}/.zim" ; /bin/bash -c "curl -fsSL https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh -o ${HOME}/.zim/zimfw.zsh"' - description: Creating and getting zim dir and installation file + - command: '/bin/bash -c helpers/install_zsh.sh' + description: Create latex personal directory + stderr: true + stdout: true -- link: - ${HOME}/.zimrc: - path: conf.d/zim/zimrc - ${HOME}/.zshenv: - path: conf.d/zim/zshenv - ${HOME}/.zlogin: - path: conf.d/zim/zlogin - ${HOME}/.zshrc: - path: conf.d/zim/zshrc - ${HOME}/.zim/modules/: - glob: true - path: conf.d/zim/modules/* - -- shell: - - command: '/bin/bash -c "$(which zsh) ${HOME}/.zim/zimfw.zsh install"' - description: Installing the Zsh IMproved FrameWork diff --git a/meta/tasks/zim.yaml.old b/meta/tasks/zim.yaml.old new file mode 100644 index 0000000..ab3a740 --- /dev/null +++ b/meta/tasks/zim.yaml.old @@ -0,0 +1,18 @@ +- defaults: + link: + relink: true + +- shell: + #- command: '/bin/bash -c "curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshenv https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshrc https://raw.githubusercontent.com/zimfw/install/master/src/templates/zlogin https://raw.githubusercontent.com/zimfw/install/master/src/templates/zimrc -o $HOME/.zshenv -o $HOME/.zshrc -o $HOME/.zlogin -o $HOME/.zimrc"' + # description: Getting dotfiles for Zsh IMproved FrameWork + - + command: '[[ ! -d "${HOME}/.zim" ]] && mkdir "${HOME}/.zim" ; /bin/bash -c "curl -fsSL https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh -o ${HOME}/.zim/zimfw.zsh"' + description: Creating and getting zim dir and installation file + - + command: '' + description: Linking zsh and zim configuration files + +- shell: + - + command: '/bin/bash -c "$(which zsh) ${HOME}/.zim/zimfw.zsh install"' + description: Installing the Zsh IMproved FrameWork