Add: json2yaml, nvim, host support & more
This commit is contained in:
parent
82f100058d
commit
f9c314858c
6 changed files with 84 additions and 68 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.swp
|
||||
*.pyc
|
||||
/hosts/lb*
|
||||
|
|
83
bashrc
83
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)"
|
||||
if type nvim &>/dev/null ; then
|
||||
alias vim=nvim
|
||||
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
|
||||
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"
|
||||
|
|
|
@ -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 <leader>bc :<C-U>PudbClearAll<CR>
|
||||
nnoremap <leader>be :<C-U>PudbEdit<CR>
|
||||
nnoremap <leader>bl :<C-U>PudbList<CR>
|
||||
nnoremap <leader>bq :<C-U>PudbQfList<CR>
|
||||
nnoremap <leader>bp :<C-U>PudbToggle<CR>
|
||||
nnoremap <leader>bu :<C-U>PudbUpdate<CR>
|
||||
|
||||
|
||||
" ------------------------------------ Whitespace Highlighting -------------------------------------------
|
||||
autocmd ColorScheme * highlight ExtraWhitespaces ctermbg=red guibg=red
|
||||
"" Extra Whitespace Highlighting
|
||||
|
|
37
hosts/any/bashrc
Normal file
37
hosts/any/bashrc
Normal file
|
@ -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
|
7
setup.sh
7
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
if type nvim &>/dev/null ; then
|
||||
nvim -c "autocmd User PackerComplete quitall" -c "PackerSync"
|
||||
fi
|
||||
|
||||
vim -c ":PluginUpdate" -c ":q" -c ":q"
|
||||
|
|
Loading…
Reference in a new issue