adde latex lsp and language
This commit is contained in:
7
nvim/.config/nvim/after/ftdetect/latex.lua
Normal file
7
nvim/.config/nvim/after/ftdetect/latex.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Tell Neovim to treat .ltx as regular tex
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
ltx = "tex",
|
||||
tex = "tex",
|
||||
},
|
||||
})
|
||||
@@ -13,13 +13,19 @@ vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Only enable spell checking for specific filetypes
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown", "text", "gitcommit", "tex" },
|
||||
pattern = { "markdown", "text", "gitcommit", "tex", "plaintext" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.spelllang = "en_us,de"
|
||||
end,
|
||||
})
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
tex = "tex",
|
||||
},
|
||||
})
|
||||
|
||||
require("vim-options")
|
||||
require("lazy").setup("plugins")
|
||||
require("lualine").setup({
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
"telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||
"vim-test": { "branch": "master", "commit": "aa619692ff48a3cf3e6bdb893765039488d4e5f3" },
|
||||
"vimtex": { "branch": "master", "commit": "1b56d5ae6e19cd018f1adaf4868561b087698b9b" },
|
||||
"vimux": { "branch": "master", "commit": "614f0bb1fb598f97accdcea71d5f7b18d7d62436" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "30d8c852a0ca52437dad84cf5c92962d565a54a9" }
|
||||
|
||||
@@ -7,7 +7,7 @@ return {
|
||||
formatters_by_ft = {
|
||||
-- Lua
|
||||
lua = { "stylua" },
|
||||
|
||||
|
||||
-- JavaScript/TypeScript/Web
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
@@ -24,25 +24,32 @@ return {
|
||||
markdown = { "prettier" },
|
||||
graphql = { "prettier" },
|
||||
handlebars = { "prettier" },
|
||||
|
||||
|
||||
-- Toml
|
||||
toml = { "tombi" },
|
||||
|
||||
-- text
|
||||
-- Ruby
|
||||
ruby = { "rubocop" },
|
||||
|
||||
|
||||
-- latex
|
||||
tex = { "tex-fmt" },
|
||||
|
||||
-- Python (black first, then isort for imports)
|
||||
python = { "black", "isort" },
|
||||
|
||||
|
||||
-- Bash/Shell
|
||||
sh = { "beautysh" },
|
||||
bash = { "beautysh" },
|
||||
zsh = { "beautysh" },
|
||||
},
|
||||
|
||||
|
||||
-- Format on save
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
|
||||
|
||||
-- Formatter settings
|
||||
formatters = {
|
||||
stylua = {
|
||||
@@ -52,7 +59,7 @@ return {
|
||||
prepend_args = { "--tab-width", "2" },
|
||||
},
|
||||
beautysh = {
|
||||
prepend_args = { "--indent-size", "2" }, -- 2 spaces for bash
|
||||
prepend_args = { "--indent-size", "2" }, -- 2 spaces for bash
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -17,16 +17,49 @@ return {
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"SmiteshP/nvim-navic", -- Add this dependency
|
||||
"SmiteshP/nvim-navic",
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local navic = require("nvim-navic")
|
||||
|
||||
|
||||
-- Define server configurations
|
||||
local servers = {
|
||||
ts_ls = {},
|
||||
tombi = {},
|
||||
solargraph = {},
|
||||
textlsp = {
|
||||
filetypes = { "ltx", "txt" },
|
||||
},
|
||||
-- Add texlab for LaTeX
|
||||
texlab = {
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
executable = "latexmk",
|
||||
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
onSave = true,
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = "zathura", -- Change to your PDF viewer if different
|
||||
args = { "--synctex-forward", "%l:1:%f", "%p" },
|
||||
},
|
||||
chktex = {
|
||||
onOpenAndSave = true,
|
||||
onEdit = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Optional: Add ltex for grammar/spell checking (can be resource-heavy)
|
||||
ltex = {
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "en-US", -- or "de-DE", "de-CH", etc.
|
||||
enabled = { "latex", "tex", "bib" },
|
||||
},
|
||||
},
|
||||
},
|
||||
html = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
@@ -44,7 +77,6 @@ return {
|
||||
},
|
||||
},
|
||||
pyright = {},
|
||||
|
||||
bashls = {
|
||||
filetypes = { "sh", "bash", "zsh" },
|
||||
settings = {
|
||||
@@ -59,14 +91,12 @@ return {
|
||||
-- Setup each server with the new API
|
||||
for server, config in pairs(servers) do
|
||||
config.capabilities = capabilities
|
||||
|
||||
-- Add navic on_attach for breadcrumbs
|
||||
config.on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.config[server] = config
|
||||
vim.lsp.enable(server)
|
||||
end
|
||||
|
||||
@@ -11,6 +11,9 @@ return {
|
||||
"black",
|
||||
"isort",
|
||||
"beautysh",
|
||||
"tombi",
|
||||
"tex-fmt",
|
||||
"texlab",
|
||||
|
||||
-- Linters (add these)
|
||||
"ruff", -- Python (fast!)
|
||||
|
||||
@@ -65,7 +65,7 @@ return {
|
||||
vim.keymap.set("n", "<leader>fS", builtin.lsp_workspace_symbols, {})
|
||||
|
||||
-- Diagnostics
|
||||
vim.keymap.set("n", "<leader>fd", builtin.diagnostics, {})
|
||||
vim.keymap.set("n", "<leader>fD", builtin.diagnostics, {})
|
||||
|
||||
-- Resume last picker
|
||||
vim.keymap.set("n", "<leader>f.", builtin.resume, {})
|
||||
|
||||
@@ -17,18 +17,18 @@ return {
|
||||
-- Other languages you use
|
||||
"lua",
|
||||
"vim",
|
||||
"latex",
|
||||
},
|
||||
|
||||
-- Auto install missing parsers
|
||||
auto_install = true,
|
||||
|
||||
-- Enable syntax highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Optional: disable markdown highlighting if render-markdown handles it
|
||||
-- disable = { 'markdown' },
|
||||
},
|
||||
|
||||
-- -- Enable syntax highlighting
|
||||
-- highlight = {
|
||||
-- enable = true,
|
||||
-- -- Optional: disable markdown highlighting if render-markdown handles it
|
||||
-- disable = { "latex", "tex" }, -- Disable for LaTeX
|
||||
-- },
|
||||
-- Enable indentation
|
||||
indent = {
|
||||
enable = true,
|
||||
|
||||
86
nvim/.config/nvim/lua/plugins/vimtex.lua
Normal file
86
nvim/.config/nvim/lua/plugins/vimtex.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
return {
|
||||
"lervag/vimtex",
|
||||
ft = "tex",
|
||||
config = function()
|
||||
-- PDF viewer
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
|
||||
-- Compiler settings
|
||||
vim.g.vimtex_compiler_latexmk = {
|
||||
continuous = 1,
|
||||
callback = 1,
|
||||
options = {
|
||||
"-pdf",
|
||||
"-shell-escape",
|
||||
"-verbose",
|
||||
"-file-line-error",
|
||||
"-synctex=1",
|
||||
"-interaction=nonstopmode",
|
||||
},
|
||||
}
|
||||
-- Concealment (makes LaTeX prettier to read)
|
||||
vim.g.vimtex_syntax_conceal = {
|
||||
accents = 1,
|
||||
math_symbols = 1,
|
||||
math_fracs = 1,
|
||||
math_super_sub = 1,
|
||||
}
|
||||
|
||||
vim.g.vimtex_toc_config = {
|
||||
name = "TOC",
|
||||
layers = { "content", "todo", "include" },
|
||||
split_width = 25,
|
||||
todo_sorted = 0,
|
||||
show_help = 1,
|
||||
show_numbers = 1,
|
||||
}
|
||||
|
||||
-- Don't open quickfix window automatically
|
||||
vim.g.vimtex_quickfix_mode = 0
|
||||
|
||||
-- kenable folding
|
||||
vim.g.vimtex_fold_enabled = 1
|
||||
|
||||
-- What to fold (customize as needed)
|
||||
vim.g.vimtex_fold_types = {
|
||||
envs = {
|
||||
enabled = 1,
|
||||
whitelist = {}, -- Empty = all environments
|
||||
blacklist = {},
|
||||
},
|
||||
sections = {
|
||||
enabled = 1,
|
||||
sections = {
|
||||
"%(add)?part",
|
||||
"%(chapter|%(sub)*section|%(sub)?paragraph)",
|
||||
"appendix",
|
||||
},
|
||||
},
|
||||
items = {
|
||||
enabled = 0, -- Don't fold individual list items
|
||||
},
|
||||
}
|
||||
|
||||
-- Disable some features for better performance (optional)
|
||||
vim.g.vimtex_indent_enabled = 1
|
||||
vim.g.vimtex_syntax_enabled = 1
|
||||
|
||||
vim.g.vimtex_syntax_conceal = {
|
||||
accents = 1,
|
||||
ligatures = 1,
|
||||
cites = 1,
|
||||
fancy = 1,
|
||||
spacing = 1,
|
||||
greek = 1,
|
||||
math_bounds = 1,
|
||||
math_delimiters = 1,
|
||||
math_fracs = 1,
|
||||
math_super_sub = 1,
|
||||
math_symbols = 1,
|
||||
sections = 0,
|
||||
styles = 1,
|
||||
}
|
||||
|
||||
vim.opt.conceallevel = 2
|
||||
end,
|
||||
}
|
||||
@@ -15,3 +15,7 @@ vim.keymap.set("n", "<c-l>", ":wincmd l<CR>")
|
||||
|
||||
vim.keymap.set("n", "<leader>h", ":nohlsearch<CR>")
|
||||
vim.wo.number = true
|
||||
|
||||
-- In your keybindings file
|
||||
vim.keymap.set("n", "<leader>lc", ":!pdflatex %<CR>", { desc = "Compile LaTeX" })
|
||||
vim.keymap.set("n", "<leader>lv", ":!zathura %:r.pdf &<CR>", { desc = "View PDF" })
|
||||
|
||||
Reference in New Issue
Block a user