Relative path in lightline, changed it's color.

This commit is contained in:
Bartek Stalewski 2023-01-20 13:01:45 +01:00
parent 6249dd99ae
commit 478adab24c

View File

@ -5,6 +5,7 @@ Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
Plug 'itchyny/lightline.vim' Plug 'itchyny/lightline.vim'
Plug 'itchyny/vim-gitbranch'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'hashivim/vim-terraform' Plug 'hashivim/vim-terraform'
Plug 'bitc/vim-bad-whitespace' Plug 'bitc/vim-bad-whitespace'
@ -76,22 +77,33 @@ let g:gitgutter_sign_modified = '~'
let g:Hexokinase_highlighters = [ 'backgroundfull' ] let g:Hexokinase_highlighters = [ 'backgroundfull' ]
let g:lightline = { let g:lightline = {
\ 'colorscheme': 'ayu',
\ 'active': { \ 'active': {
\ 'left': [ [ 'mode', 'paste' ], \ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename' ] ], \ [ 'readonly', 'gitbranch', 'filename' ] ],
\ 'right': [ [ 'lineinfo' ], \ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ], \ [ 'percent' ],
\ [ 'filetype' ] ] \ [ 'filetype' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'readonly': 'LightLineReadonly'}, \ 'readonly': 'LightLineReadonly',
\ 'filename': 'LightLineFilename',
\ 'gitbranch': 'gitbranch#name'
\ }
\ } \ }
function! LightLineReadonly() function! LightLineReadonly()
return &readonly && &filetype !=# 'help' ? '' : '' return &readonly && &filetype !=# 'help' ? '' : ''
endfunction endfunction
function! LightLineFilename()
let root = fnamemodify(get(b:, 'gitbranch_path'), ':h:h')
let path = expand('%:p')
if path[:len(root)-1] ==# root
return path[len(root)+1:]
endif
return expand('%')
endfunction
if filereadable(glob('~/.local/config/init.vim')) if filereadable(glob('~/.local/config/init.vim'))
source ~/.local/config/init.vim source ~/.local/config/init.vim
endif endif