mirror of
https://github.com/amix/vimrc
synced 2025-02-28 14:12:51 +08:00
add smart path to status line
This commit is contained in:
parent
cb12801cf3
commit
97ee25e786
@ -40,7 +40,7 @@ command Headerfix call HeaderFix()
|
|||||||
command Headerquery call HeaderQuery()
|
command Headerquery call HeaderQuery()
|
||||||
|
|
||||||
|
|
||||||
let localleader=,
|
let localleader=","
|
||||||
nnoremap <localleader>hf :Headerfix<CR>
|
nnoremap <localleader>hf :Headerfix<CR>
|
||||||
nnoremap <localleader>hq :Headerquery<CR>
|
nnoremap <localleader>hq :Headerquery<CR>
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ let g:lightline = {
|
|||||||
\ 'colorscheme': 'wombat',
|
\ 'colorscheme': 'wombat',
|
||||||
\ 'active': {
|
\ 'active': {
|
||||||
\ 'left': [ ['mode', 'paste'],
|
\ 'left': [ ['mode', 'paste'],
|
||||||
\ ['fugitive', 'readonly', 'absolutepath', 'filename', 'modified'] ],
|
\ ['fugitive', 'readonly', 'SmartFilePath', 'filename', 'modified'] ],
|
||||||
\ 'right': [ [ 'lineinfo' ], ['percent'] ]
|
\ 'right': [ [ 'lineinfo' ], ['percent'] ]
|
||||||
\ },
|
\ },
|
||||||
\ 'component': {
|
\ 'component': {
|
||||||
@ -134,10 +134,39 @@ let g:lightline = {
|
|||||||
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
|
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
|
||||||
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
|
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
|
||||||
\ },
|
\ },
|
||||||
|
\ 'component_function': {
|
||||||
|
\ 'SmartFilePath': 'GetSmartFilePath'
|
||||||
|
\ },
|
||||||
\ 'separator': { 'left': ' ', 'right': ' ' },
|
\ 'separator': { 'left': ' ', 'right': ' ' },
|
||||||
\ 'subseparator': { 'left': ' ', 'right': ' ' }
|
\ 'subseparator': { 'left': ' ', 'right': ' ' }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
function! GetSmartFilePath()
|
||||||
|
let path = expand('%:p:h')
|
||||||
|
" If in google3 path, display the client name and the absolute path
|
||||||
|
if matchstr(path, 'google3') == 'google3'
|
||||||
|
let output = ''
|
||||||
|
let subs = split(path, '/')
|
||||||
|
let add_to_output = 0
|
||||||
|
let prev_s = ''
|
||||||
|
for s in subs
|
||||||
|
if add_to_output == 1
|
||||||
|
let output .= '/'
|
||||||
|
let output .= s
|
||||||
|
endif
|
||||||
|
if s == 'google3'
|
||||||
|
let output .= prev_s
|
||||||
|
let output .= ':'
|
||||||
|
let add_to_output = 1
|
||||||
|
endif
|
||||||
|
let prev_s = s
|
||||||
|
endfor
|
||||||
|
return output
|
||||||
|
else
|
||||||
|
return path
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Vimroom
|
" => Vimroom
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
Loading…
Reference in New Issue
Block a user