aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-10-17 11:16:16 +0200
committerJustin M. Keyes <justinkz@gmail.com>2024-10-21 00:54:43 +0200
commit18b43c331d8a0ed87d7cbefe2a18543b8e4ad360 (patch)
tree6cc88b23ade96b1804aeb1ef0870252c293d2878 /test/functional/lua
parent960fdc775a88389d8b19389b8c74c98921b9acac (diff)
downloadrneovim-18b43c331d8a0ed87d7cbefe2a18543b8e4ad360.tar.gz
rneovim-18b43c331d8a0ed87d7cbefe2a18543b8e4ad360.tar.bz2
rneovim-18b43c331d8a0ed87d7cbefe2a18543b8e4ad360.zip
refactor: rename vim.highlight => vim.hl
Problem: - `vim.highlight` module does not follow `:help dev-name-common`, which documents the name for "highlight" as "hl". - Shorter names are usually preferred. Solution: Rename `vim.highlight` to `vim.hl`. This is not a breaking change until 2.0 (or maybe never).
Diffstat (limited to 'test/functional/lua')
-rw-r--r--test/functional/lua/hl_spec.lua (renamed from test/functional/lua/highlight_spec.lua)28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/hl_spec.lua
index c048949df8..a123c79ffb 100644
--- a/test/functional/lua/highlight_spec.lua
+++ b/test/functional/lua/hl_spec.lua
@@ -9,7 +9,7 @@ local command = n.command
local clear = n.clear
local api = n.api
-describe('vim.highlight.range', function()
+describe('vim.hl.range', function()
local screen
before_each(function()
@@ -33,7 +33,7 @@ describe('vim.highlight.range', function()
it('works with charwise selection', function()
exec_lua(function()
local ns = vim.api.nvim_create_namespace('')
- vim.highlight.range(0, ns, 'Search', { 1, 5 }, { 3, 10 })
+ vim.hl.range(0, ns, 'Search', { 1, 5 }, { 3, 10 })
end)
screen:expect([[
^asdfghjkl{1:$} |
@@ -48,7 +48,7 @@ describe('vim.highlight.range', function()
it('works with linewise selection', function()
exec_lua(function()
local ns = vim.api.nvim_create_namespace('')
- vim.highlight.range(0, ns, 'Search', { 0, 0 }, { 4, 0 }, { regtype = 'V' })
+ vim.hl.range(0, ns, 'Search', { 0, 0 }, { 4, 0 }, { regtype = 'V' })
end)
screen:expect([[
{10:^asdfghjkl}{100:$} |
@@ -63,7 +63,7 @@ describe('vim.highlight.range', function()
it('works with blockwise selection', function()
exec_lua(function()
local ns = vim.api.nvim_create_namespace('')
- vim.highlight.range(0, ns, 'Search', { 0, 0 }, { 4, 4 }, { regtype = '\022' })
+ vim.hl.range(0, ns, 'Search', { 0, 0 }, { 4, 4 }, { regtype = '\022' })
end)
screen:expect([[
{10:^asdf}ghjkl{1:$} |
@@ -78,7 +78,7 @@ describe('vim.highlight.range', function()
it('works with blockwise selection with width', function()
exec_lua(function()
local ns = vim.api.nvim_create_namespace('')
- vim.highlight.range(0, ns, 'Search', { 0, 4 }, { 4, 7 }, { regtype = '\0226' })
+ vim.hl.range(0, ns, 'Search', { 0, 4 }, { 4, 7 }, { regtype = '\0226' })
end)
screen:expect([[
^asdf{10:ghjkl}{1:$} |
@@ -93,8 +93,8 @@ describe('vim.highlight.range', function()
it('can use -1 or v:maxcol to indicate end of line', function()
exec_lua(function()
local ns = vim.api.nvim_create_namespace('')
- vim.highlight.range(0, ns, 'Search', { 0, 4 }, { 1, -1 }, {})
- vim.highlight.range(0, ns, 'Search', { 2, 6 }, { 3, vim.v.maxcol }, {})
+ vim.hl.range(0, ns, 'Search', { 0, 4 }, { 1, -1 }, {})
+ vim.hl.range(0, ns, 'Search', { 2, 6 }, { 3, vim.v.maxcol }, {})
end)
screen:expect([[
^asdf{10:ghjkl}{100:$} |
@@ -107,7 +107,7 @@ describe('vim.highlight.range', function()
end)
end)
-describe('vim.highlight.on_yank', function()
+describe('vim.hl.on_yank', function()
before_each(function()
clear()
end)
@@ -115,7 +115,7 @@ describe('vim.highlight.on_yank', function()
it('does not show errors even if buffer is wiped before timeout', function()
command('new')
exec_lua(function()
- vim.highlight.on_yank({
+ vim.hl.on_yank({
timeout = 10,
on_macro = true,
event = { operator = 'y', regtype = 'v' },
@@ -129,10 +129,10 @@ describe('vim.highlight.on_yank', function()
it('does not close timer twice', function()
exec_lua(function()
- vim.highlight.on_yank({ timeout = 10, on_macro = true, event = { operator = 'y' } })
+ vim.hl.on_yank({ timeout = 10, on_macro = true, event = { operator = 'y' } })
vim.uv.sleep(10)
vim.schedule(function()
- vim.highlight.on_yank({ timeout = 0, on_macro = true, event = { operator = 'y' } })
+ vim.hl.on_yank({ timeout = 0, on_macro = true, event = { operator = 'y' } })
end)
end)
eq('', eval('v:errmsg'))
@@ -143,7 +143,7 @@ describe('vim.highlight.on_yank', function()
exec_lua(function()
vim.api.nvim_buf_set_mark(0, '[', 1, 1, {})
vim.api.nvim_buf_set_mark(0, ']', 1, 1, {})
- vim.highlight.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } })
+ vim.hl.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } })
end)
local ns = api.nvim_create_namespace('hlyank')
local win = api.nvim_get_current_win()
@@ -157,7 +157,7 @@ describe('vim.highlight.on_yank', function()
exec_lua(function()
vim.api.nvim_buf_set_mark(0, '[', 1, 1, {})
vim.api.nvim_buf_set_mark(0, ']', 1, 1, {})
- vim.highlight.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } })
+ vim.hl.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } })
end)
local ns = api.nvim_create_namespace('hlyank')
eq(api.nvim_get_current_win(), api.nvim__ns_get(ns).wins[1])
@@ -165,7 +165,7 @@ describe('vim.highlight.on_yank', function()
exec_lua(function()
vim.api.nvim_buf_set_mark(0, '[', 1, 1, {})
vim.api.nvim_buf_set_mark(0, ']', 1, 1, {})
- vim.highlight.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } })
+ vim.hl.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } })
end)
local win = api.nvim_get_current_win()
eq({ win }, api.nvim__ns_get(ns).wins)