diff --git a/.gitignore b/.gitignore index b948985..85010f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.swp *.pyc +/hosts/lb* diff --git a/bashrc b/bashrc index 7b49007..e3d2a92 100644 --- a/bashrc +++ b/bashrc @@ -15,64 +15,22 @@ else USER=$(whoami) fi -export PATH=$PATH:~/bin:~/local/bin +export PATH=$PATH:~/bin:~/local/bin:~/local/usr/bin function tmux_title { printf '\033]2;%s\033\\' $@ } #tmux_title $(hostname -s) -# load powerline -if which powerline-daemon &>/dev/null; then - powerline-daemon -q - POWERLINE_BASH_CONTINUATION=1 - POWERLINE_BASH_SELECT=1 +if [ -f ~/git/homedir-config/hosts/$(hostname -s)/bashrc ] ; then + source ~/git/homedir-config/hosts/$(hostname -s)/bashrc else - # otherwise Git prompt - PS1='\[\033[0;32m\]${USER}@\h\[\033[0m\] [\[\033[0;33m\]\w\[\]\[\033[0;32m\]]\n'$PROMPT_SUFFIX - GIT_PROMPT_ONLY_IN_REPO=1 - GIT_PROMPT_FETCH_REMOTE_STATUS=0 - GIT_PROMPT_IGNORE_STASH=1 - GIT_PROMPT_THEME=Noldorized - source ~/.bash-git-prompt/gitprompt.sh - - function prompt_callback { - REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | head -1) - tmux_title "$REPO($GIT_BRANCH)" - } + source ~/git/homedir-config/hosts/any/bashrc fi -PYVERSION=$(python3 --version | grep -Eo '[0-9]\.[0-9]') -if [ -f $HOME/.venv/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh ]; then - export VIRTUAL_ENV="$HOME/.venv" - export PATH=$VIRTUAL_ENV/bin:$PATH -# powerline-daemon -q - POWERLINE_BASH_CONTINUATION=1 - POWERLINE_BASH_SELECT=1 - - function _update_ps1() { - if git log --oneline -n1 &>/dev/null ; then - REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | sed 's/.git$//'| head -1) - BRANCH=$(git branch --show-current) - tmux_title "$REPO($BRANCH)" - else - tmux_title "$(hostname)" - fi - PS1=$(powerline-shell $?) - } - - if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then - PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" - fi - -# source $HOME/.venv/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh -elif [ -f ~/.local/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh ] ; then - #source ~/.local/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh - echo no -elif [ -f /usr/local/lib/python${PYVERSION}/dist-packages/powerline/bindings/bash/powerline.sh ]; then - source /usr/local/lib/python${PYVERSION}/dist-packages/powerline/bindings/bash/powerline.sh +if type nvim &>/dev/null ; then + alias vim=nvim fi -set +x # LS_COLORS eval $(dircolors -b $HOME/.dircolors) @@ -83,17 +41,22 @@ export LESS='-R' export TERM=xterm-256color export MC_SKIN=$HOME/.mc/lib/solarized.ini -if [ -e ~/.local/bin/virtualenvwrapper.sh ] ; then - # Python stuff - export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 - source ~/.local/bin/virtualenvwrapper.sh - export WORKON_HOME=/home/nold/.virtualenvs - export PIP_VIRTUALENV_BASE=/home/nold/.virtualenvs -fi +#if [ -e ~/.local/bin/virtualenvwrapper.sh ] ; then +# # Python stuff +# export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 +# source ~/.local/bin/virtualenvwrapper.sh +# export WORKON_HOME=/home/nold/.virtualenvs +# export PIP_VIRTUALENV_BASE=/home/nold/.virtualenvs +#fi + +# Functions +function json2yaml { + python3 -c 'import sys, yaml, json; print(yaml.dump(json.loads(sys.stdin.read())))' +} # Aliases alias ls="ls --color=always --time-style=long-iso -F" -alias dfh="df -hT -t ext4 -t zfs" +alias dfh="df -hT -t ext4 -t zfs -t xfs" alias lsof='lsof 2>/dev/null | grep' # Git @@ -106,14 +69,6 @@ alias gpush="git push" alias gpull="git pull" alias gcap="git commit --amend --no-edit && git push -f" -# Docker-Compose -alias dcu="docker-compose up -d --remove-orphans" -alias dcd="docker-compose down" -alias dcp="docker-compose pull" -alias dcb="docker-compose build" -alias dcl="docker-compose logs" -alias dclf="docker-compose logs --tail=50 -f" - # k3s / k8s / helm alias k="kubectl" alias kga="kubectl get all --all-namespaces -o wide" diff --git a/dotfiles/vimrc b/dotfiles/vimrc index 11c551e..61a5973 100644 --- a/dotfiles/vimrc +++ b/dotfiles/vimrc @@ -11,7 +11,9 @@ Plugin 'scrooloose/nerdtree' Plugin 'vim-syntastic/syntastic' Plugin 'farmergreg/vim-lastplace.git' Plugin 'dense-analysis/ale' -Plugin 'fatih/vim-go' +" Needs Python/Python3 support compiled into vim: +"Plugin 'mvanderkamp/vim-pudb-and-jam' +"Plugin 'fatih/vim-go' call vundle#end() " required filetype plugin indent on " required " @@ -134,6 +136,15 @@ let g:ale_sign_error = '✘' let g:ale_sign_warning = '⚠' let g:ale_lint_on_text_changed = 'never' +" ------------------------------------ PuDB ------------------------------------------- +nnoremap bc :PudbClearAll +nnoremap be :PudbEdit +nnoremap bl :PudbList +nnoremap bq :PudbQfList +nnoremap bp :PudbToggle +nnoremap bu :PudbUpdate + + " ------------------------------------ Whitespace Highlighting ------------------------------------------- autocmd ColorScheme * highlight ExtraWhitespaces ctermbg=red guibg=red "" Extra Whitespace Highlighting diff --git a/hosts/any/bashrc b/hosts/any/bashrc new file mode 100644 index 0000000..6f6e258 --- /dev/null +++ b/hosts/any/bashrc @@ -0,0 +1,37 @@ +# load powerline +if which powerline-daemon &>/dev/null; then + powerline-daemon -q + POWERLINE_BASH_CONTINUATION=1 + POWERLINE_BASH_SELECT=1 +fi + +PYVERSION=$(python3 --version | grep -Eo '[0-9]\.[0-9]') +if [ -f $HOME/.venv/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh ]; then + export VIRTUAL_ENV="$HOME/.venv" + export PATH=$VIRTUAL_ENV/bin:$PATH +# powerline-daemon -q + POWERLINE_BASH_CONTINUATION=1 + POWERLINE_BASH_SELECT=1 + + function _update_ps1() { + if git log --oneline -n1 &>/dev/null ; then + REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | sed 's/.git$//'| head -1) + BRANCH=$(git branch --show-current) + tmux_title "$REPO($BRANCH)" + else + tmux_title "$(hostname)" + fi + PS1=$(powerline-shell $?) + } + + if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then + PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" + fi + +# source $HOME/.venv/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh +elif [ -f ~/.local/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh ] ; then + #source ~/.local/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh + echo no +elif [ -f /usr/local/lib/python${PYVERSION}/dist-packages/powerline/bindings/bash/powerline.sh ]; then + source /usr/local/lib/python${PYVERSION}/dist-packages/powerline/bindings/bash/powerline.sh +fi diff --git a/setup.sh b/setup.sh index 197f83d..358c87f 100755 --- a/setup.sh +++ b/setup.sh @@ -13,8 +13,13 @@ function linkfiles { fi if [ ! -L ~/.${targetdir}${name} ] ; then + if [ -f hosts/$(hostname -s)/${name} ] ; then + dotfile="$(pwd)/hosts/$(hostname -s)/${name}" + else + dotfile="$(pwd)/$dir/${name}" + fi mv -v ~/.${targetdir}${name} ~/.config/homedir-backup - ln -s $(pwd)/$dir/${name} ~/.${targetdir}${name} + ln -s "$dotfile" ~/.${targetdir}${name} fi done } diff --git a/update.sh b/update.sh index 75fa527..aeeeb97 100755 --- a/update.sh +++ b/update.sh @@ -1,11 +1,18 @@ #!/bin/bash -GIT_DIRS=(. ~/.vim/bundle ~/.config/nvim) +GIT_DIRS=(. ~/.vim/bundle ~/.config/nvim ~/.tmux/plugins/tpm) for dir in ${GIT_DIRS[@]} ; do + if [ -d "$dir" ] ; then git -C "$dir" git stash git -C "$dir" pull git -C "$dir" git stash pop + else + echo "Skipping: $dir" + fi done -nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" +if type nvim &>/dev/null ; then + nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" +fi + vim -c ":PluginUpdate" -c ":q" -c ":q"