From c5df2fcb7c3abf521154c5a8a821696bb85e5937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Tue, 22 Jan 2013 13:57:33 +0100 Subject: [PATCH] Create awesome looking prompt with divided cwd This is inspired by the look of powerline-shell: https://github.com/milkbikis/powerline-shell --- powerline/config_files/colorschemes/shell/default.json | 8 +++++--- powerline/config_files/themes/shell/default.json | 3 ++- .../config_files/themes/shell/default_leftonly.json | 3 ++- powerline/segments/common.py | 9 +++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/powerline/config_files/colorschemes/shell/default.json b/powerline/config_files/colorschemes/shell/default.json index 5d4ccc2e..7fb4bc64 100644 --- a/powerline/config_files/colorschemes/shell/default.json +++ b/powerline/config_files/colorschemes/shell/default.json @@ -53,10 +53,12 @@ "gradient6": 160 }, "groups": { - "user": { "fg": "brightcyan", "bg": "darkblue", "attr": ["bold"] }, + "user": { "fg": "white", "bg": "darkblue", "attr": ["bold"] }, "superuser": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, - "branch": { "fg": "gray9", "bg": "gray4" }, - "cwd": { "fg": "gray10", "bg": "gray4" }, + "branch": { "fg": "gray9", "bg": "gray2" }, + "cwd": { "fg": "gray9", "bg": "gray4" }, + "cwd:current_folder": { "fg": "gray10", "bg": "gray4", "attr": ["bold"] }, + "cwd:divider": { "fg": "gray7", "bg": "gray4" }, "hostname": { "fg": "brightyellow", "bg": "mediumorange" } } } diff --git a/powerline/config_files/themes/shell/default.json b/powerline/config_files/themes/shell/default.json index 42e7e06c..24712023 100644 --- a/powerline/config_files/themes/shell/default.json +++ b/powerline/config_files/themes/shell/default.json @@ -13,7 +13,8 @@ "name": "cwd", "args": { "dir_limit_depth": 3 - } + }, + "divider_highlight_group": "cwd:divider" } ], "right": [ diff --git a/powerline/config_files/themes/shell/default_leftonly.json b/powerline/config_files/themes/shell/default_leftonly.json index 2b1720ad..5d7c6fca 100644 --- a/powerline/config_files/themes/shell/default_leftonly.json +++ b/powerline/config_files/themes/shell/default_leftonly.json @@ -17,7 +17,8 @@ "name": "cwd", "args": { "dir_limit_depth": 3 - } + }, + "divider_highlight_group": "cwd:divider" } ] } diff --git a/powerline/segments/common.py b/powerline/segments/common.py index 806d9403..3aff4532 100644 --- a/powerline/segments/common.py +++ b/powerline/segments/common.py @@ -82,8 +82,13 @@ def cwd(dir_shorten_len=None, dir_limit_depth=None): del(cwd_split[0:-dir_limit_depth]) cwd_split.insert(0, u'⋯') cwd = [i[0:dir_shorten_len] if dir_shorten_len and i else i for i in cwd_split[:-1]] + [cwd_split[-1]] - cwd = os.path.join(*cwd) - return cwd + ret = [] + for part in cwd: + ret.append({ + 'contents': part, + }) + ret[-1]['highlight_group'] = ['cwd:current_folder', 'cwd'] + return ret def date(format='%Y-%m-%d'):