diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..8a12ba8 --- /dev/null +++ b/nvim/lua/plugins/init.lua @@ -0,0 +1,233 @@ +-- ~/.config/nvim/lua/plugins/init.lua +return { + -- Colorschemes + { "gruvbox-community/gruvbox", priority = 1000 }, + { "folke/tokyonight.nvim", priority = 1000 }, + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + { "EdenEast/nightfox.nvim", priority = 1000 }, + { "rose-pine/neovim", name = "rose-pine", priority = 1000 }, + { "rebelot/kanagawa.nvim", priority = 1000 }, + { "sainnhe/everforest", priority = 1000 }, + + + -- Auto-save + { + "okuuva/auto-save.nvim", + version = "v1.*", + event = { "InsertLeave", "TextChanged" }, + opts = { + enabled = true, + execution_message = { + enabled = false, + }, + trigger_events = { + immediate_save = { "BufLeave", "FocusLost" }, + defer_save = { "InsertLeave", "TextChanged" }, + cancel_defered_save = { "InsertEnter" }, + }, + }, + }, + + -- File explorer + { import = "plugins.nvim-tree" }, + + -- Treesitter + { import = "plugins.treesitter" }, + + -- Rainbow delimiters + { import = "plugins.rainbow_delimiters" }, + + -- Git integration + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, + signcolumn = false, -- Disable signs by default + numhl = false, -- Disable number highlights by default + linehl = false, -- Disable line highlights by default + word_diff = false, + current_line_blame = false, + } + }, + { "tpope/vim-fugitive" }, + + -- Status line + { import = "plugins.lualine" }, + + -- FZF + { + "junegunn/fzf", + build = function() + vim.fn["fzf#install"]() + end, + }, + { "junegunn/fzf.vim" }, + + -- Productivity + { "numToStr/Comment.nvim", opts = {} }, + { "windwp/nvim-autopairs", opts = {} }, + { "tpope/vim-surround" }, + + -- Tmux navigation + { "christoomey/vim-tmux-navigator" }, + + -- LaTeX + { import = "plugins.vimtex" }, + + -- Org-mode + { + "nvim-orgmode/orgmode", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + opts = {}, + }, + + -- Telescope + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + keys = { + { "ff", ":Telescope find_files", desc = "Find files" }, + { "fg", ":Telescope live_grep", desc = "Live grep" }, + { "fb", ":Telescope buffers", desc = "Buffers" }, + { "fh", ":Telescope help_tags", desc = "Help tags" }, + }, + }, + + -- Yazi file manager + { + "mikavilpas/yazi.nvim", + keys = { + { "y", ":Yazi", desc = "Open Yazi" }, + }, + opts = { + open_for_directories = false, + keymaps = { + show_help = "", + }, + }, + }, + + -- Leap (motion) + { + "ggandor/leap.nvim", + event = "VeryLazy", + config = function() + require('leap').add_default_mappings() + -- Override default s/S with f/F to avoid conflict with surround + vim.keymap.del({'n', 'x', 'o'}, 's') + vim.keymap.del({'n', 'x', 'o'}, 'S') + vim.keymap.set({'n', 'x', 'o'}, 'f', '(leap-forward)') + vim.keymap.set({'n', 'x', 'o'}, 'F', '(leap-backward)') + end, + }, + + -- Markdown + { "SidOfc/mkdx" }, + { + "MeanderingProgrammer/render-markdown.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, + ft = { "markdown", "norg", "rmd", "org" }, + config = function() + require('render-markdown').setup({ + heading = { + enabled = true, + sign = true, + position = 'overlay', + icons = { '󰲡 ', '󰲣 ', '󰲥 ', '󰲧 ', '󰲩 ', '󰲫 ' }, + backgrounds = { + 'RenderMarkdownH1Bg', + 'RenderMarkdownH2Bg', + 'RenderMarkdownH3Bg', + 'RenderMarkdownH4Bg', + 'RenderMarkdownH5Bg', + 'RenderMarkdownH6Bg', + }, + foregrounds = { + 'RenderMarkdownH1', + 'RenderMarkdownH2', + 'RenderMarkdownH3', + 'RenderMarkdownH4', + 'RenderMarkdownH5', + 'RenderMarkdownH6', + }, + }, + }) + + -- Set highlights after ColorScheme event to ensure they persist + vim.api.nvim_create_autocmd("ColorScheme", { + callback = function() + -- Translucent heading backgrounds with alpha blending + vim.api.nvim_set_hl(0, 'RenderMarkdownH1Bg', { bg = '#2d5a7b', fg = 'NONE' }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH2Bg', { bg = '#3d5f4e', fg = 'NONE' }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH3Bg', { bg = '#5f5e3a', fg = 'NONE' }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH4Bg', { bg = '#5f4a3e', fg = 'NONE' }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH5Bg', { bg = '#4e4a5f', fg = 'NONE' }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH6Bg', { bg = '#4a5e5f', fg = 'NONE' }) + + -- Bold, colored heading text + vim.api.nvim_set_hl(0, 'RenderMarkdownH1', { fg = '#88c0d0', bold = true }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH2', { fg = '#a3be8c', bold = true }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH3', { fg = '#ebcb8b', bold = true }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH4', { fg = '#d08770', bold = true }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH5', { fg = '#b48ead', bold = true }) + vim.api.nvim_set_hl(0, 'RenderMarkdownH6', { fg = '#8fbcbb', bold = true }) + end, + }) + + -- Apply highlights immediately + vim.schedule(function() + vim.cmd('doautocmd ColorScheme') + end) + end, + }, + + -- Code formatting + { import = "plugins.prettier" }, + + -- Copilot + { + "zbirenbaum/copilot.lua", + event = "InsertEnter", + opts = { + suggestion = { enabled = true }, + panel = { enabled = true }, + }, + }, + + -- Indent guides + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {}, + }, + + -- UFO (folding) + { + "kevinhwang91/nvim-ufo", + dependencies = { "kevinhwang91/promise-async" }, + event = "BufReadPost", + config = function() + vim.o.foldcolumn = "0" + vim.o.foldlevel = 99 + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + + require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + -- Disable for latex and markdown files + if filetype == "tex" or filetype == "latex" or filetype == "markdown" then + return "" + end + return { "treesitter", "indent" } + end, + }) + end, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..7d60aa0 --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,136 @@ +-- ~/.config/nvim/lua/plugins/lsp.lua +return { + -- Mason (LSP installer) + { + "williamboman/mason.nvim", + build = ":MasonUpdate", + opts = {}, + }, + + -- Mason LSP config integration + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "mason.nvim" }, + opts = { + ensure_installed = { "lua_ls", "pyright", "texlab", "bashls", "marksman" }, + }, + }, + + -- LSP configuration + { + "neovim/nvim-lspconfig", + dependencies = { + "mason.nvim", + "mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + }, + config = function() + local lspconfig = require("lspconfig") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + -- Configure diagnostics to be hidden by default + vim.diagnostic.config({ + virtual_text = false, + signs = false, + underline = false, + update_in_insert = false, + severity_sort = false, + }) + + -- Set up keymaps for LSP + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) + end, + }) + + -- Language servers setup with capabilities + lspconfig.lua_ls.setup({ + capabilities = capabilities, + }) + lspconfig.pyright.setup({ + capabilities = capabilities, + }) + lspconfig.texlab.setup({ + capabilities = capabilities, + }) + lspconfig.bashls.setup({ + capabilities = capabilities, + }) + lspconfig.marksman.setup({ + capabilities = capabilities, + }) + end, + }, + + -- Completion + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lua", + "saadparwaiz1/cmp_luasnip", + { + "L3MON4D3/LuaSnip", + dependencies = { "rafamadriz/friendly-snippets", "evesdropper/luasnip-latex-snippets.nvim" }, + build = "make install_jsregexp", + }, + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + -- Load snippets + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets" }) + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if require("copilot.suggestion").is_visible() then + require("copilot.suggestion").accept() + elseif cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }), + }) + end, + }, +} \ No newline at end of file diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua index a6f1d95..d8b1ddd 100644 --- a/nvim/lua/plugins/lualine.lua +++ b/nvim/lua/plugins/lualine.lua @@ -1,73 +1,194 @@ -local M = {} +local colors = { + bg = "none", + fg = "#ebdbb2", + yellow = "#fabd2f", + cyan = "#8ec07c", + darkblue = "#458588", + green = "#b8bb26", + orange = "#fe8019", + violet = "#d3869b", + magenta = "#d3869b", + blue = "#83a598", + red = "#fb4934", + grey = "#504945", + black = "#282828", + white = "#fbf1c7", + darkgrey = "#3c3836", + lightgrey = "#665c54", +} -M.theme = function() - local colors = { - darkgray = "#16161d", - gray = "#727169", - innerbg = nil, - outerbg = "#16161D", - normal = "#7e9cd8", - insert = "#98bb6c", - visual = "#ffa066", - replace = "#e46876", - command = "#e6c384", - } - return { - inactive = { - a = { fg = colors.gray, bg = colors.outerbg, gui = "bold" }, - b = { fg = colors.gray, bg = colors.outerbg }, - c = { fg = colors.gray, bg = colors.innerbg }, - }, - visual = { - a = { fg = colors.darkgray, bg = colors.visual, gui = "bold" }, - b = { fg = colors.gray, bg = colors.outerbg }, - c = { fg = colors.gray, bg = colors.innerbg }, - }, - replace = { - a = { fg = colors.darkgray, bg = colors.replace, gui = "bold" }, - b = { fg = colors.gray, bg = colors.outerbg }, - c = { fg = colors.gray, bg = colors.innerbg }, - }, - normal = { - a = { fg = colors.darkgray, bg = colors.normal, gui = "bold" }, - b = { fg = colors.gray, bg = colors.outerbg }, - c = { fg = colors.gray, bg = colors.innerbg }, - }, - insert = { - a = { fg = colors.darkgray, bg = colors.insert, gui = "bold" }, - b = { fg = colors.gray, bg = colors.outerbg }, - c = { fg = colors.gray, bg = colors.innerbg }, - }, - command = { - a = { fg = colors.darkgray, bg = colors.command, gui = "bold" }, - b = { fg = colors.gray, bg = colors.outerbg }, - c = { fg = colors.gray, bg = colors.innerbg }, - }, - } -end +local theme = { + normal = { + a = { fg = colors.black, bg = colors.blue, gui = "bold" }, + b = { fg = colors.blue, bg = colors.grey }, + c = { fg = colors.white, bg = colors.darkgrey }, + x = { fg = colors.white, bg = colors.darkgrey }, + y = { fg = colors.blue, bg = colors.grey }, + z = { fg = colors.black, bg = colors.blue, gui = "bold" }, + }, + insert = { + a = { fg = colors.black, bg = colors.green, gui = "bold" }, + b = { fg = colors.green, bg = colors.grey }, + c = { fg = colors.white, bg = colors.darkgrey }, + x = { fg = colors.white, bg = colors.darkgrey }, + y = { fg = colors.green, bg = colors.grey }, + z = { fg = colors.black, bg = colors.green, gui = "bold" }, + }, + visual = { + a = { fg = colors.black, bg = colors.magenta, gui = "bold" }, + b = { fg = colors.magenta, bg = colors.grey }, + c = { fg = colors.white, bg = colors.darkgrey }, + x = { fg = colors.white, bg = colors.darkgrey }, + y = { fg = colors.magenta, bg = colors.grey }, + z = { fg = colors.black, bg = colors.magenta, gui = "bold" }, + }, + replace = { + a = { fg = colors.black, bg = colors.red, gui = "bold" }, + b = { fg = colors.red, bg = colors.grey }, + c = { fg = colors.white, bg = colors.darkgrey }, + x = { fg = colors.white, bg = colors.darkgrey }, + y = { fg = colors.red, bg = colors.grey }, + z = { fg = colors.black, bg = colors.red, gui = "bold" }, + }, + command = { + a = { fg = colors.black, bg = colors.yellow, gui = "bold" }, + b = { fg = colors.yellow, bg = colors.grey }, + c = { fg = colors.white, bg = colors.darkgrey }, + x = { fg = colors.white, bg = colors.darkgrey }, + y = { fg = colors.yellow, bg = colors.grey }, + z = { fg = colors.black, bg = colors.yellow, gui = "bold" }, + }, + inactive = { + a = { fg = colors.white, bg = colors.darkgrey }, + b = { fg = colors.white, bg = colors.darkgrey }, + c = { fg = colors.white, bg = colors.darkgrey }, + }, +} -require('lualine').setup { +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + event = "VeryLazy", + opts = { options = { - icons_enabled = true, - theme = M.theme(), -- Apply the custom theme - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - always_show_tabline = true, - globalstatus = false, - refresh = { - statusline = 100, - tabline = 100, - winbar = 100, + icons_enabled = true, + theme = theme, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = true, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + }, + }, + sections = { + lualine_a = { + { + "mode", + fmt = function(str) + local mode_map = { + ["NORMAL"] = "N", + ["INSERT"] = "I", + ["VISUAL"] = "V", + ["V-LINE"] = "VL", + ["V-BLOCK"] = "VB", + ["COMMAND"] = "C", + ["REPLACE"] = "R", + ["TERMINAL"] = "T" + } + return mode_map[str] or str + end, + separator = { right = "" } } + }, + lualine_b = { + { + "branch", + icon = "󰘬", + separator = { right = "" } + }, + { + "diff", + symbols = { added = "󰐕 ", modified = "󰝤 ", removed = "󰍵 " }, + separator = { right = "" } + }, + { + "diagnostics", + symbols = { error = "󰅚 ", warn = "󰀪 ", info = "󰋽 ", hint = "󰌶 " }, + separator = { right = "" } + } + }, + lualine_c = { + { + "filename", + path = 1, + shorting_target = 40, + symbols = { modified = "󰏫", readonly = "󰌾", unnamed = "󰡯" } + } + }, + lualine_x = { + { + function() + local clients = vim.lsp.get_clients() + if next(clients) == nil then + return "" + end + local client_names = {} + for _, client in pairs(clients) do + table.insert(client_names, client.name) + end + return "󰅠 " .. table.concat(client_names, ", ") + end, + color = { fg = colors.cyan }, + separator = { left = "" } + }, + { + "filesize", + cond = function() return vim.fn.getfsize(vim.fn.expand('%:p')) > 0 end, + separator = { left = "" } + }, + { + "encoding", + cond = function() return vim.bo.fileencoding ~= 'utf-8' end, + separator = { left = "" } + }, + { + "filetype", + icons_enabled = true, + separator = { left = "" } + } + }, + lualine_y = { + { + "progress", + separator = { left = "" } + } + }, + lualine_z = { + { + "location", + separator = { left = "" } + } + }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { { "filename", path = 1 } }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, }, tabline = {}, winbar = {}, inactive_winbar = {}, - extensions = {} -} + extensions = { "nvim-tree", "fzf", "lazy" }, + }, +} \ No newline at end of file diff --git a/nvim/lua/plugins/material.lua b/nvim/lua/plugins/material.lua new file mode 100644 index 0000000..fc008cb --- /dev/null +++ b/nvim/lua/plugins/material.lua @@ -0,0 +1,56 @@ +return { + "marko-cerovac/material.nvim", + priority = 1000, + config = function() + require('material').setup({ + contrast = { + terminal = false, + sidebars = false, + floating_windows = false, + cursor_line = false, + lsp_virtual_text = false, + non_current_windows = false, + filetypes = {}, + }, + styles = { + comments = { italic = true }, + strings = {}, + keywords = {}, + functions = {}, + variables = {}, + operators = {}, + types = {}, + }, + plugins = { + "dap", + "gitsigns", + "indent-blankline", + "lspsaga", + "mini", + "neo-tree", + "nvim-cmp", + "nvim-navic", + "nvim-tree", + "nvim-web-devicons", + "telescope", + "trouble", + "which-key", + }, + disable = { + colored_cursor = false, + borders = false, + background = false, + term_colors = false, + eob_lines = false + }, + high_visibility = { + lighter = false, + darker = false + }, + lualine_style = "default", + async_loading = true, + custom_colors = nil, + custom_highlights = {}, + }) + end +} \ No newline at end of file diff --git a/nvim/lua/plugins/nvim-tree.lua b/nvim/lua/plugins/nvim-tree.lua index d2d4dd8..7701441 100644 --- a/nvim/lua/plugins/nvim-tree.lua +++ b/nvim/lua/plugins/nvim-tree.lua @@ -1,9 +1,31 @@ -local M = {} - -function M.setup() -vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', { noremap = true, silent = true }) - - require("nvim-tree").setup({ +return { + "nvim-tree/nvim-tree.lua", + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { "e", ":NvimTreeToggle", desc = "Toggle file tree" }, + }, + config = function() + vim.fn.sign_define("NvimTreeDiagnosticErrorIcon", { text = "", texthl = "DiagnosticError" }) + vim.fn.sign_define("NvimTreeDiagnosticWarnIcon", { text = "", texthl = "DiagnosticWarn" }) + vim.fn.sign_define("NvimTreeDiagnosticInfoIcon", { text = "", texthl = "DiagnosticInfo" }) + vim.fn.sign_define("NvimTreeDiagnosticHintIcon", { text = "", texthl = "DiagnosticHint" }) + + local git_enabled = false + local function toggle_git_signs() + git_enabled = not git_enabled + require("nvim-tree").setup({ + git = { + enable = git_enabled, + ignore = false, + }, + }) + require("nvim-tree.api").tree.reload() + print("Git signs " .. (git_enabled and "enabled" or "disabled")) + end + + vim.keymap.set("n", "tg", toggle_git_signs, { desc = "Toggle git signs" }) + + require("nvim-tree").setup({ view = { width = 35, side = "left", @@ -13,21 +35,21 @@ vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', { noremap = tru highlight_opened_files = "all", icons = { glyphs = { - default = "", - symlink = "", + default = "", + symlink = "", folder = { - arrow_closed = "", - arrow_open = "", - default = "", - open = "", + arrow_closed = "", + arrow_open = "", + default = "", + open = "", }, git = { unstaged = "✗", staged = "✓", - unmerged = "", + unmerged = "", renamed = "➜", untracked = "★", - deleted = "", + deleted = "", ignored = "◌", }, }, @@ -40,10 +62,10 @@ vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', { noremap = tru enable = true, show_on_dirs = true, icons = { - hint = "", - info = "", - warning = "", - error = "", + hint = "", + info = "", + warning = "", + error = "", }, }, filters = { @@ -55,10 +77,9 @@ vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', { noremap = tru }, }, git = { - enable = true, + enable = false, ignore = false, }, - }) -end - -return M + }) + end, +} diff --git a/nvim/lua/plugins/outline.lua b/nvim/lua/plugins/outline.lua index 47c8104..0caefde 100644 --- a/nvim/lua/plugins/outline.lua +++ b/nvim/lua/plugins/outline.lua @@ -1,20 +1,17 @@ --- plugins/outline.lua -local M = {} - -M.setup = function() - vim.api.nvim_set_keymap('n', 'o', ':Outline', { noremap = true, silent = true }) - require('outline').setup({ - - - show_guides = true, -- Show outline guides - auto_close = false, -- Do not auto-close the outline - auto_open = true, -- Automatically open the outline - preview_lines = 10, -- Number of preview lines to show - keymaps = { -- Custom key mappings for the outline - jump = 'o', -- Jump to the selected item - expand_collapse = 'u', -- Expand or collapse an item - }, - }) -end - -return M +return { + "hedyhli/outline.nvim", + cmd = "Outline", + keys = { + { "o", ":Outline", desc = "Toggle outline" }, + }, + opts = { + show_guides = true, + auto_close = false, + auto_open = true, + preview_lines = 10, + keymaps = { + jump = "o", + expand_collapse = "u", + }, + }, +} \ No newline at end of file diff --git a/nvim/lua/plugins/prettier.lua b/nvim/lua/plugins/prettier.lua index 442cb36..63ff3a3 100644 --- a/nvim/lua/plugins/prettier.lua +++ b/nvim/lua/plugins/prettier.lua @@ -1,20 +1,28 @@ -local null_ls = require("null-ls") - -null_ls.setup({ - debug = false, -- set to true if you want log spam - sources = { - null_ls.builtins.formatting.prettier.with({ - filetypes = { "markdown", "markdown.pandoc", "pandoc" }, - }), - }, - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_create_autocmd("BufWritePre", { - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ bufnr = bufnr }) - end, - }) - end +return { + "nvimtools/none-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + debug = false, + sources = { + -- null_ls.builtins.diagnostics.markdownlint.with({ + -- filetypes = { "markdown", "markdown.pandoc", "pandoc" }, + -- }), + null_ls.builtins.formatting.prettier.with({ + filetypes = { "markdown", "markdown.pandoc", "pandoc" }, + }), + }, + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end, + }) + end + end, + }) end, -}) +} \ No newline at end of file diff --git a/nvim/lua/plugins/rainbow_delimiters.lua b/nvim/lua/plugins/rainbow_delimiters.lua index 1ebe2ac..2452220 100644 --- a/nvim/lua/plugins/rainbow_delimiters.lua +++ b/nvim/lua/plugins/rainbow_delimiters.lua @@ -1,29 +1,31 @@ --- Rainbow Delimiters Configuration -local rainbow_delimiters = require 'rainbow-delimiters' - ----@type rainbow_delimiters.config -vim.g.rainbow_delimiters = { - strategy = { - [''] = rainbow_delimiters.strategy['global'], - vim = rainbow_delimiters.strategy['local'], - }, - query = { - [''] = 'rainbow-delimiters', - lua = 'rainbow-blocks', - }, - priority = { - [''] = 110, +return { + "HiPhish/rainbow-delimiters.nvim", + config = function() + local rainbow_delimiters = require("rainbow-delimiters") + + ---@type rainbow_delimiters.config + vim.g.rainbow_delimiters = { + strategy = { + [""] = rainbow_delimiters.strategy["global"], + vim = rainbow_delimiters.strategy["local"], + }, + query = { + [""] = "rainbow-delimiters", + lua = "rainbow-blocks", + }, + priority = { + [""] = 110, lua = 210, - }, - highlight = { - 'RainbowDelimiterRed', - 'RainbowDelimiterYellow', - 'RainbowDelimiterBlue', - 'RainbowDelimiterOrange', - 'RainbowDelimiterGreen', - 'RainbowDelimiterViolet', - 'RainbowDelimiterCyan', - }, -} - - + }, + highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", + }, + } + end, +} \ No newline at end of file diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index a4c5df1..f5f4046 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,36 +1,50 @@ -require'nvim-treesitter.configs'.setup { - ensure_installed = { "c", "lua", "python", "javascript", "markdown", "markdown_inline", "html", "css" }, - sync_install = false, - auto_install = true, +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "c", "lua", "python", "javascript", "markdown", "markdown_inline", "html", "css", "bash", "vim", "vimdoc" }, + sync_install = false, + auto_install = true, + ignore_install = {}, - highlight = { - enable = true, - disable = function(lang, buf) - local filename = vim.api.nvim_buf_get_name(buf) - if lang == "latex" or filename:match("%.bib$") then - return true - end - return false - end, - }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + local filename = vim.api.nvim_buf_get_name(buf) + if lang == "latex" or filename:match("%.bib$") then + return true + end + return false + end, + }, - indent = { - enable = true, - disable = { "tex", "bib", "markdown" } - }, + indent = { + enable = true, + disable = { "tex", "bib", "markdown" }, + }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, -} + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + }) -vim.opt.foldmethod = "expr" -vim.opt.foldexpr = "nvim_treesitter#foldexpr()" -vim.opt.foldlevel = 2 -vim.opt.foldenable = true + -- Better folding setup + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" + vim.opt.foldlevel = 20 + vim.opt.foldenable = false + end, +} \ No newline at end of file diff --git a/nvim/lua/plugins/vimtex.lua b/nvim/lua/plugins/vimtex.lua index 4df1176..78e41f4 100644 --- a/nvim/lua/plugins/vimtex.lua +++ b/nvim/lua/plugins/vimtex.lua @@ -1,59 +1,35 @@ --- File: ~/.config/nvim/lua/plugins/vimtex.lua +return { + "lervag/vimtex", + ft = { "tex", "latex" }, + config = function() + -- VimTeX Configuration + vim.g.vimtex_view_method = "skim" + vim.g.vimtex_view_skim_sync = 1 + vim.g.vimtex_view_skim_activate = 1 + vim.g.vimtex_compiler_method = "latexmk" + vim.g.vimtex_quickfix_mode = 0 + vim.g.vimtex_syntax_enabled = 1 + vim.g.vimtex_fold_enabled = 1 + vim.g.vimtex_format_enabled = 1 --- VimTeX Configuration -vim.g.vimtex_view_method = 'skim' -- Use Skim as the PDF viewer -vim.g.vimtex_view_skim_sync = 1 -- Enable forward search with Skim -vim.g.vimtex_view_skim_activate = 1 -- Activate Skim on compilation + -- Custom TeX Engine Commands + vim.api.nvim_create_user_command("LuaTeX", "!lualatex %", { nargs = 0 }) + vim.api.nvim_create_user_command("XeTeX", "!xelatex %", { nargs = 0 }) + vim.api.nvim_create_user_command("PdfLaTeX", "!pdflatex %", { nargs = 0 }) + vim.api.nvim_create_user_command("ViewPDF", "!open -a Skim " .. vim.fn.expand("%:r") .. ".pdf", { nargs = 0 }) + vim.api.nvim_create_user_command("CheckErrors", '!grep -i error %.log || echo "No errors found!"', { nargs = 0 }) + vim.api.nvim_create_user_command( + "CleanAuxFiles", + "!rm -f *.aux *.log *.out *.toc *.bbl *.blg *.synctex.gz *.fls *.fdb_latexmk", + { nargs = 0 } + ) -vim.g.vimtex_compiler_method = 'latexmk' -- Use latexmk for LaTeX compilation -vim.g.vimtex_quickfix_mode = 0 -- Disable automatic quickfix window -vim.g.vimtex_syntax_enabled = 1 -- Enable VimTeX syntax highlighting -vim.g.vimtex_fold_enabled = 1 -- Enable VimTeX syntax highlighting -vim.g.vimtex_format_enabled = 1 -- Enable VimTeX syntax highlighting - --- Custom TeX Engine Commands -vim.api.nvim_create_user_command( - 'LuaTeX', - '!lualatex %', - { nargs = 0 } -) - -vim.api.nvim_create_user_command( - 'XeTeX', - '!xelatex %', - { nargs = 0 } -) - -vim.api.nvim_create_user_command( - 'PdfLaTeX', - '!pdflatex %', - { nargs = 0 } -) - --- View PDF Command -vim.api.nvim_create_user_command( - 'ViewPDF', - '!open -a Skim ' .. vim.fn.expand('%:r') .. '.pdf', - { nargs = 0 } -) - --- Check for Errors in Log File -vim.api.nvim_create_user_command( - 'CheckErrors', - '!grep -i error %.log || echo "No errors found!"', - { nargs = 0 } -) -vim.api.nvim_create_user_command( - 'CleanAuxFiles', - '!rm -f *.aux *.log *.out *.toc *.bbl *.blg *.synctex.gz *.fls *.fdb_latexmk', - { nargs = 0 } -) - - --- Keybindings for TeX Workflow -vim.keymap.set('n', 'll', ':LuaTeX', { noremap = true, silent = true }) -vim.keymap.set('n', 'lx', ':XeTeX', { noremap = true, silent = true }) -vim.keymap.set('n', 'lp', ':PdfLaTeX', { noremap = true, silent = true }) -vim.keymap.set('n', 'lv', ':ViewPDF', { noremap = true, silent = true }) -vim.keymap.set('n', 'le', ':CheckErrors', { noremap = true, silent = true }) -vim.keymap.set('n', 'lc', ':CleanAuxFiles', { noremap = true, silent = true }) + -- Keybindings for TeX Workflow + vim.keymap.set("n", "ll", ":LuaTeX", { noremap = true, silent = true }) + vim.keymap.set("n", "lx", ":XeTeX", { noremap = true, silent = true }) + vim.keymap.set("n", "lp", ":PdfLaTeX", { noremap = true, silent = true }) + vim.keymap.set("n", "lv", ":ViewPDF", { noremap = true, silent = true }) + vim.keymap.set("n", "le", ":CheckErrors", { noremap = true, silent = true }) + vim.keymap.set("n", "lc", ":CleanAuxFiles", { noremap = true, silent = true }) + end, +} \ No newline at end of file