feat: improve wrapped-line editing and completion cancellation

Use word-boundary wrapping and count-aware displayed-line movement in ordinary buffers. Escape cancels Blink completion before falling back. Preserve the existing ergonomics check; it was not rerun during Git cleanup.
This commit is contained in:
kiri committed 2026-09-09 17:31:25 +02:00
1 parent 35ce6be8f9
commit 8f5d690d75
4 files changed
+26

No files matched your search

@@ -7,6 +7,12 @@ end
vim.keymap.del("x", "gra")
vim.keymap.del({ "i", "s" }, "<C-S>")
for _, key in ipairs({ "j", "k" }) do
vim.keymap.set({ "n", "x" }, key, function()
return vim.bo.buftype == "" and vim.v.count == 0 and "g" .. key or key
end, { expr = true, desc = "Move by displayed line, or logical line with a count" })
end
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Focus left window" })
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Focus lower window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Focus upper window" })
@@ -17,6 +17,7 @@ vim.o.timeoutlen = 300
vim.o.updatetime = 250
vim.o.breakindent = true
vim.o.linebreak = true
vim.o.undofile = true
vim.o.ignorecase = true
vim.o.smartcase = true
@@ -15,6 +15,7 @@ require("lz.n").load({
after = function()
require("blink.cmp").setup({
keymap = {
["<Esc>"] = { "cancel", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
["<C-k>"] = { "select_prev", "fallback" },
["<Tab>"] = { "select_and_accept", "fallback" },
+18
View File
@@ -0,0 +1,18 @@
-- Configured startup: nvim --headless -i NONE '+lua local ok,e=pcall(dofile,"tests/neovim-ergonomics.lua"); if not ok then print(e); vim.cmd.cquit() end' '+qa!'
assert(vim.o.linebreak)
vim.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep("word ", 80), "two", "three", "four" })
vim.cmd("normal gg0j")
assert(vim.fn.line(".") == 1 and vim.fn.col(".") > 1)
vim.cmd("normal k")
assert(vim.fn.line(".") == 1 and vim.fn.col(".") == 1)
vim.cmd("normal 3j")
assert(vim.fn.line(".") == 4)
vim.cmd("normal 3k")
assert(vim.fn.line(".") == 1)
assert(vim.fn.maparg("j", "o") == "")
vim.bo.buftype = "nofile"
vim.cmd("normal j")
assert(vim.fn.line(".") == 2)
vim.cmd("doautocmd InsertEnter")
assert(vim.deep_equal(require("blink.cmp.config").keymap["<Esc>"], { "cancel", "fallback" }))
print("Neovim motion and completion configuration smoke check passed")