now it actually works

This commit is contained in:
anon 2024-02-17 16:07:17 +01:00
parent 76f2799670
commit d5df15a674

View File

@ -1,25 +1,14 @@
let s:colorDictionary = {
\ 'red': '31',
\ 'green': '32',
\ 'yellow': '33',
\ 'blue': '34',
\ 'magenta': '35',
\ 'cyan': '36',
\ 'black': '30',
\ 'white': '37',
\ 'bold': '1',
\ 'italics': '3',
\ 'normal': '0',
\ 'reverse': '7'
\ }
" NOTE: keys() & values() return their results in arbitrary order
let s:colorKeys = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'black', 'white', 'bold', 'italics', 'normal', 'reverse']
let s:colorValues = [ '31', '32', '33', '34', '35', '36', '30', '37', '1', '3', '0', '7']
function! s:ColorSelected(id, result)
let val = '\033[' . values(s:colorDictionary)[a:result] . 'm'
let val = '\033[' . s:colorValues[a:result-1] . 'm'
exec 'normal! i' . val
endfunction
function! ShowEscapeDictionary()
call popup_menu(keys(s:colorDictionary), #{
call popup_menu(s:colorKeys, #{
\ callback: 's:ColorSelected',
\ })
endfunction