My current statusline (in .vimrc
) contains %F
to show the current filename.
I want to perform a string substitution in %F
.
More specifically I want to substitute ~/remotes/foo
-> [foo]
Examples:
~/remotes/foo/myproject/file.py
->[foo]/myproject/file.py
~/remotes/bar/other_project/main.py
->[bar]/other_project/main.py
In plain Vim I'd do something like s/~\/remotes\/foo/[foo]
.
How to to that in statusline
?
I've tried some combinations like
:set statusline=%F
:set statusline=%{substitute(statusline, 'foo', 'bar', 'g')}
witout success.