-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
uni.vim
28 lines (25 loc) · 774 Bytes
/
uni.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
" https://github.com/arp242/uni
command! -range UnicodeName
\ let s:save = @a
\| if <count> is# -1
\| let @a = strcharpart(strpart(getline('.'), col('.') - 1), 0, 1)
\| else
\| exe 'normal! gv"ay'
\| endif
\| echo system('uni -c i', @a)[:-2]
\| let @a = s:save
\| unlet s:save
" Simpler version which works on the current character only:
" command! UnicodeName echo
" \ system('uni -c i', [strcharpart(strpart(getline('.'), col('.') - 1), 0, 1)])[:-2]
" Vim9Script version:
" command -range UnicodeName {
" var save = @a
" if <count> == -1
" @a = strcharpart(strpart(getline('.'), col('.') - 1), 0, 1)
" else
" exe 'normal! gv"ay'
" endif
" echo system('uni -q i', @a)[: -2]
" @a = save
" }