[Powerline] Display full file path in Powerline for Vim?

316 views
Skip to first unread message

Phong Cao

unread,
Jan 15, 2016, 12:55:35 PM1/15/16
to powerline

Hi,

I just want to know how to show full file path in Powerline for Vim? I mean normally without Powerline I would add something like the following to my .vimrc to show the full file path:


set statusline+=%F

However, in Powerline for Vim, only the file name is displayed (for example, ./.vimrc when I open .vimrc from my home directory). How can I display the full file path in Vim with Powerline?


Thank you for your help.


Best regards,



Phong Cao

Nikolay Aleksandrovich Pavlov

unread,
Jan 15, 2016, 2:16:40 PM1/15/16
to Phong Cao, powerline
Did you read the documentation?

--
You received this message because you are subscribed to the Google Groups "powerline" group.
To unsubscribe from this group and stop receiving emails from it, send an email to powerline-supp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phong Cao

unread,
Jan 15, 2016, 3:16:13 PM1/15/16
to powerline, phon...@gmail.com
Hi Nikolay,

I did read the documentation but still not knowing specifically how to modify the statusline? I tried something like this in my vimrc:

set statusline+=!py3eval('powerline.segments.vim.file_directory(shorten_cwd=False)')

but it doesn't work :(

Maybe I am doing something wrong or there is something I am not clear about powerline. I mostly modified powerline through its *.json files and have never got this deep into powerline's Python functions.

Vào 11:16:40 UTC-8 Thứ Sáu, ngày 15 tháng 1 năm 2016, Nikolay Aleksandrovich Pavlov đã viết:

Nikolay Aleksandrovich Pavlov

unread,
Jan 15, 2016, 8:36:08 PM1/15/16
to Phong Cao, powerline
2016-01-15 23:16 GMT+03:00 Phong Cao <phon...@gmail.com>:
Hi Nikolay,

I did read the documentation but still not knowing specifically how to modify the statusline? I tried something like this in my vimrc:

set statusline+=!py3eval('powerline.segments.vim.file_directory(shorten_cwd=False)')

but it doesn't work :(

​Do not touch &statusline option. Also do not edit anything in powerline repository. You should use ~/.config/powerline/themes/vim/__main__.json file​ with segment_data/powerline.segments.vim.file_directory/args/shorten_cwd (it should contain four nested dictionaries) set to `false`. More details in configuration reference. You may also use existing from powerline/config_files/themes/vim/__main__.json as a reference.

Nikolay Aleksandrovich Pavlov

unread,
Jan 15, 2016, 8:46:47 PM1/15/16
to Phong Cao, powerline
2016-01-15 23:16 GMT+03:00 Phong Cao <phon...@gmail.com>:
Hi Nikolay,

I did read the documentation but still not knowing specifically how to modify the statusline? I tried something like this in my vimrc:

set statusline+=!py3eval('powerline.segments.vim.file_directory(shorten_cwd=False)')

but it doesn't work :(

Maybe I am doing something wrong or there is something I am not clear about powerline. I mostly modified powerline through its *.json files and have never got this deep into powerline's Python functions.

Segment function reference is present there exactly to make user know what to edit in *json* files: arguments to segment functions described in documentation are reference to `args` JSON dictionary key (which is mentioned in this key’s description). If you need to call segment directly (e.g. for debugging purposes) then you have missed two additional keyword arguments: pl (PowerlineLogger instance) and segment_info (dictionary with various information, including which buffer to return file_directory for).

Phong Cao

unread,
Jan 16, 2016, 11:17:33 PM1/16/16
to powerline, phon...@gmail.com
Hi Nikolai,

It worked! Thank you very much I understand a lot more now.

Vào 17:46:47 UTC-8 Thứ Sáu, ngày 15 tháng 1 năm 2016, Nikolay Aleksandrovich Pavlov đã viết:

Tankor Smash

unread,
May 3, 2016, 5:43:57 PM5/3/16
to powerline, phon...@gmail.com
For everyone else, plain and simple:

In ~/.config/powerline/themes/vim/__main__.json:

{
"segment_data": {
"file_directory": {
"args": {
"shorten_cwd": false
}
}
}
}


The docs are not very clear, if you come in not knowing anything about the way it works at all. I'm sure it's great if you've already invested time into it though.
Reply all
Reply to author
Forward
0 new messages