vim: show at most 2ch in tabline path & grep lists

This commit is contained in:
2025-07-07 14:18:09 +08:00
parent 21846cde66
commit 11d499a987

13
vimrc
View File

@@ -152,9 +152,10 @@ function MyTabLabel(n)
let pathparts = split(name, '/')
if len(pathparts) == 1
return name
elseif len(pathparts[len(pathparts) - 2]) == 1
return pathparts[len(pathparts) - 2][0] . '/' . pathparts[len(pathparts) - 1]
else
return pathparts[len(pathparts) - 2] . '/' . pathparts[len(pathparts) - 1]
"return pathparts[len(pathparts) - 1]
return pathparts[len(pathparts) - 2][0:1] . '/' . pathparts[len(pathparts) - 1]
endif
endif
endfunction
@@ -351,6 +352,14 @@ set t_8b=[48:2::%lu:%lu:%lum
command -nargs=* C !g++ %:p <Args>
command -nargs=* CR rightb 15split +term\ g++\ <Args>\ %:p\ &&\ ./a.out
command R rightb 15split +term\ ./a.out
command! -nargs=+ -complete=custom,s:GrepArgs G exe 'CocList --normal grep '.<q-args>
function! s:GrepArgs(...)
let list = ['-S', '-smartcase', '-i', '-ignorecase', '-w', '-word',
\ '-e', '-regex', '-u', '-skip-vcs-ignores', '-t', '-extension']
return join(list, "\n")
endfunction
function MyCDB(file)
tabe '+term g++ -g '. file .' && gdbtui ./a.out'