Compare commits
12
Commits
999891e3a2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60478e6c0d | ||
|
|
af1747c027 | ||
|
|
25406f947f | ||
|
|
012ad82939 | ||
|
|
56270124fb | ||
|
|
6a146f4542 | ||
|
|
6a9b380f0c | ||
|
|
acd9f63ad6 | ||
|
|
b040eeb6f0 | ||
|
|
81eee03b79 | ||
|
|
8d840a4e29 | ||
|
|
84fa3b8363 |
@@ -34,18 +34,19 @@ require("lazy").setup({
|
|||||||
'basola21/PDFview', -- rendering pdfs in nvim
|
'basola21/PDFview', -- rendering pdfs in nvim
|
||||||
'rcarriga/nvim-notify', -- notification manager
|
'rcarriga/nvim-notify', -- notification manager
|
||||||
-- { 'jokajak/keyseer.nvim', version = '*' }, -- keybinds visualizer
|
-- { 'jokajak/keyseer.nvim', version = '*' }, -- keybinds visualizer
|
||||||
|
{ 'turbio/bracey.vim', build = "npm install --prefix server"},
|
||||||
{ 'smjonas/inc-rename.nvim', config = true }, --lsp plugin for renaming variable
|
{ 'smjonas/inc-rename.nvim', config = true }, --lsp plugin for renaming variable
|
||||||
{ "m4xshen/hardtime.nvim", lazy = false, dependencies = { "MunifTanjim/nui.nvim" }}, --annoying
|
{ "m4xshen/hardtime.nvim", lazy = false, dependencies = { "MunifTanjim/nui.nvim" }}, --annoying
|
||||||
{ "nvzone/typr", dependencies = "nvzone/volt", cmd = { "Typr", "TyprStats" }, }, --typing practice
|
{ "nvzone/typr", dependencies = "nvzone/volt", cmd = { "Typr", "TyprStats" }, }, --typing practice
|
||||||
{ 'norcalli/nvim-colorizer.lua', config = function() require('colorizer').setup{"*"} end,}, -- preview colors
|
{ 'norcalli/nvim-colorizer.lua', config = function() require('colorizer').setup{"*"} end,}, -- preview colors
|
||||||
{ 'edluffy/hologram.nvim', auto_display = true,}, --image viewer
|
-- { 'edluffy/hologram.nvim', auto_display = true,}, -- image viewer (replaced by 3rd/image.nvim)
|
||||||
{ "denialofsandwich/sudo.nvim", dependencies = { "MunifTanjim/nui.nvim", },config = true, }, --write restricted files without restart
|
{ "denialofsandwich/sudo.nvim", dependencies = { "MunifTanjim/nui.nvim", },config = true, }, --write restricted files without restart
|
||||||
{ 'akinsho/toggleterm.nvim', version = "*", config = true}, -- terminal toggling and commands
|
{ 'akinsho/toggleterm.nvim', version = "*", config = true}, -- terminal toggling and commands
|
||||||
{ 'nvim-java/nvim-java', config = function() require('java').setup() vim.lsp.enable('jdtls') end, }, --java QOL
|
{ 'nvim-java/nvim-java', config = function() require('java').setup() vim.lsp.enable('jdtls') end, }, --java QOL
|
||||||
-- disable matugen if not using noctalia shell
|
-- disable matugen if not using noctalia shell
|
||||||
{ 'RRethy/base16-nvim', config = function() require('matugen').setup() end,}, --colorshceme for noctalia integration
|
{ 'RRethy/base16-nvim', config = function() require('matugen').setup() end,}, --colorshceme for noctalia integration
|
||||||
|
|
||||||
{ "lervag/vimtex", lazy = false, init = function() vim.g.vimtex_view_method = "zathura" end }, -- for latex editing
|
-- { "lervag/vimtex", lazy = false, init = function() vim.g.vimtex_view_method = "zathura" end }, -- for latex editing
|
||||||
{ 'windwp/nvim-autopairs', event = "InsertEnter", config = true },
|
{ 'windwp/nvim-autopairs', event = "InsertEnter", config = true },
|
||||||
{ "folke/ts-comments.nvim", event = "VeryLazy", }, -- qol for commenting
|
{ "folke/ts-comments.nvim", event = "VeryLazy", }, -- qol for commenting
|
||||||
{ "marcinjahn/gemini-cli.nvim", cmd = "Gemini", dependencies = { "folke/snacks.nvim", }, config = true, },
|
{ "marcinjahn/gemini-cli.nvim", cmd = "Gemini", dependencies = { "folke/snacks.nvim", }, config = true, },
|
||||||
|
|||||||
+3
-7
@@ -31,7 +31,8 @@ vim.keymap.set('n','<Esc>' ,'<cmd>nohlsearch<CR>')
|
|||||||
vim.keymap.set('t','<Esc><Esc>' ,'<C-\\><C-n>' ,{ desc = 'Exit terminal mode' })
|
vim.keymap.set('t','<Esc><Esc>' ,'<C-\\><C-n>' ,{ desc = 'Exit terminal mode' })
|
||||||
vim.keymap.set('t','<C-h>' ,'<C-\\><C-n><C-w><C-h>' ,{ desc = 'Move focus to the left window' })
|
vim.keymap.set('t','<C-h>' ,'<C-\\><C-n><C-w><C-h>' ,{ desc = 'Move focus to the left window' })
|
||||||
-- vim.keymap.set('n','<leader>r' ,'<cmd>TermExec cmd="clear && make"<CR>' ,{ desc = '[r]un make in terminal' })
|
-- vim.keymap.set('n','<leader>r' ,'<cmd>TermExec cmd="clear && make"<CR>' ,{ desc = '[r]un make in terminal' })
|
||||||
vim.keymap.set('n','<leader>l' ,function() utils.RunCommand("l") end ,{ desc = 'run [l]ast command in terminal' })
|
vim.keymap.set('n','<leader>L' ,function() utils.RunCommand("l") end ,{ desc = 'run [l]ast command in terminal' })
|
||||||
|
vim.keymap.set('n','<C-CR>' ,function() utils.RunCommand("l") end ,{ desc = 'run [l]ast command in terminal' })
|
||||||
vim.keymap.set('n','<leader>ss' ,function() utils.saveSnapshot() end ,{ desc = '[S]ave a [S]napshot of the current windows' })
|
vim.keymap.set('n','<leader>ss' ,function() utils.saveSnapshot() end ,{ desc = '[S]ave a [S]napshot of the current windows' })
|
||||||
vim.keymap.set('n','<leader>sr' ,function() utils.returnSnapshot() end ,{ desc = '[R]eturn to saved [S]napshot' })
|
vim.keymap.set('n','<leader>sr' ,function() utils.returnSnapshot() end ,{ desc = '[R]eturn to saved [S]napshot' })
|
||||||
vim.keymap.set('n','<leader>n' ,'<cmd>ToggleTerm direction=vertical name=compile size=70<CR>', { desc = 'open a [n]ew terminal' })
|
vim.keymap.set('n','<leader>n' ,'<cmd>ToggleTerm direction=vertical name=compile size=70<CR>', { desc = 'open a [n]ew terminal' })
|
||||||
@@ -86,12 +87,7 @@ vim.keymap.set("n", "<C-A>" ,"m'ggyG''" ,{ desc = "[Y]ank whole file" })
|
|||||||
vim.keymap.set("n", "<leader>sr" ,[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]] ,{ desc = "[S]earch/[R]eplace word under cursor" })
|
vim.keymap.set("n", "<leader>sr" ,[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]] ,{ desc = "[S]earch/[R]eplace word under cursor" })
|
||||||
|
|
||||||
-- PLUGIN KEYBINDS
|
-- PLUGIN KEYBINDS
|
||||||
vim.keymap.set({ "n", "v" } ,"<leader>aa" ,"<cmd>CodeCompanionActions<cr>" ,{ desc = "CodeCompanion - Actions" })
|
-- TODO move these to their respective plugin files (for lazy recognition)
|
||||||
vim.keymap.set({ "n", "v" } ,"<leader>ac" ,"<cmd>CodeCompanionChat Toggle<cr>" ,{ desc = "CodeCompanion - Chat" })
|
|
||||||
vim.keymap.set({ "n", "v" } ,"<leader>ai" ,"<cmd>CodeCompanion<cr>" ,{ desc = "CodeCompanion - Inline" })
|
|
||||||
vim.keymap.set("v" ,"<leader>ad" ,"<cmd>CodeCompanionChat Add<cr>" ,{ desc = "CodeCompanion - Add to Chat" })
|
|
||||||
-- Expand 'cc' into 'CodeCompanion' in the command line
|
|
||||||
vim.cmd([[cab cc CodeCompanion]])
|
|
||||||
|
|
||||||
--spellcheck keybind to toggle on current buffer
|
--spellcheck keybind to toggle on current buffer
|
||||||
vim.keymap.set('n',"<leader>ze" ,"<cmd>setlocal spell<cr>" ,{ desc = "enable spellecheck on buffer" })
|
vim.keymap.set('n',"<leader>ze" ,"<cmd>setlocal spell<cr>" ,{ desc = "enable spellecheck on buffer" })
|
||||||
|
|||||||
+16
-16
@@ -3,24 +3,24 @@
|
|||||||
function M.setup()
|
function M.setup()
|
||||||
require('base16-colorscheme').setup {
|
require('base16-colorscheme').setup {
|
||||||
-- Background tones
|
-- Background tones
|
||||||
base00 = '#000000', -- Default Background
|
base00 = '#191724', -- Default Background
|
||||||
base01 = '#110d1a', -- Lighter Background (status bars)
|
base01 = '#26233a', -- Lighter Background (status bars)
|
||||||
base02 = '#1a1428', -- Selection Background
|
base02 = '#2e2b47', -- Selection Background
|
||||||
base03 = '#644c94', -- Comments, Invisibles
|
base03 = '#656278', -- Comments, Invisibles
|
||||||
-- Foreground tones
|
-- Foreground tones
|
||||||
base04 = '#b58fff', -- Dark Foreground (status bars)
|
base04 = '#908caa', -- Dark Foreground (status bars)
|
||||||
base05 = '#e8d8ff', -- Default Foreground
|
base05 = '#e0def4', -- Default Foreground
|
||||||
base06 = '#e8d8ff', -- Light Foreground
|
base06 = '#e0def4', -- Light Foreground
|
||||||
base07 = '#e8d8ff', -- Lightest Foreground
|
base07 = '#e0def4', -- Lightest Foreground
|
||||||
-- Accent colors
|
-- Accent colors
|
||||||
base08 = '#ff6f9b', -- Variables, XML Tags, Errors
|
base08 = '#eb6f92', -- Variables, XML Tags, Errors
|
||||||
base09 = '#d8b4ff', -- Integers, Constants
|
base09 = '#31748f', -- Integers, Constants
|
||||||
base0A = '#c79aff', -- Classes, Search Background
|
base0A = '#9ccfd8', -- Classes, Search Background
|
||||||
base0B = '#b58fff', -- Strings, Diff Inserted
|
base0B = '#ebbcba', -- Strings, Diff Inserted
|
||||||
base0C = '#bd80ff', -- Regex, Escape Chars
|
base0C = '#96d1e9', -- Regex, Escape Chars
|
||||||
base0D = '#ab80ff', -- Functions, Methods
|
base0D = '#e99996', -- Functions, Methods
|
||||||
base0E = '#b880ff', -- Keywords, Storage
|
base0E = '#96dce9', -- Keywords, Storage
|
||||||
base0F = '#bc0039', -- Deprecated, Embedded Tags
|
base0F = '#961137', -- Deprecated, Embedded Tags
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,6 @@
|
|||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
vim.g.have_nerd_font = true
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
@@ -64,4 +63,5 @@ vim.opt.termguicolors = true -- required for colorizer
|
|||||||
require('autocommands')
|
require('autocommands')
|
||||||
vim.env.PATH = vim.fn.stdpath("data") .. "/mason/bin" .. ":" .. vim.env.PATH
|
vim.env.PATH = vim.fn.stdpath("data") .. "/mason/bin" .. ":" .. vim.env.PATH
|
||||||
|
|
||||||
|
vim.g.python3_host_prog = vim.fn.expand("~/.local/share/nvim/venv/bin/python")
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
return { 'RRethy/base16-nvim',
|
||||||
|
config = function()
|
||||||
|
local ok, matugen = pcall(require, 'matugen')
|
||||||
|
if ok then matugen.setup() end
|
||||||
|
end,
|
||||||
|
}
|
||||||
+83
-126
@@ -1,129 +1,86 @@
|
|||||||
return {
|
return {
|
||||||
"olimorris/codecompanion.nvim",
|
"olimorris/codecompanion.nvim",
|
||||||
dependencies = {
|
version = "^19.0.0",
|
||||||
"nvim-lua/plenary.nvim",
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
acp = {
|
||||||
|
hermes = function()
|
||||||
|
local adapter = require("codecompanion.adapters").extend("codex", {
|
||||||
|
name = "hermes",
|
||||||
|
formatted_name = "Hermes",
|
||||||
|
commands = {
|
||||||
|
default = {
|
||||||
|
vim.fn.exepath("hermes") ~= "" and vim.fn.exepath("hermes") or "hermes",
|
||||||
|
"acp",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaults = {
|
||||||
|
auth_method = "openai-codex",
|
||||||
|
timeout = 20000,
|
||||||
|
mcpServers = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
--{{{ Options
|
-- Hermes resolves credentials from its own configuration.
|
||||||
opts = {
|
adapter.env = {}
|
||||||
--- {{{ Display
|
return adapter
|
||||||
display = {
|
end,
|
||||||
chat = {
|
extend = {
|
||||||
window = {
|
codex = {
|
||||||
layout = "vertical",
|
defaults = {
|
||||||
width = 0.35,
|
auth_method = "chat-gpt",
|
||||||
height = 0.35,
|
},
|
||||||
},
|
},
|
||||||
keymaps = {
|
},
|
||||||
close = {
|
},
|
||||||
modes = {
|
http = {
|
||||||
n = "q", -- Bind "q" in normal mode to close the chat
|
extend = {
|
||||||
},
|
openai_responses = {
|
||||||
index = 1,
|
schema = {
|
||||||
callback = "keymaps.close",
|
model = {
|
||||||
description = "Close Chat",
|
default = "gpt-5.6-terra",
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- }}}
|
openai_terra = function()
|
||||||
--
|
return require("codecompanion.adapters").extend("openai_responses", {
|
||||||
-- {{{ INTERACTIONS
|
name = "openai_terra",
|
||||||
interactions = {
|
formatted_name = "OpenAI: GPT-5.6 Terra",
|
||||||
chat = {
|
schema = {
|
||||||
adapter = "ollama_coder", -- Removed the curly braces
|
model = {
|
||||||
},
|
default = "gpt-5.6-terra",
|
||||||
inline = {
|
},
|
||||||
adapter = "ollama_coder", -- Removed the curly braces
|
},
|
||||||
},
|
})
|
||||||
background = {
|
end,
|
||||||
adapter = "ollama_bg", -- Pointed this to the new extended adapter string
|
openai_luna = function()
|
||||||
}
|
return require("codecompanion.adapters").extend("openai_responses", {
|
||||||
},
|
name = "openai_luna",
|
||||||
-- }}}
|
formatted_name = "OpenAI: GPT-5.6 Luna",
|
||||||
--
|
schema = {
|
||||||
-- {{{ Adapters
|
model = {
|
||||||
adapters = {
|
default = "gpt-5.6-luna",
|
||||||
http = {
|
},
|
||||||
gemini_pro = function()
|
},
|
||||||
return require("codecompanion.adapters").extend("gemini", {
|
})
|
||||||
name = "gemini_pro",
|
end,
|
||||||
schema = {
|
},
|
||||||
model = {
|
},
|
||||||
default = "gemini-3.5-flash",
|
interactions = {
|
||||||
},
|
chat = {
|
||||||
},
|
adapter = "hermes",
|
||||||
})
|
},
|
||||||
end,
|
inline = {
|
||||||
gemini_flash = function()
|
adapter = {
|
||||||
return require("codecompanion.adapters").extend("gemini", {
|
name = "openai_responses",
|
||||||
name = "gemini_flash",
|
model = "gpt-5.6-terra",
|
||||||
schema = {
|
},
|
||||||
model = {
|
},
|
||||||
default = "gemini-2.0-flash",
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
-- local ollama coding model
|
|
||||||
ollama_coder = function()
|
|
||||||
return require("codecompanion.adapters").extend("ollama", {
|
|
||||||
name = "ollama_bg",
|
|
||||||
schema = {
|
|
||||||
model = {
|
|
||||||
default = "qwen2.5-coder:7b",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
-- Added an extended Ollama adapter to fix your background task
|
|
||||||
ollama_bg = function()
|
|
||||||
return require("codecompanion.adapters").extend("ollama", {
|
|
||||||
name = "ollama_bg",
|
|
||||||
schema = {
|
|
||||||
model = {
|
|
||||||
default = "qwen3.5:4b",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- }}}
|
|
||||||
--
|
|
||||||
-- {{{ Library
|
|
||||||
prompt_library = {
|
|
||||||
["Local Executor"] = {
|
|
||||||
strategy = "chat",
|
|
||||||
description = "Executes implementation diffs locally and writes TDD test cases.",
|
|
||||||
opts = {
|
|
||||||
adapter = "ollama_coder", -- Force it to use your local hardware
|
|
||||||
is_default = false,
|
|
||||||
is_slash_cmd = false,
|
|
||||||
},
|
|
||||||
prompts = {
|
|
||||||
{
|
|
||||||
role = "system",
|
|
||||||
content = [[You are the Last Mile Executor.
|
|
||||||
You run in a stateless context. I will provide you with a unified diff and a testing plan.
|
|
||||||
Your strict execution order is:
|
|
||||||
1. Output the test case file modifications first (SDET-first).
|
|
||||||
2. Output the production implementation code modifications.
|
|
||||||
|
|
||||||
Do not write markdown headers (H1/H2). Use code blocks with the language ID.
|
|
||||||
Precede every code block with a line comment specifying the exact 'filepath:'.
|
|
||||||
Do not use bash syntax; adhere strictly to POSIX sh if writing shell automation.
|
|
||||||
Do not execute terminal commands directly. Output the code blocks for manual unstaged review.]],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
role = "user",
|
|
||||||
content = "I am ready to provide the Planner's diff. Await my input.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- }}}
|
|
||||||
}
|
|
||||||
--}}}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
return {
|
||||||
|
"3rd/image.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
backend = "kitty",
|
||||||
|
processor = "magick_cli", -- Uses your system's ImageMagick CLI directly
|
||||||
|
integrations = {
|
||||||
|
markdown = {
|
||||||
|
enabled = true,
|
||||||
|
clear_in_insert_mode = false,
|
||||||
|
download_remote_images = true,
|
||||||
|
only_render_image_at_cursor = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
max_width = nil,
|
||||||
|
max_height = nil,
|
||||||
|
max_height_window_percentage = math.huge,
|
||||||
|
max_width_window_percentage = math.huge,
|
||||||
|
window_overlap_clear_enabled = true,
|
||||||
|
-- Automatically hijack and render PDF files inside Neovim buffers
|
||||||
|
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.pdf" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
local preferred_agent = "hermes"
|
||||||
|
return {
|
||||||
|
"folke/sidekick.nvim",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>as",
|
||||||
|
function()
|
||||||
|
require("sidekick.cli").select()
|
||||||
|
end,
|
||||||
|
desc = "Sidekick (Select AI CLI)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>aa",
|
||||||
|
function()
|
||||||
|
require("sidekick.cli").toggle({ name = preferred_agent, focus = true })
|
||||||
|
end,
|
||||||
|
desc = "Sidekick Toggle " .. preferred_agent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>ah",
|
||||||
|
function()
|
||||||
|
require("sidekick.cli").toggle({ name = "hermes", focus = true })
|
||||||
|
end,
|
||||||
|
desc = "Sidekick Toggle Hermes",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>ak",
|
||||||
|
function()
|
||||||
|
require("sidekick.cli").toggle({ name = "antigravity", focus = true })
|
||||||
|
end,
|
||||||
|
desc = "Sidekick Toggle Antigravity",
|
||||||
|
},
|
||||||
|
{ "<leader>ap",
|
||||||
|
function()
|
||||||
|
require("sidekick.cli").prompt()
|
||||||
|
end,
|
||||||
|
desc = "Sidekick Prompt",
|
||||||
|
},
|
||||||
|
{ "<leader>an",
|
||||||
|
function()
|
||||||
|
require("sidekick.nes").jump()
|
||||||
|
end,
|
||||||
|
desc = "Sidekick Jump to Next Suggestion",
|
||||||
|
},
|
||||||
|
{ "<leader>at",
|
||||||
|
function()
|
||||||
|
require("sidekick.nes").toggle()
|
||||||
|
end,
|
||||||
|
desc = "toggle sidekick suggestions"
|
||||||
|
},
|
||||||
|
{ "<M-CR>",
|
||||||
|
function()
|
||||||
|
require("sidekick.nes").apply()
|
||||||
|
end,
|
||||||
|
desc = "apply sidekick suggestion"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
cli = {
|
||||||
|
tools = {
|
||||||
|
antigravity = {
|
||||||
|
cmd = { "agy" },
|
||||||
|
},
|
||||||
|
hermes = {
|
||||||
|
cmd = { "hermes" },
|
||||||
|
is_proc = "\\<hermes\\>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
-- Mostly Generated with Antigravity CLI Gemini 3.7 Flash
|
||||||
|
return {
|
||||||
|
"lervag/vimtex",
|
||||||
|
lazy = false,
|
||||||
|
init = function()
|
||||||
|
vim.g.vimtex_compiler_method = "tectonic"
|
||||||
|
vim.g.vimtex_quickfix_mode = 0
|
||||||
|
vim.g.vimtex_view_enabled = 0 -- Disable external GUI popup
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
local function open_pdf_split()
|
||||||
|
local pdf_path = vim.fn.expand("%:p:r") .. ".pdf"
|
||||||
|
if vim.fn.filereadable(pdf_path) == 1 then
|
||||||
|
vim.cmd("vsplit " .. vim.fn.fnameescape(pdf_path))
|
||||||
|
else
|
||||||
|
vim.notify("PDF not found: " .. pdf_path .. "\nCompile first with <Space>ll", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Provide user command :VimtexPreviewBuffer
|
||||||
|
vim.api.nvim_create_user_command("VimtexPreviewBuffer", open_pdf_split, { desc = "VimTeX: Open PDF in vertical split" })
|
||||||
|
|
||||||
|
-- Buffer-local keymaps for TeX files
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "tex", "latex" },
|
||||||
|
callback = function(ev)
|
||||||
|
local opts = { buffer = ev.buf, desc = "VimTeX: View PDF in Neovim split" }
|
||||||
|
vim.keymap.set("n", "<localleader>lv", open_pdf_split, opts)
|
||||||
|
vim.keymap.set("n", "<leader>lv", open_pdf_split, opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Helper function to refresh and re-render all open PDF splits with image.nvim
|
||||||
|
local function reload_pdf_buffers()
|
||||||
|
local ok, image_api = pcall(require, "image")
|
||||||
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
local buf_name = vim.api.nvim_buf_get_name(buf)
|
||||||
|
if buf_name:match("%.pdf$") then
|
||||||
|
vim.api.nvim_win_call(win, function()
|
||||||
|
vim.cmd("edit!")
|
||||||
|
end)
|
||||||
|
if ok and image_api then
|
||||||
|
local imgs = image_api.get_images({ window = win, buffer = buf })
|
||||||
|
if #imgs > 0 then
|
||||||
|
for _, img in ipairs(imgs) do
|
||||||
|
img:clear()
|
||||||
|
img:render()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
image_api.hijack_buffer(buf_name, win, buf)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Automatically trigger compilation on save (:w)
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = "*.tex",
|
||||||
|
callback = function()
|
||||||
|
if vim.b.vimtex and vim.fn.exists(":VimtexCompileSS") == 2 then
|
||||||
|
vim.cmd("VimtexCompileSS")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Automatically reload and re-render PDF splits when compilation finishes
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = { "VimtexEventCompileSuccess", "VimtexEventCompileStopped" },
|
||||||
|
callback = function()
|
||||||
|
reload_pdf_buffers()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user