vimvim-pluginstatuslinevim-powerline

How to truncate long file path in vim-powerline statusline?


I would like to truncate my file path to ex: a/a/j/c/popularCategories.js.

my powerline status


Solution

  • There are two options.

    Try this option:

        let g:Powerline_stl_path_style = 'short'
    

    From the powerline docs:

    short      Display a short path. The home directory is substituted with
               "~", the first directory is displayed with its full name, and
               subsequent directories are shortened to their first letter.
               I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and
               "long/relative/path/foo/bar/baz.vim becomes
               "long/r/p/f/b/baz.vim".
    

    Or, if you want the path truncated like Vim's default statusline, then you can create a theme that moves the truncation point. Try my sanity theme and see if it works better for you.