aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-10-05 13:11:16 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-10-06 12:44:50 +0200
commit9788b81d7e53e7ad1ca9db249d86e43426ce56c2 (patch)
treeffd9b14b23f745d33cbbe8ca3254b1cce27217e9
parent056009f74146b349c66790fbcba3130e85a6c6da (diff)
downloadrneovim-9788b81d7e53e7ad1ca9db249d86e43426ce56c2.tar.gz
rneovim-9788b81d7e53e7ad1ca9db249d86e43426ce56c2.tar.bz2
rneovim-9788b81d7e53e7ad1ca9db249d86e43426ce56c2.zip
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.
-rw-r--r--runtime/doc/builtin.txt2
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua2
-rw-r--r--runtime/tools/emoji_list.lua19
-rw-r--r--runtime/tools/emoji_list.vim21
-rw-r--r--src/nvim/eval.lua2
5 files changed, 22 insertions, 24 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index d76cf96762..fe186466e9 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -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
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index 649805f447..3eb2f2382d 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -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
diff --git a/runtime/tools/emoji_list.lua b/runtime/tools/emoji_list.lua
new file mode 100644
index 0000000000..63bbbe4371
--- /dev/null
+++ b/runtime/tools/emoji_list.lua
@@ -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
diff --git a/runtime/tools/emoji_list.vim b/runtime/tools/emoji_list.vim
deleted file mode 100644
index c335b8c88f..0000000000
--- a/runtime/tools/emoji_list.vim
+++ /dev/null
@@ -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
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 4545ad1149..f1615fc069 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -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