diff --git a/init.lua b/init.lua index 2da5915..adfd8e4 100644 --- a/init.lua +++ b/init.lua @@ -1,11 +1,9 @@ -- AstroNvim Configuration Table -- All configuration changes should go inside of the table below - -- You can think of a Lua "table" as a dictionary like data structure the -- normal format is "key = value". These also handle array like data structures -- where a value with no key simply has an implicit numeric key local config = { - -- Configure AstroNvim updates updater = { remote = "origin", -- remote to use @@ -17,17 +15,15 @@ local config = { skip_prompts = false, -- skip prompts about breaking changes show_changelog = true, -- show the changelog after performing an update auto_reload = false, -- automatically reload and sync packer after a successful update - auto_quit = false, -- automatically quit the current session after a successful update + auto_quit = false -- automatically quit the current session after a successful update -- remotes = { -- easily add new remotes to track -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork -- }, }, - -- Set colorscheme to use colorscheme = "default_theme", - -- Add highlight groups in any theme highlights = { -- init = { -- this table overrides highlights in all themes @@ -37,7 +33,6 @@ local config = { -- Normal = { bg = "#000000" }, -- }, }, - -- set vim options here (vim.. = value) options = { opt = { @@ -46,7 +41,7 @@ local config = { number = true, -- sets vim.opt.number spell = false, -- sets vim.opt.spell signcolumn = "auto", -- sets vim.opt.signcolumn to auto - wrap = false, -- sets vim.opt.wrap + wrap = false -- sets vim.opt.wrap }, g = { mapleader = " ", -- sets vim.g.mapleader @@ -57,8 +52,8 @@ local config = { status_diagnostics_enabled = true, -- enable diagnostics in statusline icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) ui_notifications_enabled = true, -- disable notifications when toggling UI elements - heirline_bufferline = false, -- enable new heirline based bufferline (requires :PackerSync after changing) - }, + heirline_bufferline = false -- enable new heirline based bufferline (requires :PackerSync after changing) + } }, -- If you need more control, you can use the function()...end notation -- options = function(local_vim) @@ -82,18 +77,14 @@ local config = { " ████  ██ ██  ██ ██ ████  ████", " ██ ██  ██ ██  ██ ██ ██ ████ ██", " ██  ██ ██  ██  ██  ██ ██  ██  ██", - " ██   ████   ████   ██ ██      ██", + " ██   ████   ████   ██ ██      ██" }, - -- Default theme configuration default_theme = { -- Modify the color palette for the default theme - colors = { - fg = "#abb2bf", - bg = "#1e222a", - }, + colors = { fg = "#abb2bf", bg = "#1e222a" }, highlights = function(hl) -- or a function that returns a new table of colors to set - local C = require "default_theme.colors" + local C = require("default_theme.colors") hl.Normal = { fg = C.fg, bg = C.bg } @@ -125,16 +116,11 @@ local config = { telescope = true, treesitter = true, vimwiki = false, - ["which-key"] = true, - }, + ["which-key"] = true + } }, - -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on - diagnostics = { - virtual_text = true, - underline = true, - }, - + diagnostics = { virtual_text = true, underline = true }, -- Extend LSP configuration lsp = { -- enable servers that you already have installed without mason @@ -150,12 +136,12 @@ local config = { }, ignore_filetypes = { -- disable format on save for specified filetypes -- "python", - }, + } }, disabled = { -- disable formatting capabilities for the listed language servers -- "sumneko_lua", }, - timeout_ms = 1000, -- default format timeout + timeout_ms = 1000 -- default format timeout -- filter = function(client) -- fully override the default formatting function -- return true -- end @@ -164,7 +150,7 @@ local config = { mappings = { n = { -- ["lf"] = false -- disable formatting keymap - }, + } }, -- add to the global LSP on_attach function -- on_attach = function(client, bufnr) @@ -189,9 +175,8 @@ local config = { -- }, -- }, -- }, - }, + } }, - -- Mapping data with "desc" stored directly by vim.keymap.set(). -- -- Please use this mappings table to set keyboard mapping since this is the @@ -203,18 +188,23 @@ local config = { -- second key is the lefthand side of the map -- mappings seen under group name "Buffer" ["bb"] = { "tabnew", desc = "New tab" }, - ["bc"] = { "BufferLinePickClose", desc = "Pick to close" }, + ["bc"] = { + "BufferLinePickClose", + desc = "Pick to close" + }, ["bj"] = { "BufferLinePick", desc = "Pick to jump" }, - ["bt"] = { "BufferLineSortByTabs", desc = "Sort by tabs" }, + ["bt"] = { + "BufferLineSortByTabs", + desc = "Sort by tabs" + } -- quick save -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command }, t = { -- setting a mapping to false will disable it -- [""] = false, - }, + } }, - -- Configure plugins plugins = { init = { @@ -268,9 +258,8 @@ local config = { }, ["mason-nvim-dap"] = { -- overrides `require("mason-nvim-dap").setup(...)` -- ensure_installed = { "python" }, - }, + } }, - -- LuaSnip Options luasnip = { -- Extend filetypes @@ -280,10 +269,9 @@ local config = { -- Configure luasnip loaders (vscode, lua, and/or snipmate) vscode = { -- Add paths for including more VS Code style snippets in luasnip - paths = {}, - }, + paths = {} + } }, - -- CMP Source Priorities -- modify here the priorities of default cmp sources -- higher value == higher priority @@ -295,12 +283,11 @@ local config = { nvim_lsp = 1000, luasnip = 750, buffer = 500, - path = 250, - }, + path = 250 + } }, - -- Customize Heirline options - heirline = { + -- heirline = { -- -- Customize different separators between sections -- separators = { -- tab = { "", "" }, @@ -323,8 +310,7 @@ local config = { -- statusline = true, -- Filetype icon in the statusline -- }, -- }, - }, - + -- }, -- Modify which-key registration (Use this with mappings table in the above.) ["which-key"] = { -- Add bindings which show up as group name @@ -335,12 +321,11 @@ local config = { [""] = { -- third key is the key to bring up next level and its displayed -- group name in which-key top level menu - ["b"] = { name = "Buffer" }, - }, - }, - }, + ["b"] = { name = "Buffer" } + } + } + } }, - -- This function is run last and is a good place to configuring -- augroups/autocommands and custom filetypes also this just pure lua so -- anything that doesn't fit in the normal config locations above can go here @@ -357,7 +342,7 @@ local config = { -- ["~/%.config/foo/.*"] = "fooscript", -- }, -- } - end, + end } return config diff --git a/lsp/on_attach.lua b/lsp/on_attach.lua index bb471c5..38fcc2b 100644 --- a/lsp/on_attach.lua +++ b/lsp/on_attach.lua @@ -3,7 +3,9 @@ return function(client, bufnr) local inlayhints_avail, inlayhints = pcall(require, "lsp-inlayhints") if inlayhints_avail then inlayhints.on_attach(client, bufnr) - vim.keymap.set("n", "uH", function() inlayhints.toggle() end, { desc = "Toggle inlay hints" }) + vim.keymap.set("n", "uH", + function() inlayhints.toggle() end, + { desc = "Toggle inlay hints" }) end end end diff --git a/mappings.lua b/mappings.lua index 940d167..e1121c2 100644 --- a/mappings.lua +++ b/mappings.lua @@ -17,8 +17,8 @@ return { -- View treesitter highlight groups ["k"] = { ":TSHighlightCapturesUnderCursor", desc = "View Highlight Group" }, -- Easy splits - ["\\"] = { "split", desc = "Horizontal split" }, - ["|"] = { "vsplit", desc = "Vertical split" }, + -- ["\\"] = { "split", desc = "Horizontal split" }, + -- ["|"] = { "vsplit", desc = "Vertical split" }, -- Search highlight groups ["sg"] = { "Telescope highlights", desc = "Highlight groups" }, -- quick save diff --git a/options.lua b/options.lua index 5b9ef25..828003b 100644 --- a/options.lua +++ b/options.lua @@ -13,16 +13,24 @@ return { foldmethod = "expr", linebreak = true, -- linebreak soft wrap at words list = true, -- show whitespace characters - listchars = { tab = " ", extends = "⟩", precedes = "⟨", trail = "·", eol = "﬋" }, - showbreak = "﬌ ", + listchars = { + tab = " ", + extends = "⟩", + precedes = "⟨", + trail = "·", + eol = "" + }, + showbreak = "﬌ " }, g = { mapleader = " ", -- sets vim.g.mapleader - autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled) + -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled) + autoformat_enabled = true, cmp_enabled = true, -- enable completion at start autopairs_enabled = true, -- enable autopairs at start diagnostics_enabled = true, -- enable diagnostics at start status_diagnostics_enabled = true, -- enable diagnostics in statusline - icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) - }, + -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) + icons_enabled = true + } } diff --git a/plugins/init.lua b/plugins/init.lua index 3911b69..3ae8c2b 100644 --- a/plugins/init.lua +++ b/plugins/init.lua @@ -1,7 +1,7 @@ return { -- You can disable default plugins as follows: - ["goolord/alpha-nvim"] = { disable = true }, - ["max397574/better-escape.nvim"] = { disable = true }, + ["goolord/alpha-nvim"] = { disable = false }, + ["max397574/better-escape.nvim"] = { disable = false }, -- You can also add new plugins here as well: ["wakatime/vim-wakatime"] = { opt = true, diff --git a/plugins/mason-lspconfig.lua b/plugins/mason-lspconfig.lua index 329952e..69e4340 100644 --- a/plugins/mason-lspconfig.lua +++ b/plugins/mason-lspconfig.lua @@ -2,15 +2,32 @@ return { automatic_installation = true, ensure_installed = { + "ansiblels", + "bashls", "clangd", + "codeqlls", "cssls", + "diagnosticls", + "docker_compose_language_service", + "dockerls", + "emmet_ls", + "eslint", + "graphql", "html", - "marksman", + "intelephense", "jsonls", + "lua_ls", + "marksman", + "phpactor", + "psalm", "pyright", + "spectral", + "stylelint_lsp", "sqls", - "sumneko_lua", + "tailwindcss", + "terraformls", "tsserver", - "yamlls", - }, + "vuels", + "yamlls" + } } diff --git a/plugins/null-ls.lua b/plugins/null-ls.lua index e91430c..312a16a 100644 --- a/plugins/null-ls.lua +++ b/plugins/null-ls.lua @@ -1,20 +1,75 @@ return function(config) local null_ls = require "null-ls" config.sources = { + null_ls.builtins.code_actions.eslint, + null_ls.builtins.code_actions.shellcheck, + null_ls.builtins.code_actions.xo, - null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.prettier, + null_ls.builtins.diagnostics.actionlint, + null_ls.builtins.diagnostics.ansiblelint, + null_ls.builtins.diagnostics.dotenv_linter, + null_ls.builtins.diagnostics.editorconfig_checker, + null_ls.builtins.diagnostics.eslint, + null_ls.builtins.diagnostics.flake8, + null_ls.builtins.diagnostics.jsonlint, + null_ls.builtins.diagnostics.luacheck, + null_ls.builtins.diagnostics.markdownlint, + null_ls.builtins.diagnostics.mypy, + null_ls.builtins.diagnostics.php, + null_ls.builtins.diagnostics.phpcs, + null_ls.builtins.diagnostics.phpmd, + null_ls.builtins.diagnostics.phpstan, + null_ls.builtins.diagnostics.psalm, + null_ls.builtins.diagnostics.pycodestyle, + null_ls.builtins.diagnostics.pydocstyle, + null_ls.builtins.diagnostics.pylint, + null_ls.builtins.diagnostics.semgrep, + null_ls.builtins.diagnostics.shellcheck, + null_ls.builtins.diagnostics.standardjs, + null_ls.builtins.diagnostics.stylelint, + null_ls.builtins.diagnostics.tfsec, + null_ls.builtins.diagnostics.trail_space, + null_ls.builtins.diagnostics.tsc, + null_ls.builtins.diagnostics.vacuum, + null_ls.builtins.diagnostics.vint, + null_ls.builtins.diagnostics.vulture, + null_ls.builtins.diagnostics.xo, + null_ls.builtins.diagnostics.yamllint, + null_ls.builtins.diagnostics.zsh, + + null_ls.builtins.formatting.autoflake, + null_ls.builtins.formatting.autopep8, null_ls.builtins.formatting.black, - null_ls.builtins.formatting.isort, + null_ls.builtins.formatting.blade_formatter, + null_ls.builtins.formatting.cbfmt, null_ls.builtins.formatting.clang_format, + null_ls.builtins.formatting.eslint, + null_ls.builtins.formatting.fixjson, + null_ls.builtins.formatting.isort, + null_ls.builtins.formatting.isort, + null_ls.builtins.formatting.jq, + null_ls.builtins.formatting.markdownlint, + null_ls.builtins.formatting.nginx_beautifier, + null_ls.builtins.formatting.pg_format, + null_ls.builtins.formatting.phpcsfixer, + null_ls.builtins.formatting.prettier_eslint, + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.puppet_lint, + null_ls.builtins.formatting.rome, null_ls.builtins.formatting.rustfmt, null_ls.builtins.formatting.shfmt.with { - args = { "-i", "2" }, + args = { "-i", "1", "-bn", "-ci", "-sr", "-kb", "-fn" } }, - null_ls.builtins.diagnostics.luacheck, - null_ls.builtins.diagnostics.flake8, - -- null_ls.builtins.diagnostics.pylint, - null_ls.builtins.diagnostics.mypy, + null_ls.builtins.formatting.stylelint, + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.terrafmt, + null_ls.builtins.formatting.terraform_fmt, + null_ls.builtins.formatting.tidy, + null_ls.builtins.formatting.yamlfmt, + + null_ls.builtins.hover.dictionary, + null_ls.builtins.hover.printenv, } return config end diff --git a/plugins/treesitter.lua b/plugins/treesitter.lua index 43663eb..8f07555 100644 --- a/plugins/treesitter.lua +++ b/plugins/treesitter.lua @@ -1,4 +1,10 @@ return { -- Automatically install missing parsers when entering buffer auto_install = true, + ensure_installed = { + "c", "help", "bash", "comment", "diff", "dockerfile", "html", "json", + "json5", "javascript", "latex", "markdown", "php", "phpdoc", "python", + "scss", "terraform", "todotxt", "toml", "typescript", "vim", "vue", + "yaml" + } } diff --git a/which-key/register.lua b/which-key/register.lua index 532c8a8..4376d60 100644 --- a/which-key/register.lua +++ b/which-key/register.lua @@ -2,13 +2,13 @@ -- Add bindings which show up as group name return { -- first key is the mode, n == normal mode - n = { - -- second key is the prefix, prefixes - [""] = { - -- third key is the key to bring up next level and its displayed - -- group name in which-key top level menu - ["n"] = { "tabnew", "New Buffer" }, - ["z"] = { "ZenMode", "Zen Mode" }, - }, - }, + -- n = { + -- second key is the prefix, prefixes + -- [""] = { + -- third key is the key to bring up next level and its displayed + -- group name in which-key top level menu + -- ["n"] = { "tabnew", "New Buffer" }, + -- ["z"] = { "ZenMode", "Zen Mode" }, + -- }, + -- }, }