Shorten /home/foo/ to ~foo in vim file directory segment

Replace "/home/foo/" with "~foo" (foo's home, not current user's).
This shortens paths like /home/www-data/foo/.

Closes #115.
This commit is contained in:
Daniel Hahler 2013-01-23 23:45:16 +01:00 committed by Kim Silkebækken
parent bacb260312
commit 0d2056ab04
1 changed files with 2 additions and 0 deletions

View File

@ -81,6 +81,8 @@ def readonly_indicator(text=u''):
def file_directory(): def file_directory():
'''Return file directory (head component of the file path).''' '''Return file directory (head component of the file path).'''
file_directory = vim_funcs['expand']('%:~:.:h') file_directory = vim_funcs['expand']('%:~:.:h')
if file_directory.startswith('/home/'):
file_directory = '~' + file_directory[6:]
return file_directory.decode('utf-8') + os.sep if file_directory else None return file_directory.decode('utf-8') + os.sep if file_directory else None