dots

Mika's dotfiles
git clone git://popovic.xyz/dots.git/
Log | Files | Refs | README

commit 5b26c0ef8d8013af7a84cd55b3ff7077ba0f4731
parent bc693f185c1e6533bf11dc45f42e54d01b03d85e
Author: Milutin Popovic <milutin@popovic.xyz>
Date:   Wed, 11 Mar 2026 11:55:17 +0000

formating

Diffstat:
M.config/nvim/lua/config/autocmd.lua | 65++++++++++++++++++++---------------------------------------------
M.config/nvim/lua/config/keymaps.lua | 6+++---
M.config/nvim/lua/plugins/autorepair.lua | 8++++----
M.config/nvim/lua/plugins/color.lua | 94++++++++++++++++++++++++++++++++++++++++----------------------------------------
M.config/nvim/lua/plugins/completions.lua | 172++++++++++++++++++++++++++++++++++++++++----------------------------------------
M.config/nvim/lua/plugins/copilot.lua | 44++++++++++++++++++++++----------------------
M.config/nvim/lua/plugins/copilotchat.lua | 86++++++++++++++++++++++++++++++++++++++++----------------------------------------
M.config/nvim/lua/plugins/floaterm.lua | 12++++++------
M.config/nvim/lua/plugins/hints.lua | 72++++++++++++++++++++++++++++++++++++------------------------------------
M.config/nvim/lua/plugins/ibl.lua | 24+++++++++++-------------
M.config/nvim/lua/plugins/lsp.lua | 180++++++++++++++++++++++++++++++++++++++++++-------------------------------------
M.config/nvim/lua/plugins/luasnip.lua | 26+++++++++++++-------------
M.config/nvim/lua/plugins/rustacean.lua | 192++++++++++++++++++++++++++++++++++++++++----------------------------------------
M.config/nvim/lua/plugins/treesitter.lua | 66+++++++++++++++++++++++++++++++++---------------------------------
M.config/nvim/lua/plugins/undotree.lua | 8++++----
M.config/nvim/lua/plugins/vimtex.lua | 50+++++++++++++++++++++++++-------------------------
M.config/nvim/lua/snippets/basic.lua | 18+++++++++---------
M.config/nvim/lua/snippets/rust.lua | 23++++++++++++-----------
18 files changed, 565 insertions(+), 581 deletions(-)

diff --git a/.config/nvim/lua/config/autocmd.lua b/.config/nvim/lua/config/autocmd.lua @@ -2,72 +2,47 @@ local autocmd = vim.api.nvim_create_autocmd -- Delete trailing whitespace autocmd({'BufWritePre'}, { - pattern = '*', - command = [[%s/\s\+$//e]], + pattern = '*', + command = [[%s/\s\+$//e]], }) autocmd({'BufEnter'}, { - pattern = 'justfile', - command = "set filetype=make"; + pattern = 'justfile', + command = "set filetype=make"; }) autocmd({'BufWritePost'}, { - pattern = vim.fn.expand('~') .. '/.config/X/Xresources', - command = '!xrdb %', + pattern = vim.fn.expand('~') .. '/.config/X/Xresources', + command = '!xrdb %', }) autocmd({'BufWritePost'}, { - pattern = vim.fn.expand('~') .. '/.config/X/Xresources.mon', - command = '!xrdb %', + pattern = vim.fn.expand('~') .. '/.config/X/Xresources.mon', + command = '!xrdb %', }) ---autocmd({'BufWritePost'}, { --- pattern = vim.fn.expand('~') .. '/.local/src/dmenu/config.def.h', --- command = '!cd ~/.local/src/dmenu/; sudo make clean install && { killall -q dmenu}', ---}) --- ---autocmd({'BufWritePost'}, { --- pattern = vim.fn.expand('~') .. '/.local/src/dwm/config.def.h', --- command = '!cd ~/.local/src/dwm/; sudo make clean install && { killall -q dwm;setsid dwm & }', ---}) --- ---autocmd({'BufWritePost'}, { --- pattern = vim.fn.expand('~') .. '/.local/src/dwmblocks/config.h', --- command = '!cd ~/.local/src/dwmblocks/; sudo make clean install && { killall -q dwmblocks;setsid dwmblocks & }', ---}) --- ---autocmd({'BufWritePost'}, { --- pattern = vim.fn.expand('~') .. '/.local/src/st/config.h', --- command = '!cd ~/.local/src/st/; sudo make clean install && { killall -q st;setsid st & }', ---}) --- ---autocmd({'BufWritePost'}, { --- pattern = vim.fn.expand('~') .. '/.local/src/slock/config.h', --- command = '!cd ~/.local/src/slock/; sudo make clean install && { killall -q slock;setsid & }', ---}) - -- Convert two spaces to tabs in router folder autocmd({'BufWritePre'}, { - pattern = '*/router/*.ts', - callback = function() - vim.cmd([[%s/ /\t/ge]]) - end, + pattern = '*/oari/*.ts', + callback = function() + vim.cmd([[%s/ /\t/ge]]) + end, }) -- Convert tabs to two spaces on buf enter autocmd({'BufEnter'}, { - pattern = '*/router/*.ts', - callback = function() - vim.cmd([[%s/\t/ /ge]]) - end, + pattern = '*/oari/*.ts', + callback = function() + vim.cmd([[%s/\t/ /ge]]) + end, }) -- Convert double qotes to single qotes on save autocmd({'BufWritePre'}, { - pattern = '*/router/*.ts', - callback = function() - vim.cmd([[%s/"/'/ge]]) - end, + pattern = '*/oari/*.ts', + callback = function() + vim.cmd([[%s/"/'/ge]]) + end, }) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua @@ -16,7 +16,7 @@ vim.keymap.set("n", "<leader>b", ":! firefox %") vim.keymap.set('c', 'w!!', ':w ! sudo tee % > /dev/null') vim.keymap.set('n', '<C-S>', function() - local bad = vim.fn.expand("<cword>") - local word_list = vim.fn.spellsuggest(bad) - end + local bad = vim.fn.expand("<cword>") + local word_list = vim.fn.spellsuggest(bad) + end ) diff --git a/.config/nvim/lua/plugins/autorepair.lua b/.config/nvim/lua/plugins/autorepair.lua @@ -1,6 +1,6 @@ return { - 'windwp/nvim-autopairs', - event = "InsertEnter", - config = true, - disable_filetype = { "TelescopePrompt" , "vim" }, + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true, + disable_filetype = { "TelescopePrompt" , "vim" }, } diff --git a/.config/nvim/lua/plugins/color.lua b/.config/nvim/lua/plugins/color.lua @@ -1,58 +1,58 @@ function ColorMyPencils(color) - color = color or "rose-pine-moon" - vim.cmd.colorscheme(color) - vim.opt.cursorline = true + color = color or "rose-pine-moon" + vim.cmd.colorscheme(color) + vim.opt.cursorline = true - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) - vim.api.nvim_set_hl(0, "MatchParen", { bg= "darkred" }) - vim.api.nvim_set_hl(0, "SpellBad", { bold=true, underline=true, fg= "red" }) + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) + vim.api.nvim_set_hl(0, "MatchParen", { bg= "darkred" }) + vim.api.nvim_set_hl(0, "SpellBad", { bold=true, underline=true, fg= "red" }) - -- separators - vim.api.nvim_set_hl(0, "WinSeparator", { fg="#A96C8A", bold=true }) - vim.api.nvim_set_hl(0, "StatusLine", { fg="#6CA98A" }) + -- separators + vim.api.nvim_set_hl(0, "WinSeparator", { fg="#A96C8A", bold=true }) + vim.api.nvim_set_hl(0, "StatusLine", { fg="#6CA98A" }) - vim.fn.matchadd("ExtraWhiteSpace", '\\v\\s+$') - vim.api.nvim_set_hl(0, "ExtraWhiteSpace", { ctermbg="red", bg="red" }) - local nontexthl = vim.api.nvim_get_hl_by_name("NonText", true) + vim.fn.matchadd("ExtraWhiteSpace", '\\v\\s+$') + vim.api.nvim_set_hl(0, "ExtraWhiteSpace", { ctermbg="red", bg="red" }) + local nontexthl = vim.api.nvim_get_hl_by_name("NonText", true) - -- colpilot chat - vim.api.nvim_set_hl(0, 'CopilotChatHeader', { fg = '#7C3AED', bold = true }) - vim.api.nvim_set_hl(0, 'CopilotChatSeparator', { fg = '#374151' }) + -- colpilot chat + vim.api.nvim_set_hl(0, 'CopilotChatHeader', { fg = '#7C3AED', bold = true }) + vim.api.nvim_set_hl(0, 'CopilotChatSeparator', { fg = '#374151' }) - -- TelescopeBorder - vim.api.nvim_set_hl(0, 'TelescopeBorder', { fg = '#A96C8A', bold=true }) - vim.api.nvim_set_hl(0, 'TelescopeTitle', { fg = '#6CA98A', bold=true }) + -- TelescopeBorder + vim.api.nvim_set_hl(0, 'TelescopeBorder', { fg = '#A96C8A', bold=true }) + vim.api.nvim_set_hl(0, 'TelescopeTitle', { fg = '#6CA98A', bold=true }) - -- lsp hints - vim.api.nvim_set_hl(0, "LspInlayHint", { bg = "none", fg = nontexthl.foreground }) - vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none", fg = "#6CA98A", bold = true }) + -- lsp hints + vim.api.nvim_set_hl(0, "LspInlayHint", { bg = "none", fg = nontexthl.foreground }) + vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none", fg = "#6CA98A", bold = true }) end return { - { - "rose-pine/neovim", - name = "rose-pine", - config = function() - require('rose-pine').setup({ - dark_variant = "main", - dim_inactive_windows = true, - disable_background = true, - disable_nc_background = true, - disable_float_background = true, - extend_background_behind_borders = true, - enable = { - terminal = true, - legacy_highlights = true, - migrations = true, - }, - styles = { - bold = true, - italic = true, - transparency = false, - }, - }) - ColorMyPencils(); - end - }, + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + require('rose-pine').setup({ + dark_variant = "main", + dim_inactive_windows = true, + disable_background = true, + disable_nc_background = true, + disable_float_background = true, + extend_background_behind_borders = true, + enable = { + terminal = true, + legacy_highlights = true, + migrations = true, + }, + styles = { + bold = true, + italic = true, + transparency = false, + }, + }) + ColorMyPencils(); + end + }, } diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua @@ -1,105 +1,105 @@ return { "hrsh7th/nvim-cmp", dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - "zbirenbaum/copilot-cmp" + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "zbirenbaum/copilot-cmp" }, config = function () - vim.o.winborder = 'single' + vim.o.winborder = 'single' require("copilot_cmp").setup() local cmp = require('cmp') - cmp.setup({ - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - mapping = { + cmp.setup({ + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + mapping = { ["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, ["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, - ['<`-j>'] = cmp.mapping.scroll_docs(-4), - ['<`-k>'] = cmp.mapping.scroll_docs(4), - ['<C-a>'] = cmp.mapping( + ['<`-j>'] = cmp.mapping.scroll_docs(-4), + ['<`-k>'] = cmp.mapping.scroll_docs(4), + ['<C-a>'] = cmp.mapping( cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Insert, select = true, }, { "i", "c" } ), - }, - sources = { - { name = 'copilot' }, - { name = 'nvim_lsp'}, - { name = 'luasnip' }, - { name = 'buffer' }, - { name = 'path' }, - }, - window = { - documentation = { - winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None,NormalFloat:Normal', - }, - completion = { - winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None,NormalFloat:Normal', - }, - }, - formatting = { - fields = {'menu', 'abbr', 'kind'}, - format = function(entry, item) - local menu_icon ={ - nvim_lsp = 'λ', - luasnip = '⋗', - buffer = 'Ω', - path = '🖫', - copilot = " " - } - item.menu = menu_icon[entry.source.name] - return item - end, - }, - }) + }, + sources = { + { name = 'copilot' }, + { name = 'nvim_lsp'}, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + }, + window = { + documentation = { + winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None,NormalFloat:Normal', + }, + completion = { + winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None,NormalFloat:Normal', + }, + }, + formatting = { + fields = {'menu', 'abbr', 'kind'}, + format = function(entry, item) + local menu_icon ={ + nvim_lsp = 'λ', + luasnip = '⋗', + buffer = 'Ω', + path = '🖫', + copilot = " " + } + item.menu = menu_icon[entry.source.name] + return item + end, + }, + }) - local endhints = require("lsp-endhints") - endhints.enable() - endhints.setup { - icons = { - type = "-> ", - parameter = "<= ", - offspec = "<= ", -- hint kind not defined in official LSP spec - unknown = "? ", -- hint kind is nil - }, - label = { - truncateAtChars = 50, - padding = 1, - marginLeft = 0, - sameKindSeparator = ", ", - }, - extmark = { - priority = 50, - }, - autoEnableHints = true, - } + local endhints = require("lsp-endhints") + endhints.enable() + endhints.setup { + icons = { + type = "-> ", + parameter = "<= ", + offspec = "<= ", -- hint kind not defined in official LSP spec + unknown = "? ", -- hint kind is nil + }, + label = { + truncateAtChars = 50, + padding = 1, + marginLeft = 0, + sameKindSeparator = ", ", + }, + extmark = { + priority = 50, + }, + autoEnableHints = true, + } - map('n', '<leader>h', function(bufnr) - if vim.lsp.inlay_hint.is_enabled() then - print("Inlay Hitnts OFF") - else - print("Inlay Hitnts ON") - end - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), bufnr) - end, { silent = true, noremap = true }) + map('n', '<leader>h', function(bufnr) + if vim.lsp.inlay_hint.is_enabled() then + print("Inlay Hitnts OFF") + else + print("Inlay Hitnts ON") + end + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), bufnr) + end, { silent = true, noremap = true }) - map('n', '<leader>d', function() - if vim.diagnostic.is_enabled() then - print("Diagnostics OFF") - else - print("Diagnostics ON") - end - vim.diagnostic.enable(not vim.diagnostic.is_enabled()) - end, { silent = true, noremap = true }) - end + map('n', '<leader>d', function() + if vim.diagnostic.is_enabled() then + print("Diagnostics OFF") + else + print("Diagnostics ON") + end + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) + end, { silent = true, noremap = true }) + end } diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua @@ -1,24 +1,24 @@ return { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - event = "InsertEnter", - requires = { - "copilotlsp-nvim/copilot-lsp", -- (optional) for NES functionality - }, - config = function() - require("copilot").setup({ - filetypes = { - yaml = false, - markdown = false, - help = false, - gitcommit = false, - gitrebase = false, - hgcommit = false, - txt = false, - svn = false, - cvs = false, - ["."] = false, - }, - }) - end, + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + requires = { + "copilotlsp-nvim/copilot-lsp", -- (optional) for NES functionality + }, + config = function() + require("copilot").setup({ + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + txt = false, + svn = false, + cvs = false, + ["."] = false, + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/copilotchat.lua b/.config/nvim/lua/plugins/copilotchat.lua @@ -1,45 +1,45 @@ return { - "CopilotC-Nvim/CopilotChat.nvim", - dependencies = { - "zbirenbaum/copilot.lua", - "nvim-lua/plenary.nvim", - }, - event = "VeryLazy", - build = "make tiktoken", - opts = { - model = "claude-sonnet-4.5", - window = { - layout = 'horizontal', - width = 1, - height = 0.3, - title = '🤖 AI Assistant', - }, - headers = { - user = '👤 You', - assistant = '🤖 Copilot', - tool = '🔧 Tool', - }, - suggestion = { enabled = true }, - separator = '━━', - auto_fold = true, - }, - config = function(_, opts) - require("CopilotChat").setup(opts) - end, - keys = { - { - "<leader>ao", - function() - vim.cmd("CopilotChatOpen") - end, - desc = "CopilotChat - Activate", - }, - { - "<leader>ar", - function() - vim.cmd("CopilotChatReset") - end, - desc = "CopilotChat - Reset", - }, - }, + "CopilotC-Nvim/CopilotChat.nvim", + dependencies = { + "zbirenbaum/copilot.lua", + "nvim-lua/plenary.nvim", + }, + event = "VeryLazy", + build = "make tiktoken", + opts = { + model = "claude-sonnet-4.5", + window = { + layout = 'horizontal', + width = 1, + height = 0.3, + title = '🤖 AI Assistant', + }, + headers = { + user = '👤 You', + assistant = '🤖 Copilot', + tool = '🔧 Tool', + }, + suggestion = { enabled = true }, + separator = '━━', + auto_fold = true, + }, + config = function(_, opts) + require("CopilotChat").setup(opts) + end, + keys = { + { + "<leader>ao", + function() + vim.cmd("CopilotChatOpen") + end, + desc = "CopilotChat - Activate", + }, + { + "<leader>ar", + function() + vim.cmd("CopilotChatReset") + end, + desc = "CopilotChat - Reset", + }, + }, } diff --git a/.config/nvim/lua/plugins/floaterm.lua b/.config/nvim/lua/plugins/floaterm.lua @@ -1,8 +1,8 @@ return { - "voldikss/vim-floaterm", - config = function() - vim.keymap.set('n', "<leader>ft", ":FloatermNew --name=myfloat --height=0.6 --width=0.7 --autoclose=2 zsh<CR> ") - vim.keymap.set('n', "t", ":FloatermToggle myfloat<CR>") - vim.keymap.set('t', "<C-t>", "<C-\\><C-n>:q<CR>") - end + "voldikss/vim-floaterm", + config = function() + vim.keymap.set('n', "<leader>ft", ":FloatermNew --name=myfloat --height=0.6 --width=0.7 --autoclose=2 zsh<CR> ") + vim.keymap.set('n', "t", ":FloatermToggle myfloat<CR>") + vim.keymap.set('t', "<C-t>", "<C-\\><C-n>:q<CR>") + end } diff --git a/.config/nvim/lua/plugins/hints.lua b/.config/nvim/lua/plugins/hints.lua @@ -2,45 +2,45 @@ return { "chrisgrieser/nvim-lsp-endhints", event = "VeryLazy", config = function () - local endhints = require("lsp-endhints") - endhints.enable() - endhints.setup { - icons = { - type = "-> ", - parameter = "<= ", - offspec = "<= ", -- hint kind not defined in official LSP spec - unknown = "? ", -- hint kind is nil - }, - label = { - truncateAtChars = 50, - padding = 1, - marginLeft = 0, - sameKindSeparator = ", ", - }, - extmark = { - priority = 50, - }, - autoEnableHints = true, - } + local endhints = require("lsp-endhints") + endhints.enable() + endhints.setup { + icons = { + type = "-> ", + parameter = "<= ", + offspec = "<= ", -- hint kind not defined in official LSP spec + unknown = "? ", -- hint kind is nil + }, + label = { + truncateAtChars = 50, + padding = 1, + marginLeft = 0, + sameKindSeparator = ", ", + }, + extmark = { + priority = 50, + }, + autoEnableHints = true, + } map = vim.keymap.set - map('n', '<leader>h', function(bufnr) - if vim.lsp.inlay_hint.is_enabled() then - print("Inlay Hitnts OFF") - else - print("Inlay Hitnts ON") - end - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), bufnr) - end, { silent = true, noremap = true }) + map('n', '<leader>h', function(bufnr) + if vim.lsp.inlay_hint.is_enabled() then + print("Inlay Hitnts OFF") + else + print("Inlay Hitnts ON") + end + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), bufnr) + end, { silent = true, noremap = true }) - map('n', '<leader>d', function() - if vim.diagnostic.is_enabled() then - print("Diagnostics OFF") - else - print("Diagnostics ON") - end - vim.diagnostic.enable(not vim.diagnostic.is_enabled()) - end, { silent = true, noremap = true }) + map('n', '<leader>d', function() + if vim.diagnostic.is_enabled() then + print("Diagnostics OFF") + else + print("Diagnostics ON") + end + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) + end, { silent = true, noremap = true }) end } diff --git a/.config/nvim/lua/plugins/ibl.lua b/.config/nvim/lua/plugins/ibl.lua @@ -1,16 +1,14 @@ return { - { - 'lukas-reineke/indent-blankline.nvim', - main = 'ibl', - event = 'VeryLazy', - opts = { - indent = { - char = '│' - }, - scope = { - show_start = false, - show_end = false, - }, - }, + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + event = 'VeryLazy', + opts = { + indent = { + char = '│' }, + scope = { + show_start = false, + show_end = false, + }, + }, } diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua @@ -1,88 +1,101 @@ return { - "neovim/nvim-lspconfig", - dependencies = { - "stevearc/conform.nvim", - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "j-hui/fidget.nvim", + "neovim/nvim-lspconfig", + dependencies = { + "stevearc/conform.nvim", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "j-hui/fidget.nvim", "hrsh7th/nvim-cmp", - "hrsh7th/cmp-nvim-lsp", - }, - config = function () + "hrsh7th/cmp-nvim-lsp", + }, + config = function () map = vim.keymap.set - vim.opt.signcolumn = 'yes' - vim.lsp.inlay_hint.enable(true) + vim.opt.signcolumn = 'yes' + vim.lsp.inlay_hint.enable(true) - local lspconfig_defaults = require('lspconfig').util.default_config - require("conform").setup({ - formatters_by_ft = { } - }) + local lspconfig_defaults = require('lspconfig').util.default_config + require("conform").setup({ + formatters_by_ft = { + javascript = { "prettier" }, + javascriptreact = { "prettier" }, + typescript = { "prettier" }, + typescriptreact = { "prettier" }, + vue = { "prettier" }, + css = { "prettier" }, + scss = { "prettier" }, + less = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + jsonc = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + svelte = { "prettier" }, + astro = { "prettier" }, + }, + }) - local cmp = require("cmp") - local cmp_lsp = require("cmp_nvim_lsp") - local capabilities = vim.tbl_deep_extend( - 'force', - lspconfig_defaults.capabilities, - cmp_lsp.default_capabilities() - ) - lspconfig_defaults.capabilities = capabilities + local cmp = require("cmp") + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + 'force', + lspconfig_defaults.capabilities, + cmp_lsp.default_capabilities() + ) + lspconfig_defaults.capabilities = capabilities - vim.api.nvim_create_autocmd('LspAttach', { - desc = 'LSP actions', - callback = function(event) - local opts = {buffer = event.buf} + vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = {buffer = event.buf} - map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts) - map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) - map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts) - map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts) - map('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts) - map('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts) - map('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts) - map('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts) - map({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts) - map('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts) - end, - }) + map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts) + map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) + map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts) + map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts) + map('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts) + map('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts) + map('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts) + map('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts) + map({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts) + map('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts) + end, + }) - require("fidget").setup({}) - require("mason").setup() - require("mason-lspconfig").setup({ - ensure_installed = { - "lua_ls", - "clangd", - "julials", - "nginx_language_server", - "pyright", - "eslint", - "tailwindcss", - "vtsls", - "nil_ls", - }, - handlers = { - function(server_name) - require("lspconfig")[server_name].setup { - capabilities = capabilities - } - end, + require("fidget").setup({}) + require("mason").setup() + require("mason-lspconfig").setup({ + handlers = { + function(server_name) + require("lspconfig")[server_name].setup { + capabilities = capabilities + } + end, ['eslint'] = function() local lspconfig = require("lspconfig") lspconfig.eslint.setup({ cmd = { 'vscode-eslint-language-server', '--stdio' }, - filetypes = { - 'javascript', - 'javascriptreact', - 'javascript.jsx', - 'typescript', - 'typescriptreact', - 'typescript.tsx', - 'vue', - 'svelte', - 'astro', - 'htmlangular', + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + 'vue', + 'svelte', + 'astro', + 'htmlangular', + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr()') + end, + capabilities = capabilities, + -- ESLint will automatically look for config files in the project + settings = { + workingDirectory = { mode = "auto" }, }, - workspace_required = true, }); end, ['bashls'] = function() @@ -90,11 +103,11 @@ return { lspconfig.bashls.setup { cmd = {'bash-language-server', 'start'}, filetypes = {'zsh', 'bash', 'sh'}, - capabilities = capabilities + capabilities = capabilities } end, ['tailwindcss'] = function() - local lspconfig = require("lspconfig") + local lspconfig = require("lspconfig") lspconfig.tailwindcss.setup({ includeLangauges = { javascript = 'js', @@ -105,9 +118,9 @@ return { } }) end, - ["lua_ls"] = function() - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup({ + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup({ on_init = function(client) if client.workspace_folders then local path = client.workspace_folders[1].name @@ -129,20 +142,17 @@ return { }, workspace = { checkThirdParty = false, - library = { - vim.env.VIMRUNTIME - } - } + library = vim.api.nvim_get_runtime_file("", true) }) end, settings = { Lua = {} } - }) - end, - } - }) - end + }) + end, + } + }) + end } diff --git a/.config/nvim/lua/plugins/luasnip.lua b/.config/nvim/lua/plugins/luasnip.lua @@ -1,18 +1,18 @@ return { - "L3MON4D3/LuaSnip", - version = "v2.3.0", - build = "make install_jsregexp", - config = function() - local ls = require("luasnip") - ls.config.setup({ - enable_autosnippets = true, - store_selection_keys = "<c-s>", - }) - for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do - loadfile(ft_path)() - end + "L3MON4D3/LuaSnip", + version = "v2.3.0", + build = "make install_jsregexp", + config = function() + local ls = require("luasnip") + ls.config.setup({ + enable_autosnippets = true, + store_selection_keys = "<c-s>", + }) + for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do + loadfile(ft_path)() + end - end + end } diff --git a/.config/nvim/lua/plugins/rustacean.lua b/.config/nvim/lua/plugins/rustacean.lua @@ -1,100 +1,100 @@ return { - 'mrcjkb/rustaceanvim', - version = '^8', - lazy = false, - dependencies = { - "mason-org/mason-registry", - }, - config = function() - vim.g.rustaceanvim = { - tools = { - float_win_config = { - border = "rounded", - } - }, - server = { - on_attach = function(client, bufnr) - vim.keymap.set( - "n", - "<leader>a", - function() - vim.cmd.RustLsp('codeAction') - end, - { silent = true, buffer = bufnr } - ) - vim.keymap.set( - "n", - "K", - function() - vim.cmd.RustLsp({'hover', 'actions'}) - end, - { silent = true, buffer = bufnr } - ) - end, - cmd = { 'rust-analyzer' }, - default_settings = { - ['rust-analyzer'] = { - diagnostics = { - enable = true; - }, - cargo = { + 'mrcjkb/rustaceanvim', + version = '^8', + lazy = false, + dependencies = { + "mason-org/mason-registry", + }, + config = function() + vim.g.rustaceanvim = { + tools = { + float_win_config = { + border = "rounded", + } + }, + server = { + on_attach = function(client, bufnr) + vim.keymap.set( + "n", + "<leader>a", + function() + vim.cmd.RustLsp('codeAction') + end, + { silent = true, buffer = bufnr } + ) + vim.keymap.set( + "n", + "K", + function() + vim.cmd.RustLsp({'hover', 'actions'}) + end, + { silent = true, buffer = bufnr } + ) + end, + cmd = { 'rust-analyzer' }, + default_settings = { + ['rust-analyzer'] = { + diagnostics = { + enable = true; + }, + cargo = { loadOutDirsFromCheck = true, - allFeatures = true, - }, - }, - }, - settings = { - ['rust-analyzer'] = { - inlayHints = { - maxLength = 50, - renderColons = true, - bindingModeHints = { - enable = false, - }, - chainingHints = { - enable = true, - }, - closingBraceHints = { - enable = true, - minLines = 50, - }, - closureCaptureTypeHints = { - enable = true, - }, - closureReturnTypeHints = { - enable = true, - }, - lifetimeElisionHints = { - enable = true, - useParameterNames = false, - }, - genericParameterHints = { - const = { - enable = true, - }, - lifetime = { - enable = true, - }, - type = { - enable = true, - }, - }, - parameterHints = { - enable = true, - }, - reborrowHints = { - enable = "never", - }, - typeHints = { - enable = true, - hideClosureInitialization = false, - hideNamedConstructor = false, - }, - }, - }, - }, - }, - } + allFeatures = true, + }, + }, + }, + settings = { + ['rust-analyzer'] = { + inlayHints = { + maxLength = 50, + renderColons = true, + bindingModeHints = { + enable = false, + }, + chainingHints = { + enable = true, + }, + closingBraceHints = { + enable = true, + minLines = 50, + }, + closureCaptureTypeHints = { + enable = true, + }, + closureReturnTypeHints = { + enable = true, + }, + lifetimeElisionHints = { + enable = true, + useParameterNames = false, + }, + genericParameterHints = { + const = { + enable = true, + }, + lifetime = { + enable = true, + }, + type = { + enable = true, + }, + }, + parameterHints = { + enable = true, + }, + reborrowHints = { + enable = "never", + }, + typeHints = { + enable = true, + hideClosureInitialization = false, + hideNamedConstructor = false, + }, + }, + }, + }, + }, + } - end + end } diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua @@ -1,37 +1,37 @@ return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function () - require("nvim-treesitter").setup({ --- ensure_installed = "none", - auto_install = true, - indent = { - enable = true - }, - highlight = { - enable = true, - disable = function(lang, buf) - local langs = { "latex", "html" , "markdown", "text"} - for i=1,#langs do - if lang == langs[i] then - return true - end - end + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function () + require("nvim-treesitter").setup({ +-- ensure_installed = "none", + auto_install = true, + indent = { + enable = true + }, + highlight = { + enable = true, + disable = function(lang, buf) + local langs = { "latex", "html" , "markdown", "text"} + for i=1,#langs do + if lang == langs[i] then + return true + end + end - 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 - vim.notify( - "File larger than 100KB treesitter disabled for performance", - vim.log.levels.WARN, - {title = "Treesitter"} - ) - return true - end - end, - additional_vim_regex_highlighting=false, - }, - }) - end + 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 + vim.notify( + "File larger than 100KB treesitter disabled for performance", + vim.log.levels.WARN, + {title = "Treesitter"} + ) + return true + end + end, + additional_vim_regex_highlighting=false, + }, + }) + end } diff --git a/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua @@ -1,6 +1,6 @@ return { - "mbbill/undotree", - config = function() - vim.keymap.set('n', '<leader>u', ":UndotreeToggle<CR>") - end + "mbbill/undotree", + config = function() + vim.keymap.set('n', '<leader>u', ":UndotreeToggle<CR>") + end } diff --git a/.config/nvim/lua/plugins/vimtex.lua b/.config/nvim/lua/plugins/vimtex.lua @@ -1,29 +1,29 @@ return { - "lervag/vimtex", - lazy = false, - init = function() - vim.opt.conceallevel = 2 - vim.g.vimtex_view_method = "zathura" - vim.g.latex_to_unicode_auto = 1 - vim.g.tex_flavour = "latex" - vim.g.vimtex_compiler_latexmk = { - executable = "latexmk", - options = { - "-synctex=0", - "-verbose", - "-file-line-error", - "-interaction=nonstopmode", - "-shell-escape", - "-synctex=1" - }, - out_dir = "build", - aux_dir = "build" - } - vim.g.vimtex_quickfix_mode = 0 - vim.g.tex_conceal = "abdmg" + "lervag/vimtex", + lazy = false, + init = function() + vim.opt.conceallevel = 2 + vim.g.vimtex_view_method = "zathura" + vim.g.latex_to_unicode_auto = 1 + vim.g.tex_flavour = "latex" + vim.g.vimtex_compiler_latexmk = { + executable = "latexmk", + options = { + "-synctex=0", + "-verbose", + "-file-line-error", + "-interaction=nonstopmode", + "-shell-escape", + "-synctex=1" + }, + out_dir = "build", + aux_dir = "build" + } + vim.g.vimtex_quickfix_mode = 0 + vim.g.tex_conceal = "abdmg" - vim.keymap.set('n', '<leader>tp', "<Esc>:w<CR>:VimtexCompile<CR>") - vim.keymap.set('n', '<leader>te', "<Esc>:w<CR>:VimtexErrors<CR>") + vim.keymap.set('n', '<leader>tp', "<Esc>:w<CR>:VimtexCompile<CR>") + vim.keymap.set('n', '<leader>te', "<Esc>:w<CR>:VimtexErrors<CR>") - end + end } diff --git a/.config/nvim/lua/snippets/basic.lua b/.config/nvim/lua/snippets/basic.lua @@ -6,13 +6,13 @@ local date = function() return {os.date('%Y-%m-%d')} end local func = ls.function_node ls.add_snippets(nil, { - all = { - s({ - trig = "date", - namr = "Date", - dscr = "Date in the form of YYYY-MM-DD", - }, { - func(date, {}), - }), - }, + all = { + s({ + trig = "date", + namr = "Date", + dscr = "Date in the form of YYYY-MM-DD", + }, { + func(date, {}), + }), + }, }) diff --git a/.config/nvim/lua/snippets/rust.lua b/.config/nvim/lua/snippets/rust.lua @@ -4,15 +4,16 @@ local i = ls.insert_node local fmt = require("luasnip.extras.fmt").fmt ls.add_snippets("rust", { - s( - "match", - fmt([[ - match {} {{ - {} => {{ - {} - }} - {} => {{ - {} - }} - }};]], { i(1), i(2), i(3), i(4), i(5) })), + s( + "match", + fmt([[ + match {} {{ + {} => {{ + {} + }} + {} => {{ + {} + }} + }};]], { i(1), i(2), i(3), i(4), i(5) } + )), })