mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 06:24:13 -06:00
feat: add Neovim buffer selection and clipboard shortcuts to Kitty
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
allowed-tools: Bash(git commit:*)
|
allowed-tools: Bash(git commit:*), Bash(commit-helper:*)
|
||||||
argument-hint: [optional custom instructions]
|
argument-hint: [optional custom instructions]
|
||||||
description: Commit currently staged changes with an appropriate message
|
description: Commit currently staged changes with an appropriate message
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
-- Simple buffer selection mode for Kitty
|
||||||
|
|
||||||
|
-- Function to copy selection via xclip and quit
|
||||||
|
local function copy_and_quit()
|
||||||
|
-- Yank to default register
|
||||||
|
vim.cmd('normal! y')
|
||||||
|
-- Get yanked text
|
||||||
|
local text = vim.fn.getreg('"')
|
||||||
|
-- Send to xclip
|
||||||
|
vim.fn.system('xclip -selection clipboard', text)
|
||||||
|
-- Quit
|
||||||
|
vim.cmd('quit!')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Visual mode: y copies selection and quits
|
||||||
|
vim.keymap.set('v', 'y', copy_and_quit)
|
||||||
|
|
||||||
|
-- Normal mode: y copies current line and quits
|
||||||
|
vim.keymap.set('n', 'y', function()
|
||||||
|
vim.cmd('normal! V')
|
||||||
|
copy_and_quit()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Quit bindings
|
||||||
|
vim.keymap.set({'n', 'v'}, 'q', function() vim.cmd('quit!') end)
|
||||||
|
vim.keymap.set({'n', 'v'}, '<Esc>', function() vim.cmd('quit!') end)
|
||||||
|
|
||||||
|
-- Quick select-all and copy: 'a' in normal mode
|
||||||
|
vim.keymap.set('n', 'a', function()
|
||||||
|
vim.cmd('normal! ggVG')
|
||||||
|
copy_and_quit()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Disable line numbers
|
||||||
|
vim.opt.number = false
|
||||||
|
vim.opt.relativenumber = false
|
||||||
|
|
||||||
|
-- Go to bottom
|
||||||
|
vim.cmd('normal! G')
|
||||||
|
|
||||||
|
-- Show help
|
||||||
|
print('j/k move, V select, / search, y copy+quit, a all+copy, q/Esc quit')
|
||||||
@@ -11,3 +11,15 @@ notify_on_cmd_finish never
|
|||||||
|
|
||||||
# Claude Code: Enable Shift+Enter for multi-line prompts
|
# Claude Code: Enable Shift+Enter for multi-line prompts
|
||||||
map shift+enter send_text all \n
|
map shift+enter send_text all \n
|
||||||
|
|
||||||
|
# Copy last command output directly to clipboard
|
||||||
|
map ctrl+shift+o launch --stdin-source=@last_cmd_output --type=overlay bash -c "xclip -selection clipboard && echo 'Copied last command output to clipboard!'"
|
||||||
|
|
||||||
|
# Copy visible screen content to clipboard (works in any window including overlays)
|
||||||
|
map ctrl+shift+y launch --allow-remote-control --type=background bash -c "kitten @ get-text --match state:focused --extent screen | xclip -selection clipboard"
|
||||||
|
|
||||||
|
# Open last command output in Neovim for easy selection (starts in visual line mode)
|
||||||
|
map ctrl+shift+g launch --stdin-source=@last_cmd_output --type=overlay nvim -u NONE -c "luafile ~/.config/kitty/buffer-select.lua" -
|
||||||
|
|
||||||
|
# Open full scrollback in Neovim for easy selection (starts in visual line mode)
|
||||||
|
map ctrl+shift+f launch --stdin-source=@screen_scrollback --type=overlay nvim -u NONE -c "luafile ~/.config/kitty/buffer-select.lua" -
|
||||||
|
|||||||
Reference in New Issue
Block a user