1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-22 08:45:42 +08:00
2023-03-26 13:50:22 +08:00

42 lines
1.0 KiB
VimL

"=============================================================================
" ctrlg.vim --- display info via Ctrl-g
" Copyright (c) 2016-2023 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
if exists('s:loaded')
finish
endif
let s:loaded = 1
let s:save_cpo = &cpo
set cpo&vim
let s:win = has("win32") || has("win64") || has("win16")
let s:lang = exists("$LANG") ? tolower($LANG[:1]) : 'en'
function! SpaceVim#plugins#ctrlg#display() abort
let pwd = getcwd()
if isdirectory('.git')
let project_name = printf('[%s]', fnamemodify(pwd, ':t'))
else
let project_name = ''
endif
let file = fnamemodify(expand('%'), '.')
if !empty(project_name)
echohl Constant | echo project_name
echohl WarningMsg | echon " >> "
endif
echohl Special | echon pwd
echohl WarningMsg | echon " >> "
echohl Directory | echon file
endfun
let &cpo = s:save_cpo
unlet s:save_cpo