Add: Powerline
This commit is contained in:
parent
ae29c3dd33
commit
a2737098ee
7 changed files with 269 additions and 19 deletions
45
bashrc
45
bashrc
|
@ -15,7 +15,6 @@ else
|
||||||
USER=$(whoami)
|
USER=$(whoami)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PS1='\[\033[0;32m\]${USER}@\h\[\033[0m\] [\[\033[0;33m\]\w\[\]\[\033[0;32m\]]\n'$PROMPT_SUFFIX
|
|
||||||
export PATH=$PATH:~/bin:~/local/bin
|
export PATH=$PATH:~/bin:~/local/bin
|
||||||
|
|
||||||
function tmux_title {
|
function tmux_title {
|
||||||
|
@ -23,17 +22,30 @@ function tmux_title {
|
||||||
}
|
}
|
||||||
#tmux_title $(hostname -s)
|
#tmux_title $(hostname -s)
|
||||||
|
|
||||||
# Git prompt
|
# load powerline
|
||||||
GIT_PROMPT_ONLY_IN_REPO=1
|
if which powerline-daemon &>/dev/null; then
|
||||||
GIT_PROMPT_FETCH_REMOTE_STATUS=0
|
powerline-daemon -q
|
||||||
GIT_PROMPT_IGNORE_STASH=1
|
POWERLINE_BASH_CONTINUATION=1
|
||||||
GIT_PROMPT_THEME=Noldorized
|
POWERLINE_BASH_SELECT=1
|
||||||
source ~/.bash-git-prompt/gitprompt.sh
|
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 {
|
function prompt_callback {
|
||||||
REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | head -1)
|
REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | head -1)
|
||||||
gp_set_window_title "$REPO($GIT_BRANCH)"
|
gp_set_window_title "$REPO($GIT_BRANCH)"
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
PYVERSION=$(python3 --version | grep -Eo '[0-9]\.[0-9]')
|
||||||
|
if [ -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
|
||||||
|
|
||||||
# LS_COLORS
|
# LS_COLORS
|
||||||
eval $(dircolors -b $HOME/.dircolors)
|
eval $(dircolors -b $HOME/.dircolors)
|
||||||
|
@ -80,6 +92,11 @@ alias kga="kubectl get all --all-namespaces -o wide"
|
||||||
alias kgn="kubectl get nodes -o wide"
|
alias kgn="kubectl get nodes -o wide"
|
||||||
alias kgp="kubectl get pods -o wide"
|
alias kgp="kubectl get pods -o wide"
|
||||||
|
|
||||||
type kubectl &>/dev/null && source <(kubectl completion bash)
|
# Completions for various tools...
|
||||||
type helm &>/dev/null && source <(helm completion bash)
|
for bin in kubectl helm talosctl ; do
|
||||||
type talosctl &>/dev/null && source <(talosctl completion bash)
|
type $bin &>/dev/null && source <($bin completion bash)
|
||||||
|
done
|
||||||
|
|
||||||
|
if type dpkg &>/dev/null && ! dpkg -l fonts-powerline &>/dev/null; then
|
||||||
|
echo "Notice: Please install fonts-powerline"
|
||||||
|
fi
|
||||||
|
|
66
config/powerline/colorschemes/default.json
Normal file
66
config/powerline/colorschemes/default.json
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{
|
||||||
|
"name": "Default",
|
||||||
|
"groups": {
|
||||||
|
"information:additional": { "fg": "gray9", "bg": "gray4", "attrs": [] },
|
||||||
|
"information:regular": { "fg": "gray10", "bg": "gray4", "attrs": ["bold"] },
|
||||||
|
"information:highlighted": { "fg": "white", "bg": "gray4", "attrs": [] },
|
||||||
|
"information:priority": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
|
||||||
|
"warning:regular": { "fg": "white", "bg": "brightred", "attrs": ["bold"] },
|
||||||
|
"critical:failure": { "fg": "white", "bg": "darkestred", "attrs": [] },
|
||||||
|
"critical:success": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
|
||||||
|
"background": { "fg": "white", "bg": "gray0", "attrs": [] },
|
||||||
|
"background:divider": { "fg": "gray5", "bg": "gray0", "attrs": [] },
|
||||||
|
"session": { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
|
||||||
|
"date": { "fg": "gray8", "bg": "gray2", "attrs": [] },
|
||||||
|
"time": { "fg": "gray10", "bg": "gray2", "attrs": ["bold"] },
|
||||||
|
"time:divider": { "fg": "gray5", "bg": "gray2", "attrs": [] },
|
||||||
|
"email_alert": "warning:regular",
|
||||||
|
"email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attrs": ["bold"] },
|
||||||
|
"hostname": { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
|
||||||
|
"weather": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"weather_temp_gradient": { "fg": "blue_red", "bg": "gray0", "attrs": [] },
|
||||||
|
"weather_condition_hot": { "fg": "khaki1", "bg": "gray0", "attrs": [] },
|
||||||
|
"weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0", "attrs": [] },
|
||||||
|
"weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0", "attrs": [] },
|
||||||
|
"uptime": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"external_ip": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"internal_ip": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"network_load": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"network_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] },
|
||||||
|
"network_load:divider": "background:divider",
|
||||||
|
"system_load": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"system_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] },
|
||||||
|
"environment": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"cpu_load_percent": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"cpu_load_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] },
|
||||||
|
"battery": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"battery_gradient": { "fg": "white_red", "bg": "gray0", "attrs": [] },
|
||||||
|
"battery_full": { "fg": "red", "bg": "gray0", "attrs": [] },
|
||||||
|
"battery_empty": { "fg": "white", "bg": "gray0", "attrs": [] },
|
||||||
|
"player": { "fg": "gray10", "bg": "black", "attrs": [] },
|
||||||
|
"user": { "fg": "white", "bg": "darkblue", "attrs": ["bold"] },
|
||||||
|
"branch": { "fg": "gray9", "bg": "gray2", "attrs": [] },
|
||||||
|
"branch_dirty": { "fg": "brightyellow", "bg": "gray2", "attrs": [] },
|
||||||
|
"branch_clean": { "fg": "gray9", "bg": "gray2", "attrs": [] },
|
||||||
|
"branch:divider": { "fg": "gray7", "bg": "gray2", "attrs": [] },
|
||||||
|
"cwd": "information:additional",
|
||||||
|
"cwd:current_folder": "information:regular",
|
||||||
|
"cwd:divider": { "fg": "gray7", "bg": "gray4", "attrs": [] },
|
||||||
|
"virtualenv": { "fg": "white", "bg": "darkcyan", "attrs": [] },
|
||||||
|
"attached_clients": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||||
|
"gitstatus": { "fg": "gray8", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_branch": { "fg": "gray8", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_branch_clean": { "fg": "green", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_branch_dirty": { "fg": "gray8", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_branch_detached": { "fg": "mediumpurple", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_tag": { "fg": "solarized:base2", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_behind": { "fg": "gray10", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_ahead": { "fg": "gray10", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_staged": { "fg": "green", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_unmerged": { "fg": "brightred", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_changed": { "fg": "mediumorange", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_untracked": { "fg": "brightestorange", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus_stashed": { "fg": "darkblue", "bg": "gray2", "attrs": [] },
|
||||||
|
"gitstatus:divider": { "fg": "gray8", "bg": "gray2", "attrs": [] }
|
||||||
|
}
|
||||||
|
}
|
50
config/powerline/colorschemes/solarized.json
Normal file
50
config/powerline/colorschemes/solarized.json
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"name": "Solarized dark",
|
||||||
|
"groups": {
|
||||||
|
"information:additional": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
|
||||||
|
"information:regular": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"] },
|
||||||
|
"information:highlighted": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"]},
|
||||||
|
"information:priority": { "fg": "solarized:base3", "bg": "solarized:yellow", "attrs": [] },
|
||||||
|
"warning:regular": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": [] },
|
||||||
|
"critical:failure": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": [] },
|
||||||
|
"critical:success": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||||
|
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"background:divider": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"user": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] },
|
||||||
|
"virtualenv": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||||
|
"branch": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"branch_clean": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"email_alert_gradient": { "fg": "solarized:base3", "bg": "yellow_orange_red", "attrs": [] },
|
||||||
|
"email_alert": "warning:regular",
|
||||||
|
"cwd": "information:additional",
|
||||||
|
"cwd:current_folder": "information:regular",
|
||||||
|
"cwd:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attrs": [] },
|
||||||
|
"network_load": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||||
|
"network_load:divider": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||||
|
"hostname": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
|
||||||
|
"environment": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||||
|
"attached_clients": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||||
|
"date": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"time": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": ["bold"] },
|
||||||
|
"time:divider": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"system_load": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||||
|
"weather_temp_gradient": { "fg": "blue_red", "bg": "solarized:base03", "attrs": [] },
|
||||||
|
"weather": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||||
|
"uptime": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||||
|
"gitstatus": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_branch": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_branch_clean": { "fg": "solarized:green", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_branch_dirty": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_branch_detached": { "fg": "solarized:magenta", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_tag": { "fg": "solarized:base2", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_behind": { "fg": "solarized:base2", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_ahead": { "fg": "solarized:base2", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_staged": { "fg": "solarized:green", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_unmerged": { "fg": "solarized:red", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_changed": { "fg": "solarized:orange", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_untracked": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus_stashed": { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
|
||||||
|
"gitstatus:divider": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] }
|
||||||
|
}
|
||||||
|
}
|
52
config/powerline/default.json
Normal file
52
config/powerline/default.json
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"common": {
|
||||||
|
"term_truecolor": false
|
||||||
|
},
|
||||||
|
"ext": {
|
||||||
|
"ipython": {
|
||||||
|
"colorscheme": "default",
|
||||||
|
"theme": "in",
|
||||||
|
"local_themes": {
|
||||||
|
"rewrite": "rewrite",
|
||||||
|
"out": "out",
|
||||||
|
"in2": "in2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pdb": {
|
||||||
|
"colorscheme": "default",
|
||||||
|
"theme": "default"
|
||||||
|
},
|
||||||
|
"shell": {
|
||||||
|
"colorscheme": "solarized",
|
||||||
|
"theme": "default",
|
||||||
|
"local_themes": {
|
||||||
|
"continuation": "continuation",
|
||||||
|
"select": "select"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tmux": {
|
||||||
|
"colorscheme": "default",
|
||||||
|
"theme": "default"
|
||||||
|
},
|
||||||
|
"vim": {
|
||||||
|
"colorscheme": "solarized",
|
||||||
|
"theme": "default",
|
||||||
|
"local_themes": {
|
||||||
|
"__tabline__": "tabline",
|
||||||
|
|
||||||
|
"cmdwin": "cmdwin",
|
||||||
|
"help": "help",
|
||||||
|
"quickfix": "quickfix",
|
||||||
|
|
||||||
|
"powerline.matchers.vim.plugin.nerdtree.nerdtree": "plugin_nerdtree",
|
||||||
|
"powerline.matchers.vim.plugin.commandt.commandt": "plugin_commandt",
|
||||||
|
"powerline.matchers.vim.plugin.gundo.gundo": "plugin_gundo",
|
||||||
|
"powerline.matchers.vim.plugin.gundo.gundo_preview": "plugin_gundo-preview"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wm": {
|
||||||
|
"colorscheme": "default",
|
||||||
|
"theme": "default"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
config/powerline/themes/shell/default.json
Normal file
48
config/powerline/themes/shell/default.json
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"default_module": "powerline.segments.common",
|
||||||
|
"segments": {
|
||||||
|
"left": [
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.shell.mode"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.common.net.hostname",
|
||||||
|
"args": {
|
||||||
|
"only_if_ssh": true,
|
||||||
|
"exclude_domain": true
|
||||||
|
},
|
||||||
|
"priority": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.common.env.virtualenv",
|
||||||
|
"priority": 30
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.common.env.user",
|
||||||
|
"priority": 30
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.shell.cwd",
|
||||||
|
"args": {
|
||||||
|
"dir_shorten_len": 3,
|
||||||
|
"dir_limit_depth": 3,
|
||||||
|
"use_path_separator": true
|
||||||
|
},
|
||||||
|
"priority": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.shell.jobnum",
|
||||||
|
"priority": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "powerline.segments.shell.last_pipe_status",
|
||||||
|
"priority": 10
|
||||||
|
}
|
||||||
|
,"right": [
|
||||||
|
{
|
||||||
|
"function": "powerline_gitstatus.gitstatus",
|
||||||
|
"priority": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
powerline-status
|
||||||
|
powerline-gitstatus
|
25
setup.sh
25
setup.sh
|
@ -1,20 +1,35 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
LINK_FILES=(vimrc tmux.conf gitconfig dircolors)
|
LINK_FILES=(vimrc tmux.conf gitconfig dircolors)
|
||||||
mkdir ~/.home-git-back 2>/dev/null
|
mkdir -p ~/.config/home-git-back/config 2>/dev/null
|
||||||
for file in ${LINK_FILES[@]}; do
|
for file in ${LINK_FILES[@]}; do
|
||||||
if [ ! -L ~/.${file} ] ; then
|
if [ ! -L ~/.${file} ] ; then
|
||||||
mv -v ~/.${file} ~/.home-git-back
|
mv -v ~/.${file} ~/.config/home-git-back
|
||||||
ln -s $(pwd)/${file} ~/.${file}
|
ln -s $(pwd)/${file} ~/.${file}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Link .config dirs
|
||||||
|
for file in config/*; do
|
||||||
|
dir=$(basename $file)
|
||||||
|
if [ ! -L ~/.config/${dir} ] ; then
|
||||||
|
mv -v ~/.config/${dir} ~/.config/home-git-back/config
|
||||||
|
ln -s $(pwd)/${file} ~/.config/${dir}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
[ ! -d ~/.bash-git-prompt ] && git clone https://github.com/nold360/bash-git-prompt.git ~/.bash-git-prompt
|
# Install powerline if possible
|
||||||
|
if which pip3 ; then
|
||||||
|
pip3 install -U -r requirements.txt
|
||||||
|
else
|
||||||
|
[ ! -d ~/.bash-git-prompt ] && git clone https://github.com/nold360/bash-git-prompt.git ~/.bash-git-prompt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install vundle plugin manager & plugins
|
||||||
mkdir -p ~/.vim/bundle 2>/dev/null
|
mkdir -p ~/.vim/bundle 2>/dev/null
|
||||||
[ ! -d ~/.vim/bundle/Vundle.vim ] && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
[ ! -d ~/.vim/bundle/Vundle.vim ] && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||||
|
|
||||||
vim -c ":PluginInstall" -c ":q" -c ":q"
|
vim -c ":PluginInstall" -c ":q" -c ":q"
|
||||||
|
|
||||||
grep -q "source $(pwd)/bashrc" ~/.bashrc || echo "source $(pwd)/bashrc" >> ~/.bashrc
|
grep -qE "^source.*$(pwd)/bashrc" ~/.bashrc || echo "source $(pwd)/bashrc" >> ~/.bashrc
|
||||||
|
echo Done
|
||||||
|
|
Loading…
Reference in a new issue