Create awesome looking prompt with divided cwd
This is inspired by the look of powerline-shell: https://github.com/milkbikis/powerline-shell
This commit is contained in:
parent
a023f4ad10
commit
c5df2fcb7c
|
@ -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" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"name": "cwd",
|
||||
"args": {
|
||||
"dir_limit_depth": 3
|
||||
}
|
||||
},
|
||||
"divider_highlight_group": "cwd:divider"
|
||||
}
|
||||
],
|
||||
"right": [
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
"name": "cwd",
|
||||
"args": {
|
||||
"dir_limit_depth": 3
|
||||
}
|
||||
},
|
||||
"divider_highlight_group": "cwd:divider"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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'):
|
||||
|
|
Loading…
Reference in New Issue