From 8615b03b708030ed3859860b393a62a8f53656f1 Mon Sep 17 00:00:00 2001 From: waldek Date: Wed, 24 Aug 2022 22:26:28 +0200 Subject: [PATCH] adds xonsh setup --- bootstrap.sh | 40 ++++++++++++++++++++++++++++++---------- custom.zsh | 4 +--- xonshrc | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 xonshrc diff --git a/bootstrap.sh b/bootstrap.sh index cf34333..4aace93 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -3,9 +3,10 @@ NAME="waldek" EMAIL="waldek@mailbox.org" DEPENDENCIES_APT="zsh git tig tmux vim-nox htop python3 python3-pip" +DEPENDENCIES_PIP="xonsh" SOURCES_DIR=~/sources -BOOTSTRAP_DIR=~/sources/bootstrap +BOOTSTRAP_DIR=~/sources/gitea_irisib/bootstrap CUSTOM_ZSHRC=$BOOTSTRAP_DIR/custom.zsh CUSTOM_ENV=$BOOTSTRAP_DIR/env.sh @@ -68,7 +69,7 @@ function clone_bootstrap_to_sources_dir () { function install_oh_my_zsh () { local dst=~/.oh-my-zsh if ! [[ -d $dst ]]; then - git clone git://github.com/robbyrussell/oh-my-zsh.git $dst + git clone https://github.com/robbyrussell/oh-my-zsh.git $dst cp $dst/templates/zshrc.zsh-template ~/.zshrc else cd $dst @@ -105,21 +106,40 @@ function clone_and_setup_vimrc () { } function symlink_config_files () { + mkdir -p ~/.config/htop local dst=~/.config/htop/htoprc if ! [[ -L $dst ]]; then rm $dst 2> /dev/null ln -s $(ls $BOOTSTRAP_DIR/htoprc) $dst fi + local dst=~/.xonshrc + if ! [[ -L $dst ]]; then + rm $dst 2> /dev/null + ln -s $(ls $BOOTSTRAP_DIR/xonshrc) $dst + fi + echo "--- ${FUNCNAME[0]} done" } -#install_apt_dependencies -setup_sources_dir -setup_global_git_config -clone_bootstrap_to_sources_dir -install_oh_my_zsh -customize_oh_my_zsh -clone_and_setup_vimrc -symlink_config_files +function install_pip_dependencies () { + for dep in $DEPENDENCIES_PIP; do + sudo pip3 install --upgrade $dep > $LOG && echo "installed $dep" + done + +} + +function main () { + #install_apt_dependencies + install_pip_dependencies + setup_sources_dir + setup_global_git_config + clone_bootstrap_to_sources_dir + install_oh_my_zsh + customize_oh_my_zsh + #clone_and_setup_vimrc + symlink_config_files +} + +main #echo "setting up $ME" #HOME=$LOCALHOME$ME diff --git a/custom.zsh b/custom.zsh index df77c02..328dc44 100644 --- a/custom.zsh +++ b/custom.zsh @@ -1,8 +1,7 @@ - # START customization via bootstrap script COMPLETION_WAITING_DOTS="true" -plugins=(git autoswitch_virtualenv tty-solarized) +plugins=(git tty-solarized) #zstyle :omz:plugins:tty-solarized theme-shade "light" zstyle :omz:plugins:tty-solarized theme-shade "dark" alias meteo="wget -q -O - wttr.in" @@ -13,4 +12,3 @@ bindkey '\E\t' reverse-menu-complete export PATH=$PATH:/usr/local/go/bin # END customization via bootstrap script - diff --git a/xonshrc b/xonshrc new file mode 100644 index 0000000..9ba3cf5 --- /dev/null +++ b/xonshrc @@ -0,0 +1,38 @@ +import os +# set where oh-my-xonsh lives +if not 'OMX_HOME' in ${...}: + $OMX_HOME = p"~/.config/xonsh/oh-my-xonsh" + +# clone omx if needed +if not pf"{$OMX_HOME}".exists(): + git clone --depth=1 https://github.com/oh-my-xonsh/oh-my-xonsh $OMX_HOME + +# source oh-my-xonsh to give you the `omx` object +source $OMX_HOME/oh-my-xonsh.xsh + +# choose your plugins +omx.plugins = [ + 'autocmd', + #'brew', + #'clipboard', + 'common_aliases', + 'copydir', + 'dash', + 'git', + 'gitignore', + 'golang', + 'iwd', + #'macos', + 'manpage_coloring', + 'shrink_path', + 'up', +] + +# configure your plugins +# omx.config["plugins.git.skip_aliases"] = True + +# initialize oh-my-xonsh +omx.init() + +$XONSH_COLOR_STYLE = "solarized-dark" +