Personal LazyVim config: vimtex, LTeX, Vale, prose settings
This commit is contained in:
@@ -6,3 +6,21 @@
|
||||
--
|
||||
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
||||
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
group = vim.api.nvim_create_augroup("term_settings", { clear = true }),
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
-- vim.opt_local.spell = false -- Optional: disable spellcheck in terminal
|
||||
end,
|
||||
})
|
||||
|
||||
-- Prose/LaTeX settings: spell-checking + visual word-wrap
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = vim.api.nvim_create_augroup("prose_settings", { clear = true }),
|
||||
pattern = { "tex", "plaintex", "markdown", "text" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,3 +1,45 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
-- This file is automatically loaded by lazyvim.config.init
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- DAP (Debug Adapter Protocol)
|
||||
-- Note: LazyVim uses <leader>d for Debugging by default,
|
||||
-- but these will override/augment the defaults.
|
||||
map("n", "<leader>dl", function()
|
||||
require("dap").step_into()
|
||||
end, { desc = "Debugger step into" })
|
||||
map("n", "<leader>dj", function()
|
||||
require("dap").step_over()
|
||||
end, { desc = "Debugger step over" })
|
||||
map("n", "<leader>dk", function()
|
||||
require("dap").step_out()
|
||||
end, { desc = "Debugger step out" })
|
||||
map("n", "<leader>dc", function()
|
||||
require("dap").continue()
|
||||
end, { desc = "Debugger continue" })
|
||||
map("n", "<leader>db", function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end, { desc = "Debugger toggle breakpoint" })
|
||||
map("n", "<leader>dd", function()
|
||||
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
|
||||
end, { desc = "Debugger set conditional breakpoint" })
|
||||
map("n", "<leader>de", function()
|
||||
require("dap").terminate()
|
||||
end, { desc = "Debugger reset" })
|
||||
map("n", "<leader>dr", function()
|
||||
require("dap").run_last()
|
||||
end, { desc = "Debugger run last" })
|
||||
|
||||
-- Rustaceanvim
|
||||
map("n", "<leader>dt", "<cmd>RustLsp testables<cr>", { desc = "Debugger testables" })
|
||||
|
||||
-- Copilot toggle (inline suggestions + blink/cmp source)
|
||||
map("n", "<leader>ua", function()
|
||||
vim.g.copilot_enabled = not vim.g.copilot_enabled
|
||||
require("copilot.suggestion").toggle_auto_trigger()
|
||||
local state = vim.g.copilot_enabled and "enabled" or "disabled"
|
||||
vim.notify("Copilot " .. state, vim.log.levels.INFO)
|
||||
end, { desc = "Toggle Copilot" })
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
-- VimTeX local leader (must be set before plugins load)
|
||||
vim.g.maplocalleader = ","
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
virtual_lines = true,
|
||||
})
|
||||
|
||||
-- Spell-checking files (spell itself is enabled per filetype in autocmds.lua)
|
||||
vim.opt.spelllang = { "en_us" }
|
||||
vim.opt.spellfile = vim.fn.expand("~/.config/nvim/spell/en.utf-8.add")
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
-- Copilot is installed via the LazyVim extra, but disabled by default.
|
||||
-- Use <leader>ua to toggle Copilot inline suggestions and blink/cmp source.
|
||||
|
||||
vim.g.copilot_enabled = false
|
||||
|
||||
return {
|
||||
-- Inline suggestions are set up but not auto-triggered by default
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
opts = {
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = false,
|
||||
},
|
||||
panel = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Disable copilot as a blink completion source by default
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
opts.sources = opts.sources or {}
|
||||
opts.sources.providers = opts.sources.providers or {}
|
||||
opts.sources.providers.copilot = opts.sources.providers.copilot or {
|
||||
name = "copilot",
|
||||
module = "blink-copilot",
|
||||
score_offset = 100,
|
||||
async = true,
|
||||
}
|
||||
opts.sources.providers.copilot.enabled = function()
|
||||
return vim.g.copilot_enabled == true
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = function(_, opts)
|
||||
opts.diagnostics = opts.diagnostics or {}
|
||||
opts.diagnostics.virtual_text = false
|
||||
opts.diagnostics.virtual_lines = true
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
return {
|
||||
-- Ensure ltex-ls is installed via Mason
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "ltex-ls" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- Configure LTeX for grammar/style/spelling in LaTeX/Markdown
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
ltex = {
|
||||
settings = {
|
||||
ltex = {
|
||||
-- Change to "en-GB", "de-DE", etc. if needed
|
||||
language = "en-US",
|
||||
-- More thorough checks (slower but better for final drafts)
|
||||
additionalRules = {
|
||||
enablePickyRules = true,
|
||||
},
|
||||
-- Load a shared dictionary of domain/academic words
|
||||
dictionary = {
|
||||
["en-US"] = (function()
|
||||
local words = {}
|
||||
local dict_file = vim.fn.expand("~/.config/nvim/spell/ltex.dictionary.en-US.txt")
|
||||
local ok, lines = pcall(vim.fn.readfile, dict_file)
|
||||
if ok and lines then
|
||||
for _, word in ipairs(lines) do
|
||||
word = word:gsub("^%s+", ""):gsub("%s+$", "")
|
||||
if word ~= "" and not word:match("^#") then
|
||||
table.insert(words, word)
|
||||
end
|
||||
end
|
||||
end
|
||||
return words
|
||||
end)(),
|
||||
},
|
||||
-- Check as you type; switch to "save" if it feels too slow
|
||||
checkFrequency = "edit",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
return {
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^6", -- Recommended
|
||||
lazy = false, -- This plugin is already lazy
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||
config = function()
|
||||
require("dapui").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "*", -- Use for stability; omit to use main branch for the latest features
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({
|
||||
-- Configuration here, or leave empty for defaults
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
-- Vale is a prose linter / style checker.
|
||||
-- Make sure the `vale` binary is on your $PATH (e.g. in ~/.local/bin).
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
opts.linters_by_ft = opts.linters_by_ft or {}
|
||||
|
||||
-- Run Vale on LaTeX, Markdown, and plain text files.
|
||||
for _, ft in ipairs({ "tex", "plaintex", "markdown", "text" }) do
|
||||
opts.linters_by_ft[ft] = opts.linters_by_ft[ft] or {}
|
||||
if not vim.tbl_contains(opts.linters_by_ft[ft], "vale") then
|
||||
table.insert(opts.linters_by_ft[ft], "vale")
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
"lervag/vimtex",
|
||||
init = function()
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.vimtex_compiler_method = "latexmk"
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user