fix(runtime): fully port emoji_list to Lua

Problem: `runtime/tools/emoji_list.vim` is a Lua script masquerading as
Vimscript, which is unnecessary now that `:source` works for Lua files.

Solution: Remove Vimscript wrapper.
This commit is contained in:
Christian Clason 2024-10-05 13:11:16 +02:00
parent 056009f741
commit 9788b81d7e
5 changed files with 22 additions and 24 deletions

View File

@ -6627,7 +6627,7 @@ setcellwidths({list}) *setcellwidths()*
To clear the overrides pass an empty {list}: >vim
call setcellwidths([])
< You can use the script $VIMRUNTIME/tools/emoji_list.vim to see
< You can use the script $VIMRUNTIME/tools/emoji_list.lua to see
the effect for known emoji characters. Move the cursor
through the text to check if the cell widths of your terminal
match with what Vim knows about each emoji. If it doesn't

View File

@ -7904,7 +7904,7 @@ function vim.fn.setbufvar(buf, varname, val) end
--- To clear the overrides pass an empty {list}: >vim
--- call setcellwidths([])
---
--- <You can use the script $VIMRUNTIME/tools/emoji_list.vim to see
--- <You can use the script $VIMRUNTIME/tools/emoji_list.lua to see
--- the effect for known emoji characters. Move the cursor
--- through the text to check if the cell widths of your terminal
--- match with what Vim knows about each emoji. If it doesn't

View File

@ -0,0 +1,19 @@
-- Script to fill the window with emoji characters, one per line.
-- Source this script: :source %
if vim.bo.modified then
vim.cmd.new()
else
vim.cmd.enew()
end
local lnum = 1
for c = 0x100, 0x1ffff do
local cs = vim.fn.nr2char(c)
if vim.fn.charclass(cs) == 3 then
vim.fn.setline(lnum, string.format('|%s| %d', cs, vim.fn.strwidth(cs)))
lnum = lnum + 1
end
end
vim.bo.modified = false

View File

@ -1,21 +0,0 @@
" Script to fill the window with emoji characters, one per line.
" Source this script: :source %
if &modified
new
else
enew
endif
lua << EOF
local lnum = 1
for c = 0x100, 0x1ffff do
local cs = vim.fn.nr2char(c)
if vim.fn.charclass(cs) == 3 then
vim.fn.setline(lnum, '|' .. cs .. '| ' .. vim.fn.strwidth(cs))
lnum = lnum + 1
end
end
EOF
set nomodified

View File

@ -9464,7 +9464,7 @@ M.funcs = {
To clear the overrides pass an empty {list}: >vim
call setcellwidths([])
<You can use the script $VIMRUNTIME/tools/emoji_list.vim to see
<You can use the script $VIMRUNTIME/tools/emoji_list.lua to see
the effect for known emoji characters. Move the cursor
through the text to check if the cell widths of your terminal
match with what Vim knows about each emoji. If it doesn't