This may not be a problem, But I am confused about configuring full path of current file.
Could you please show me ?
Use absolutepath component:
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'absolutepath', 'modified' ] ],
\ }
\ }
Is there a configure that can show the file path relative to project root directory?
Assuming you are working on git repositories, configure as follows
let g:lightline = {
\ 'component_function': {
\ 'filename': 'LightlineFilename',
\ }
\ }
function! LightlineFilename()
let root = fnamemodify(get(b:, 'git_dir'), ':h')
let path = expand('%:p')
if path[:len(root)-1] ==# root
return path[len(root)+1:]
endif
return expand('%')
endfunction
Note that this configuration requires vim-fugitive plugin.
If you have vim-gitbranch plugin installed, replace the let root line with as follows.
let root = fnamemodify(get(b:, 'gitbranch_path'), ':h:h')
it works, awesome, @itchyny thanks for the quick reply
@itchyny my hero :)
Hi it's work great, thank you! Just have to made small adjustment on Windows that root variable was C:\...\... and path variable was C:/.../... at least with fugitive. Then It didn't match because of different file separator symbol.
Most helpful comment
Assuming you are working on git repositories, configure as follows
Note that this configuration requires vim-fugitive plugin.
If you have vim-gitbranch plugin installed, replace the
let rootline with as follows.