Formatter: Use pathshorten() instead of substitute()
The default formatter uses a hand-build regexp for shortening the path in the tabline. However, since it uses the \w regex atom, this won't match e.g. cyrillic letters. To fix this, use the builtin pathshorten() function which does handle this case correctly. For a test, use e.g. 'D/Учёба/t.c' closes #1737
This commit is contained in:
parent
044a90ed55
commit
1bb1ce594a
@ -18,7 +18,9 @@ function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
|||||||
let _ .= '[No Name]'
|
let _ .= '[No Name]'
|
||||||
else
|
else
|
||||||
if s:fnamecollapse
|
if s:fnamecollapse
|
||||||
let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
" Does not handle non-ascii characters like Cyrillic: 'D/Учёба/t.c'
|
||||||
|
"let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
||||||
|
let _ .= pathshorten(fnamemodify(name, fmod))
|
||||||
else
|
else
|
||||||
let _ .= fnamemodify(name, fmod)
|
let _ .= fnamemodify(name, fmod)
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user