fix add xclip scrript and nvim osc52 support

This commit is contained in:
2025-11-20 12:45:22 +11:00
parent 658470585f
commit 8e0e3005c5
7 changed files with 168 additions and 33 deletions

View File

@@ -6,6 +6,28 @@ vim.g.maplocalleader = " " -- Set the local leader key to the space bar.
vim.opt.number = true -- Absolute numbers on all lines
vim.opt.relativenumber = true -- Relative numbers (hybrid when both enabled)
-- ===================================================================
-- Clipboard Settings (Added)
-- ===================================================================
-- Sync with system clipboard
vim.opt.clipboard = "unnamedplus"
-- OSC 52 Support for SSH (Copy from Remote Nvim -> Local Computer)
if vim.env.SSH_TTY then
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
end
-- ===================================================================
-- Search Settings
-- ===================================================================
@@ -15,8 +37,6 @@ vim.opt.incsearch = true -- Show search results incrementally as you type
vim.opt.ignorecase = true -- Ignore case in search patterns
vim.opt.smartcase = true -- Override ignorecase if search pattern contains uppercase letters
-- ===================================================================
-- Essential Keybindings
-- ===================================================================
@@ -33,7 +53,15 @@ local keymap = function(mode, lhs, rhs, opts)
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- --- General --V-
vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("VimtexCompile", { clear = true }),
pattern = "*.tex",
callback = function()
vim.cmd("VimtexCompile")
end,
})
-- --- General ---
-- Save the current file
keymap("n", "<leader>w", ":w<CR>", { desc = "Write (Save) File" })
@@ -62,4 +90,3 @@ keymap("n", "<S-l>", ":bnext<CR>", { desc = "Next Buffer" })
keymap("n", "<S-h>", ":bprevious<CR>", { desc = "Previous Buffer" })
vim.keymap.set({'n', 'i', 'v'}, '<F14>', '<C-V>', { desc = 'Enter Visual Block' })
vim.keymap.set({'n', 'i'}, '<F15>', 'V', { desc = 'Enter Visual Line' })

View File

@@ -0,0 +1,70 @@
return {
"yetone/avante.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim",
"MunifTanjim/nui.nvim",
"folke/which-key.nvim", -- For keymaps
},
event = "VeryLazy",
config = function()
require("avante").setup({
provider = "openai",
providers = {
openai = {
api_key_name = "OPENAI_API_KEY",
endpoint = "https://api.openai.com/v1",
model = "gpt-4o-mini", -- Your paid model
timeout = 30000,
extra_request_body = {
temperature = 0.1,
max_completion_tokens = 8192,
},
},
},
behaviour = {
auto_suggestions = true, -- Inline completion
auto_set_highlight_group = true, -- Hints on hover
auto_apply_diff_after_generation = false, -- No auto-insert
},
mappings = {
normal = {
["gq"] = "AvanteAsk",
},
insert = {
["<C-g>"] = "AvanteToggleAutoSuggestions",
},
visual = {
["gq"] = "AvanteAsk",
},
},
hints = { enabled = true },
})
-- Your keymap style
local keymap = function(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then options = vim.tbl_extend("force", options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
keymap("n", "<leader>ai", ":AvanteAsk<CR>", { desc = "Avante Chat" })
keymap("v", "<leader>ae", ":<C-U>AvanteAsk explain simply<CR>", { desc = "Explain Selected" })
keymap("v", "<leader>af", ":<C-U>AvanteAsk fix: optimize<CR>", { desc = "Fix Selected" })
keymap("i", "<C-Space>", "<cmd>AvanteToggleAutoSuggestions<CR>", { desc = "Toggle Inline" })
-- Which-key
vim.schedule(function()
local status_ok, wk = pcall(require, "which-key")
if status_ok then
wk.add({
{ "<leader>a", group = "AI (Avante)" },
{ "<leader>ai", "<cmd>AvanteAsk<CR>", desc = "Open Chat", mode = "n" },
{ "<leader>ae", desc = "Explain Selected", mode = "v" },
{ "<leader>af", desc = "Fix Selected", mode = "v" },
})
end
end)
end,
}

View File

@@ -0,0 +1,15 @@
-- In your plugins configuration file
return {
-- ... other plugins
{
"lervag/vimtex",
lazy = false, -- Or ft = "tex" to load it only for tex files
config = function()
-- Use Zathura as the PDF viewer
vim.g.vimtex_view_method = "zathura"
end,
},
-- ... other plugins
}