adds xonsh setup

This commit is contained in:
waldek 2022-08-24 22:26:28 +02:00
parent 663e041593
commit 8615b03b70
3 changed files with 69 additions and 13 deletions

View File

@ -3,9 +3,10 @@
NAME="waldek" NAME="waldek"
EMAIL="waldek@mailbox.org" EMAIL="waldek@mailbox.org"
DEPENDENCIES_APT="zsh git tig tmux vim-nox htop python3 python3-pip" DEPENDENCIES_APT="zsh git tig tmux vim-nox htop python3 python3-pip"
DEPENDENCIES_PIP="xonsh"
SOURCES_DIR=~/sources SOURCES_DIR=~/sources
BOOTSTRAP_DIR=~/sources/bootstrap BOOTSTRAP_DIR=~/sources/gitea_irisib/bootstrap
CUSTOM_ZSHRC=$BOOTSTRAP_DIR/custom.zsh CUSTOM_ZSHRC=$BOOTSTRAP_DIR/custom.zsh
CUSTOM_ENV=$BOOTSTRAP_DIR/env.sh CUSTOM_ENV=$BOOTSTRAP_DIR/env.sh
@ -68,7 +69,7 @@ function clone_bootstrap_to_sources_dir () {
function install_oh_my_zsh () { function install_oh_my_zsh () {
local dst=~/.oh-my-zsh local dst=~/.oh-my-zsh
if ! [[ -d $dst ]]; then 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 cp $dst/templates/zshrc.zsh-template ~/.zshrc
else else
cd $dst cd $dst
@ -105,21 +106,40 @@ function clone_and_setup_vimrc () {
} }
function symlink_config_files () { function symlink_config_files () {
mkdir -p ~/.config/htop
local dst=~/.config/htop/htoprc local dst=~/.config/htop/htoprc
if ! [[ -L $dst ]]; then if ! [[ -L $dst ]]; then
rm $dst 2> /dev/null rm $dst 2> /dev/null
ln -s $(ls $BOOTSTRAP_DIR/htoprc) $dst ln -s $(ls $BOOTSTRAP_DIR/htoprc) $dst
fi 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 function install_pip_dependencies () {
setup_sources_dir for dep in $DEPENDENCIES_PIP; do
setup_global_git_config sudo pip3 install --upgrade $dep > $LOG && echo "installed $dep"
clone_bootstrap_to_sources_dir done
install_oh_my_zsh
customize_oh_my_zsh }
clone_and_setup_vimrc
symlink_config_files 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" #echo "setting up $ME"
#HOME=$LOCALHOME$ME #HOME=$LOCALHOME$ME

View File

@ -1,8 +1,7 @@
# START customization via bootstrap script # START customization via bootstrap script
COMPLETION_WAITING_DOTS="true" 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 "light"
zstyle :omz:plugins:tty-solarized theme-shade "dark" zstyle :omz:plugins:tty-solarized theme-shade "dark"
alias meteo="wget -q -O - wttr.in" alias meteo="wget -q -O - wttr.in"
@ -13,4 +12,3 @@ bindkey '\E\t' reverse-menu-complete
export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:/usr/local/go/bin
# END customization via bootstrap script # END customization via bootstrap script

38
xonshrc Normal file
View File

@ -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"