update nvim config

fix treesitter latex
This commit is contained in:
Never Gude 2026-01-15 16:50:00 +01:00
parent d6434a73fd
commit e5c3bb2492
2 changed files with 49 additions and 51 deletions

View file

@ -0,0 +1,5 @@
vim.o.wrap = false
vim.treesitter.start()
-- vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- vim.wo[0][0].foldmethod = 'expr'

View file

@ -2,26 +2,19 @@
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.o.undofile = true
-- [[ Setting options ]] See `:h vim.o`
-- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list`
-- To see documentation for an option, you can use `:h 'optionname'`, for example `:h 'number'`
-- (Note the single quotes)
-- Disable mouse input
vim.o.mouse = ""
-- Print the line number in front of each line
vim.o.number = true
local augroup = vim.api.nvim_create_augroup("numbertoggle", {})
local numbertoggle_group = vim.api.nvim_create_augroup("numbertoggle", {})
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "CmdlineLeave", "WinEnter" }, {
pattern = "*",
group = augroup,
group = numbertoggle_group,
callback = function()
if vim.o.nu and vim.api.nvim_get_mode().mode ~= "i" then
vim.opt.relativenumber = true
@ -31,7 +24,7 @@ vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "Cmdline
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter", "WinLeave" }, {
pattern = "*",
group = augroup,
group = numbertoggle_group,
callback = function()
if vim.o.nu then
vim.opt.relativenumber = false
@ -56,14 +49,6 @@ vim.api.nvim_create_autocmd("UIEnter", {
vim.o.termguicolors = true
vim.cmd.colorscheme("gruvbox")
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.showmode = false
vim.o.signcolumn = "yes"
-- Highlight the line where the cursor is on
vim.o.cursorline = true
@ -73,17 +58,25 @@ vim.o.colorcolumn = "80"
-- Minimal number of screen lines to keep above and below the cursor.
vim.o.scrolloff = 10
-- Set default tabstop and shiftwidth
vim.o.tabstop = 4
vim.o.shiftwidth = 4
-- Show <tab> and trailing spaces
vim.o.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "" }
-- Disable line wrap
-- Configure line wrap
vim.o.linebreak = true
vim.o.breakindent = true
vim.o.showbreak = ""
vim.o.tabstop = 4
vim.o.shiftwidth = 4
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.o.ignorecase = true
vim.o.smartcase = true
-- Use undofile to preserve actions over restarts
vim.o.undofile = true
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s) See `:help 'confirm'`
@ -106,7 +99,6 @@ vim.keymap.set({ "n" }, "<A-l>", "<C-w>l")
-- [[ Basic Autocommands ]].
-- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()`
-- Highlight when yanking (copying) text.
-- Try it with `yap` in normal mode. See `:h vim.hl.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", {
@ -135,25 +127,7 @@ end, { desc = "Print the git blame for the current line" })
vim.cmd("packadd! nohlsearch")
vim.pack.add({"https://github.com/nvim-treesitter/nvim-treesitter"})
-- require("nvim-treesitter.install").update("all") -- automatically update all TS-grammars
-- require("nvim-treesitter.config").setup()
-- require("nvim-treesitter").setup({
-- sync_install = true,
-- modules = {},
-- ignore_install = {},
-- ensure_installed = {
-- "lua",
-- "c",
-- "ocaml",
-- "latex",
-- },
-- auto_install = true, -- autoinstall languages that are not installed yet
-- highlight = {
-- enable = true,
-- },
-- })
require("nvim-treesitter").install('latex', 'lua', 'c', 'ocaml')
-- Treat Ipe stylesheets as xml code
vim.filetype.add({
@ -179,7 +153,7 @@ vim.pack.add({
"https://github.com/mason-org/mason.nvim", -- package manager
"https://github.com/mason-org/mason-lspconfig.nvim", -- lspconfig bridge
"https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim", -- auto installer
}, { confirm = false })
})
require("mason").setup()
require("mason-lspconfig").setup()
@ -219,13 +193,11 @@ vim.diagnostic.config({
virtual_text = true, -- Show inline diagnostics
})
vim.keymap.set("n", "<leader>dn", "]d") -- Jump to next diagnostic
vim.keymap.set("n", "<leader>dp", "[d") -- Jump to next diagnostic
vim.keymap.set("n", "<leader>dN", "]D") -- Jump to last diagnostic
vim.keymap.set("n", "<leader>dP", "[D") -- Jump to first diagnostic
vim.keymap.set("n", "<leader>ds", "<C-w>d") -- Display diagnostic on current line
require("nvim-treesitter").install('latex')
vim.keymap.set("n", "<leader>dn", "]d", {desc = "Jump to next diagnostic"})
vim.keymap.set("n", "<leader>dp", "[d", {desc = "Jump to previous diagnostic"})
vim.keymap.set("n", "<leader>dN", "]D", {desc = "Jump to last diagnostic"})
vim.keymap.set("n", "<leader>dP", "[D", {desc = "Jump to first diagnostic"})
vim.keymap.set("n", "<leader>ds", "<C-w>d", {desc = "Display diagnostic on current line"})
vim.pack.add({
"https://github.com/nvim-mini/mini.completion",
@ -240,13 +212,28 @@ vim.pack.add({
}, { confirm = false })
vim.o.winborder = "none"
-- Use mini.completion
require("mini.completion").setup()
-- Snipped integration for mini.completion
require("mini.snippets").setup()
-- Icons for statusline and completion
require("mini.icons").setup()
-- Use mini.statusline instead of native showmode
require("mini.statusline").setup()
vim.o.showmode = false
-- Git integration for statusline and Command mode
require("mini.git").setup()
-- Show git diff in linenumbers
require("mini.diff").setup()
-- Use and configure mini.clue
local miniclue = require("mini.clue")
miniclue.setup({
triggers = {
@ -291,9 +278,14 @@ miniclue.setup({
window = {
delay = 200,
config = {
width = 'auto',
}
}
})
-- Use and configure mini.hipatterns
local hipatterns = require('mini.hipatterns')
hipatterns.setup({
highlighters = {
@ -308,4 +300,5 @@ hipatterns.setup({
},
})
-- Use mini.notify
require("mini.notify").setup()