Switch to powerline prompt.

This commit is contained in:
Ivan Malison 2014-11-20 17:41:17 -08:00
parent b442af27e3
commit b22b1828f9
6 changed files with 82 additions and 5 deletions

View File

@ -0,0 +1,21 @@
{
"name": "Default color scheme for shell prompts",
"groups": {
"user": {"fg": "white", "bg": "blue"},
"hostname": {"fg": "brightyellow", "bg": "mediumorange", "attr": []},
"jobnum": {"fg": "brightyellow", "bg": "mediumorange", "attr": []},
"exit_fail": {"fg": "white", "bg": "darkestred", "attr": []},
"exit_success": {"fg": "white", "bg": "darkestgreen", "attr": []},
"environment": {"fg": "white", "bg": "darkestgreen", "attr": []},
"mode": {"fg": "darkestgreen", "bg": "brightgreen",
"attr": ["bold"] },
"attached_clients": { "fg": "white", "bg": "darkestgreen", "attr": [] }
},
"mode_translations": {
"vicmd": {
"groups": {
"mode": {"fg": "darkestcyan", "bg": "white", "attr": ["bold"]}
}
}
}
}

View File

@ -0,0 +1,39 @@
{
"segments": {
"left": [
{
"function": "powerline.segments.shell.mode"
},
{
"function": "powerline.segments.common.net.hostname",
"priority": 10
},
{
"function": "powerline.segments.common.env.user",
"priority": 30
},
{
"function": "powerline.segments.common.env.virtualenv",
"priority": 50
},
{
"function": "powerline.segments.shell.cwd",
"priority": 10
},
{
"function": "powerline.segments.shell.jobnum",
"priority": 20
}
],
"right": [
{
"function": "powerline.segments.shell.last_pipe_status",
"priority": 10
},
{
"function": "powerline.segments.common.vcs.branch",
"priority": 40
}
]
}
}

@ -1 +1 @@
Subproject commit 1c01f9f1dd642d980f41ec09e9031c5844d2cf3e Subproject commit af17590330dcf1fa5610dd48e9cbcafe269f28b2

View File

@ -65,7 +65,7 @@ function set_bash_prompt() {
╰─$(command_line_character) " ╰─$(command_line_character) "
} }
export PROMPT_COMMAND=set_bash_prompt # export PROMPT_COMMAND=set_bash_prompt
PS2='(%_) ' PS2='(%_) '
@ -74,3 +74,9 @@ case "$TERM" in
export PS1='> ' export PS1='> '
;; ;;
esac esac
function set_powerline_prompt {
source "$(python_module_path powerline)/bindings/bash/powerline.sh"
}
set_powerline_prompt

View File

@ -89,7 +89,7 @@ function digga() {
} }
function shell_stats() { function shell_stats() {
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20 history 0 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
} }
function is_ssh() { function is_ssh() {
@ -260,3 +260,7 @@ function track_modified {
echo "Finding..." echo "Finding..."
find $1 -newer $timestamp_file find $1 -newer $timestamp_file
} }
function python_module_path {
python -c "import os, $1; print(os.path.dirname($1.__file__))"
}

View File

@ -132,7 +132,14 @@ prompt_tomorrow_colors
# For reasons which are currently beyond me, it is not possible to use # For reasons which are currently beyond me, it is not possible to use
# $? in PROMPT which is why the second line is so strangely # $? in PROMPT which is why the second line is so strangely
# constructed. # constructed.
export PROMPT='⚡ % $(print_with_color "%n" "$USERNAME_COLOR") $(separator "at") $(print_with_color "`hostname -s`" "$HOSTNAME_COLOR") $(separator "in") $(print_with_color "`current_directory`" "$CURRENT_DIRECTORY_COLOR")$(git_prompt_info) function set_my_prompt {
export PROMPT='⚡ % $(print_with_color "%n" "$USERNAME_COLOR") $(separator "at") $(print_with_color "`hostname -s`" "$HOSTNAME_COLOR") $(separator "in") $(print_with_color "`current_directory`" "$CURRENT_DIRECTORY_COLOR")$(git_prompt_info)
$(colored_job_count)%(?.$(print_with_color "$(command_line_character) " $PROMPT_CHAR_SUCCESS).$(print_with_color "$(command_line_character) " $PROMPT_CHAR_ERROR)) ' $(colored_job_count)%(?.$(print_with_color "$(command_line_character) " $PROMPT_CHAR_SUCCESS).$(print_with_color "$(command_line_character) " $PROMPT_CHAR_ERROR)) '
export PS2='(%_) '
}
PS2='(%_) ' function set_powerline_prompt {
source "$(python_module_path powerline)/bindings/zsh/powerline.zsh"
}
set_powerline_prompt