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:
parent
bacb260312
commit
0d2056ab04
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue