diff --git a/README.md b/README.md index f060df3..ea07dcf 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ HISTORY - CHG: ingo#query#get#[Writable]Register(): Turn a:errorRegister and a:invalidRegisterExpr into option Dict values and add a:options.additionalValidExpr +- Add ingo/digraph.vim module. ##### 1.043 04-Feb-2022 - Minor: Actually support no-argument form of diff --git a/autoload/ingo/digraph.vim b/autoload/ingo/digraph.vim new file mode 100644 index 0000000..eb0819a --- /dev/null +++ b/autoload/ingo/digraph.vim @@ -0,0 +1,32 @@ +" ingo/digraph.vim: Functions around digraphs. +" +" DEPENDENCIES: +" +" Copyright: (C) 2022 Ingo Karkat +" The VIM LICENSE applies to this script; see ':help copyright'. +" +" Maintainer: Ingo Karkat + +" Source: http://stackoverflow.com/a/18726519/813602 +" Source: unicode#Digraph(char) in https://github.com/chrisbra/unicode.vim/blob/eddd9791c226a211fc3e433d5ecccb836364dd86/autoload/unicode.vim#L85 +function! ingo#digraph#Get( char, ... ) abort +"****************************************************************************** +"* PURPOSE: +" Obtain the digraph expansion of a:char. +"* ASSUMPTIONS / PRECONDITIONS: +" None. +"* EFFECTS / POSTCONDITIONS: +" None. +"* INPUTS: +" a:char First char or two-char combination. +" a:char2 Second char (optional). +"* RETURN VALUES: +" Digraph or fallback; i.e. exactly what would be returned by typing CTRL-K + +" a:char + a:char2 +"****************************************************************************** + let s:digraph = '' + execute 'silent normal!' ":\" . a:char . join(a:000, '') . "\eextend(s:, {'digraph': getcmdline()}).digraph\n" + return s:digraph +endfunction + +" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : diff --git a/doc/ingo-library.txt b/doc/ingo-library.txt index d432585..70afb45 100644 --- a/doc/ingo-library.txt +++ b/doc/ingo-library.txt @@ -215,6 +215,7 @@ HISTORY *ingo-library-history* - CHG: ingo#query#get#[Writable]Register(): Turn a:errorRegister and a:invalidRegisterExpr into option Dict values and add a:options.additionalValidExpr +- Add ingo/digraph.vim module. 1.043 04-Feb-2022 - Minor: Actually support no-argument form of diff --git a/ingo-library.manifest b/ingo-library.manifest index 3375371..ef966b2 100644 --- a/ingo-library.manifest +++ b/ingo-library.manifest @@ -61,6 +61,7 @@ autoload/ingo/dict.vim autoload/ingo/dict/count.vim autoload/ingo/dict/find.vim autoload/ingo/digest.vim +autoload/ingo/digraph.vim autoload/ingo/encoding.vim autoload/ingo/err.vim autoload/ingo/escape.vim