From: martin f. krafft Date: Tue, 8 Apr 2025 14:55:27 +0000 (+0200) Subject: Merge commit '3e3c8f18c7e13b80a0657d48c3c4fa8f55d9eb68' X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/20c7e83b58359cee70cad87c221f27045aca425e?hp=-c Merge commit '3e3c8f18c7e13b80a0657d48c3c4fa8f55d9eb68' --- 20c7e83b58359cee70cad87c221f27045aca425e diff --combined .vim/bundle/password-store/.projections.json index 00000000,89596b83..89596b83 mode 000000,100644..100644 --- a/.vim/bundle/password-store/.projections.json +++ b/.vim/bundle/password-store/.projections.json @@@ -1,0 -1,18 +1,18 @@@ + { + "t/*.vader" : { + "type" : "test", + "alternate" : [ "autoload/{}.vim", "ftplugin/{}.vim" ] + }, + "autoload/*.vim" : { + "type" : "autoload", + "alternate" : "t/pass.vader" + }, + "ftplugin/*.vim" : { + "type" : "plugin", + "alternate" : "t/{}.vader" + }, + ".scratch/*.vim" : { + "type" : "scratch", + "alternate" : "{}" + } + } diff --combined .vim/bundle/password-store/autoload/password_store.vim index fac5202e,5ac486ed..5ac486ed --- a/.vim/bundle/password-store/autoload/password_store.vim +++ b/.vim/bundle/password-store/autoload/password_store.vim @@@ -1,14 -1,3 +1,3 @@@ - " setup known state - if exists('did_password_store') - " || &compatible - " || version < 700} - finish - endif - let g:did_password_store = '1' - let s:save_cpo = &cpoptions - set compatible&vim - "echo 'main code'}} - " Return vim to users choice function! password_store#generate() abort if executable('pwgen') let l:result = systemlist('pwgen -N1 ' . password_store#setting('pw_length') ) @@@ -33,4 -22,8 +22,8 @@@ function! password_store#setting(key endif endfunction - let &cpoptions = s:save_cpo + function! password_store#get_highight(group, key) abort + let l:hl_line = execute( 'highlight ' . a:group) + let l:key = matchstr(l:hl_line, a:key . '=\zs\S*') + return l:key + endfunction diff --combined .vim/bundle/password-store/ftdetect/pass.vim index 0ce0f48a,408c174e..408c174e --- a/.vim/bundle/password-store/ftdetect/pass.vim +++ b/.vim/bundle/password-store/ftdetect/pass.vim @@@ -1,13 -1,5 +1,5 @@@ - " detect password-store files - if exists('did_pass') || &compatible || version < 700 - finish - endif - let g:did_pass = 'did_pass' - let s:save_cpo = &cpoptions - set compatible&vim - - " this is straight from Tom Ryders plugin - + " this is mostly from Tom Ryders plugin + " with deleyed obfuscation syntax autocmd VimEnter \ /dev/shm/pass.?*/?*.txt \,/dev/shm/gopass-edit*/secret @@@ -15,6 -7,3 +7,3 @@@ \,/tmp/pass.?*/?*.txt \ setlocal filetype=pass | \ if password_store#setting('enable_syntax') ==# 'true' | setlocal syntax=pass.obfuscated | endif - - " Cleanup at end - let &cpoptions = s:save_cpo diff --combined .vim/bundle/password-store/ftplugin/pass.vim index c6a2680a,5c8b41e3..5c8b41e3 --- a/.vim/bundle/password-store/ftplugin/pass.vim +++ b/.vim/bundle/password-store/ftplugin/pass.vim @@@ -3,7 -3,7 +3,7 @@@ if exists('did_pass_ftplugin') || &comp endif let g:did_pass = 'did_pass_ftplugin' let s:save_cpo = &cpoptions - set compatible&vim + set cpoptions&vim nmap rotate_password :call password_store#replace() if ! hasmapto( '\rotate_password', 'n') @@@ -40,19 -40,15 +40,15 @@@ endfunctio call s:CheckArgsRedact() function! s:reveal_pass() abort - highlight! link password_store_password Comment + setlocal syntax=pass endfunction command! Reveal call reveal_pass() function! s:conceal_pass() abort - highlight! password_store_password guifg=DarkGray guibg=DarkGray ctermfg=8 ctermbg=8 + setlocal syntax=pass.obfuscated endfunction command! Conceal call conceal_pass() normal! GG - augroup password_settings_late_load - autocmd! - autocmd FileReadPost if &filetype == 'pass' | echom 'autocmd triggered' | let b:load_pass_syntax = 1 | source 'syntax/pass.vim' | endif - augroup end " Cleanup at end let &cpoptions = s:save_cpo diff --combined .vim/bundle/password-store/syntax/obfuscated.vim index 0a53ea85,8eff972a..8eff972a --- a/.vim/bundle/password-store/syntax/obfuscated.vim +++ b/.vim/bundle/password-store/syntax/obfuscated.vim @@@ -1,21 -1,31 +1,31 @@@ if exists('b:current_syntax') | finish| endif + if execute('highlight CursorLine') =~# 'xxx term=underline cterm=underline guibg=Grey40' + echohl WarningMsg + echo 'cursorline expected for obfuscation, manually setting' + echohl None + highlight CursorLine term=underline ctermbg=gray guibg=Grey40 + endif + setlocal cursorline " set redacted colors from colorscheme - let s:error_highlight_str = execute( 'highlight Error' ) - let s:error_fg = matchstr(s:error_highlight_str, 'guifg=\zs\S*') + " regular passwords are Comment + let s:comment_guifg = password_store#get_highight('Comment', 'guifg') + let s:comment_ctermfg = password_store#get_highight('Comment', 'ctermfg') - let s:comment_highlight_str = execute( 'highlight Comment' ) - let s:comment_fg = matchstr(s:comment_highlight_str, 'guifg=\zs\S*') + " short passwords are Error + let s:error_guifg = password_store#get_highight('Error', 'guifg') + let s:error_ctermfg = password_store#get_highight('Error', 'ctermfg') execute 'highlight password_store_password ' . - \ ' guibg=' . s:comment_fg . - \ ' guifg=' . s:comment_fg . - \ ' ctermfg=1 ctermbg=1' + \ ' guibg=' . s:comment_guifg . + \ ' guifg=' . s:comment_guifg . + \ ' ctermfg=' . s:comment_ctermfg + \ 'ctermbg=' . s:comment_ctermfg execute 'highlight password_store_password_short ' . - \ ' guibg=' . s:error_fg . - \ ' guifg=' . s:error_fg . - \ ' ctermfg=1 ctermbg=1' - + \ ' guibg=' . s:error_guifg . + \ ' guifg=' . s:error_guifg . + \ ' ctermfg=' . s:error_ctermfg + \ 'ctermbg=' . s:error_ctermfg diff --combined .vim/bundle/password-store/syntax/pass.vim index 16457200,4ab26e41..4ab26e41 --- a/.vim/bundle/password-store/syntax/pass.vim +++ b/.vim/bundle/password-store/syntax/pass.vim @@@ -2,11 -2,11 +2,11 @@@ if exists('b:current_syntax') | finish " first line (by convention always a single pasword) syntax match password_store_password /\%1l.*/ - highlight link password_store_password Comment + highlight! link password_store_password Comment " highlight short passwords syntax match password_store_password_short /\%1l.\{,6\}$/ - highlight link password_store_password_short Error + highlight! link password_store_password_short Error " colon field value is the suggested path for additional information syntax match password_store_header '\v^[^:]+:' diff --combined .vim/bundle/password-store/t/pass.vader index aab7688c,e1c5db0b..e1c5db0b --- a/.vim/bundle/password-store/t/pass.vader +++ b/.vim/bundle/password-store/t/pass.vader @@@ -39,4 -39,7 +39,7 @@@ Execute (test ftdetect trigger) AssertEqual password_store#setting('enable_syntax'), 'false' AssertEqual len( password_store#generate() ), 16 + Execute (test highlight group parsing): + Assert password_store#get_highight('Comment', 'guifg') =~# '\v#[0-9a-f]{6}' + Assert password_store#get_highight('Comment', 'not_a_real_group') =~# ''