Vi mode for kitty #6485
txtyash
started this conversation in
Show and tell
Replies: 2 comments
-
Very nice! I used this as part of my inspiration working on kitty-scrollback.nvim
|
Beta Was this translation helpful? Give feedback.
0 replies
-
You almost had the code to get proper syntax highlighting :) To get the syntax highlighted, you can just use the terminal buffer: function M.colorize()
vim.wo.number = false
vim.wo.relativenumber = false
vim.wo.statuscolumn = ""
vim.wo.signcolumn = "no"
local orig_buf = vim.api.nvim_get_current_buf()
local lines = vim.api.nvim_buf_get_lines(orig_buf, 0, -1, false)
while #lines > 0 and vim.trim(lines[#lines]) == "" do
lines[#lines] = nil
end
local buf = vim.api.nvim_create_buf(false, true)
local channel = vim.api.nvim_open_term(buf, {})
vim.api.nvim_chan_send(channel, table.concat(lines, "\r\n"))
vim.api.nvim_set_current_buf(buf)
vim.keymap.set("n", "q", "<cmd>qa!<cr>", { silent = true, buffer = buf })
vim.api.nvim_create_autocmd("TermEnter", { buffer = buf, command = "stopinsert" })
vim.defer_fn(function()
-- go to the end of the terminal buffer
vim.cmd.startinsert()
end, 10)
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had seen quite a few examples of scrollback piped to nvim.... They had me lost. Thanks to a guy from matrix named seandewar. I have really good vi mode inside kitty. The only thing missing is the syntax.
Create a
.lua
file. I made~/.config/kitty/vi-mode.lua
:And in your
kitty.conf
:All done!
Beta Was this translation helpful? Give feedback.
All reactions