rebrand to u.nvim
All checks were successful
NeoVim tests / plenary-tests (push) Successful in 8s

This commit is contained in:
2024-10-23 17:01:12 -06:00
parent f3e352ceda
commit 121e0c0f7a
13 changed files with 52 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
local Range = require 'tt.range'
local Range = require 'u.range'
---@class Buffer
---@field buf number

View File

@@ -1,4 +1,4 @@
local Buffer = require 'tt.buffer'
local Buffer = require 'u.buffer'
---@class CodeWriter
---@field lines string[]

View File

@@ -1,21 +1,21 @@
local Range = require 'tt.range'
local vim_repeat = require 'tt.repeat'
local Range = require 'u.range'
local vim_repeat = require 'u.repeat'
---@type fun(range: Range): nil|(fun():any)
local __TT__OpKeymapOpFunc_rhs = nil
local __U__OpKeymapOpFunc_rhs = nil
--- This is the global utility function used for operatorfunc
--- in opkeymap
---@type nil|fun(range: Range): fun():any|nil
---@param ty 'line'|'char'|'block'
-- selene: allow(unused_variable)
function __TT__OpKeymapOpFunc(ty)
if __TT__OpKeymapOpFunc_rhs ~= nil then
function __U__OpKeymapOpFunc(ty)
if __U__OpKeymapOpFunc_rhs ~= nil then
local range = Range.from_op_func(ty)
local repeat_inject = __TT__OpKeymapOpFunc_rhs(range)
local repeat_inject = __U__OpKeymapOpFunc_rhs(range)
vim_repeat.set(function()
vim.o.operatorfunc = 'v:lua.__TT__OpKeymapOpFunc'
vim.o.operatorfunc = 'v:lua.__U__OpKeymapOpFunc'
if repeat_inject ~= nil and type(repeat_inject) == 'function' then repeat_inject() end
vim_repeat.native_repeat()
end)
@@ -34,8 +34,8 @@ end
---@param opts? vim.keymap.set.Opts
local function opkeymap(mode, lhs, rhs, opts)
vim.keymap.set(mode, lhs, function()
__TT__OpKeymapOpFunc_rhs = rhs
vim.o.operatorfunc = 'v:lua.__TT__OpKeymapOpFunc'
__U__OpKeymapOpFunc_rhs = rhs
vim.o.operatorfunc = 'v:lua.__U__OpKeymapOpFunc'
return 'g@'
end, vim.tbl_extend('force', opts or {}, { expr = true }))
end

View File

@@ -1,5 +1,5 @@
local Pos = require 'tt.pos'
local State = require 'tt.state'
local Pos = require 'u.pos'
local State = require 'u.state'
local orig_on_yank = vim.highlight.on_yank
local on_yank_enabled = true;

View File

@@ -24,7 +24,7 @@ local M = {}
---@param cmd string | fun(args: CmdArgs): any
---@param opts? { nargs?: 0|1|'*'|'?'|'+'; range?: boolean|'%'|number; count?: boolean|number, addr?: string; completion?: string }
function M.ucmd(name, cmd, opts)
local Range = require 'tt.range'
local Range = require 'u.range'
opts = opts or {}
local cmd2 = cmd
@@ -41,8 +41,8 @@ end
---@param fn fun(key_seq: string):Range|Pos|nil
---@param opts? { buffer: number|nil }
function M.define_text_object(key_seq, fn, opts)
local Range = require 'tt.range'
local Pos = require 'tt.pos'
local Range = require 'u.range'
local Pos = require 'u.pos'
if opts ~= nil and opts.buffer == 0 then opts.buffer = vim.api.nvim_get_current_buf() end
@@ -60,7 +60,7 @@ function M.define_text_object(key_seq, fn, opts)
vim.keymap.set({ 'x' }, key_seq, handle_visual, opts and { buffer = opts.buffer } or nil)
local function handle_normal()
local State = require 'tt.state'
local State = require 'u.state'
-- enter visual mode:
vim.cmd { cmd = 'normal', args = { 'v' }, bang = true }
@@ -86,6 +86,25 @@ function M.define_text_object(key_seq, fn, opts)
vim.keymap.set({ 'o' }, key_seq, handle_normal, opts and { buffer = opts.buffer } or nil)
end
---@type fun(): nil|(fun():any)
local __U__RepeatableOpFunc_rhs = nil
--- This is the global utility function used for operatorfunc
--- in repeatablemap
---@type nil|fun(range: Range): fun():any|nil
-- selene: allow(unused_variable)
function __U__RepeatableOpFunc()
if __U__RepeatableOpFunc_rhs ~= nil then __U__RepeatableOpFunc_rhs() end
end
function M.repeatablemap(mode, lhs, rhs, opts)
vim.keymap.set(mode, lhs, function()
__U__RepeatableOpFunc_rhs = rhs
vim.o.operatorfunc = 'v:lua.__U__RepeatableOpFunc'
return 'g@ '
end, vim.tbl_extend('force', opts or {}, { expr = true }))
end
function M.get_editor_dimensions()
local w = 0
local h = 0