diff --git a/README.md b/README.md index 71d48de..4488bde 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AstroNvim Template -**NOTE:** This is for AstroNvim v5+ +**NOTE:** This is for AstroNvim v6+ A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim) diff --git a/init.lua b/init.lua index 2ce1cdd..424e48d 100644 --- a/init.lua +++ b/init.lua @@ -1,10 +1,18 @@ -- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution -- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk. local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + local result = vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + if vim.v.shell_error ~= 0 then + -- stylua: ignore + vim.api.nvim_echo({ { ("Error cloning lazy.nvim:\n%s\n"):format(result), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() + end end + vim.opt.rtp:prepend(lazypath) -- validate that lazy is available diff --git a/lua/community.lua b/lua/community.lua index 9e47abf..a9128bb 100644 --- a/lua/community.lua +++ b/lua/community.lua @@ -28,13 +28,12 @@ return { -- { import = "astrocommunity.pack.html-css" }, -- { import = "astrocommunity.pack.angular" }, - -- { import = "astrocommunity.pack.ansible" }, - -- { import = "astrocommunity.pack.terraform" }, - -- { import = "astrocommunity.pack.docker" }, - -- { import = "astrocommunity.pack.helm" }, + { import = "astrocommunity.pack.ansible" }, + { import = "astrocommunity.pack.terraform" }, + { import = "astrocommunity.pack.docker" }, + { import = "astrocommunity.pack.helm" }, -- { import = "astrocommunity.pack.rainbow-delimiter-indent-blankline" }, - { import = "astrocommunity.indent.indent-rainbowline" }, -- Recipes @@ -44,39 +43,24 @@ return { { import = "astrocommunity.recipes.cache-colorscheme" }, { import = "astrocommunity.recipes.neo-tree-dark" }, { import = "astrocommunity.recipes.neovide" }, - -- { import = "astrocommunity.recipes.ai" }, + { import = "astrocommunity.recipes.ai" }, -- Completion { import = "astrocommunity.completion.blink-cmp-git" }, { import = "astrocommunity.completion.blink-cmp-emoji" }, - -- { import = "astrocommunity.completion.cmp-nerdfont" }, - { import = "astrocommunity.completion.minuet-ai-nvim" }, + { import = "astrocommunity.completion.cmp-nerdfont" }, + { import = "astrocommunity.completion.copilot-lua-cmp" }, -- { import = "astrocommunity.completion.cmp-spell" }, - -- { import = "astrocommunity.completion.copilot-lua-cmp" }, + + -- AI + { import = "astrocommunity.ai.copilotchat-nvim" }, + -- { import = "astrocommunity.completion.minuet-ai-nvim" }, -- Telescope { import = "astrocommunity.terminal-integration.toggleterm-manager-nvim" }, -- A Telescope extension to manage Toggleterm's terminals in NeoVim -- { import = "astrocommunity.file-explorer.telescope-file-browser-nvim" }, - -- Individual plugins (misc) - - { import = "astrocommunity.workflow.hardtime-nvim" }, -- Display hints to get rid of bad habits - { import = "astrocommunity.diagnostics.trouble-nvim" }, - { import = "astrocommunity.editing-support.nvim-devdocs" }, - { import = "astrocommunity.git.diffview-nvim" }, - { import = "astrocommunity.markdown-and-latex.render-markdown-nvim" }, - -- { import = "astrocommunity.markdown-and-latex.markview-nvim" }, - { import = "astrocommunity.motion.marks-nvim" }, -- Display marks in the sign column - { import = "astrocommunity.programming-language-support.kulala-nvim" }, -- A minimal HTTP-client interface for Neovim - - -- Disabled - - -- { import = "astrocommunity.bars-and-lines.smartcolumn-nvim" }, -- display a column when text width exceed defined limit - -- { import = "astrocommunity.editing-support.chatgpt-nvim" }, - -- { import = "astrocommunity.programming-language-support.rest-nvim" }, - -- { import = "astrocommunity.project.project-nvim" }, - - -- Individual plugins (colorschemes) + -- Colorschemes { import = "astrocommunity.colorscheme.vscode-nvim" }, { import = "astrocommunity.colorscheme.github-nvim-theme" }, { import = "astrocommunity.colorscheme.neosolarized-nvim" }, @@ -87,6 +71,25 @@ return { { import = "astrocommunity.colorscheme.tokyonight-nvim" }, { import = "astrocommunity.colorscheme.onedarkpro-nvim" }, + -- Individual plugins (misc) + + { import = "astrocommunity.diagnostics.trouble-nvim" }, + { import = "astrocommunity.motion.marks-nvim" }, -- Display marks in the sign column + { import = "astrocommunity.git.diffview-nvim" }, + { import = "astrocommunity.markdown-and-latex.render-markdown-nvim" }, + -- { import = "astrocommunity.markdown-and-latex.markview-nvim" }, + { import = "astrocommunity.programming-language-support.kulala-nvim" }, -- A minimal HTTP-client interface for Neovim + { import = "astrocommunity.indent.indent-rainbowline" }, + { import = "astrocommunity.editing-support.nvim-devdocs" }, + -- { import = "astrocommunity.workflow.hardtime-nvim" }, -- Display hints to get rid of bad habits + + -- Disabled + + -- { import = "astrocommunity.bars-and-lines.smartcolumn-nvim" }, -- display a column when text width exceed defined limit + -- { import = "astrocommunity.editing-support.chatgpt-nvim" }, + -- { import = "astrocommunity.programming-language-support.rest-nvim" }, + -- { import = "astrocommunity.project.project-nvim" }, + -- Individual plugins customization -- { -- "nvim-treesitter/nvim-treesitter", diff --git a/lua/lazy_setup.lua b/lua/lazy_setup.lua index 159a9a2..313afe2 100644 --- a/lua/lazy_setup.lua +++ b/lua/lazy_setup.lua @@ -1,7 +1,7 @@ require("lazy").setup({ { "AstroNvim/AstroNvim", - version = "^5", -- Remove version tracking to elect for nightly AstroNvim + version = "^6", -- Remove version tracking to elect for nightly AstroNvim import = "astronvim.plugins", opts = { -- AstroNvim options must be set here with the `import` key mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up @@ -20,13 +20,13 @@ require("lazy").setup({ performance = { rtp = { -- disable some rtp plugins, add more to your liking - -- disabled_plugins = { - -- "gzip", - -- "netrwPlugin", - -- "tarPlugin", - -- "tohtml", - -- "zipPlugin", - -- }, + disabled_plugins = { + -- "gzip", + -- "netrwPlugin", + -- "tarPlugin", + "tohtml", + "zipPlugin", + }, }, }, } --[[@as LazyConfig]]) diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index bc69919..d5a14fd 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -93,27 +93,15 @@ return { -- Mappings can be configured through AstroCore as well. -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized mappings = { - + -- first key is the mode n = { - - -- tables with just a `desc` key will be registered with which-key if it's installed - -- this is useful for naming menus - -- ["b"] = { desc = "Buffers" }, - - -- setting a mapping to false will disable it - -- [""] = false, - - -- Visual selection of pasted text - ["gp"] = { "`[v`]", desc = "Visual selection of pasted text" }, + -- second key is the lefthand side of the map -- navigate buffer tabs ["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, ["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, -- mappings seen under group name "Buffer" - ["b"] = { desc = "Buffers" }, - ["bn"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, - ["bp"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, ["bd"] = { function() require("astroui.status.heirline").buffer_picker( @@ -125,6 +113,13 @@ return { ["bp"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, ["bn"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + -- ["b"] = { desc = "Buffers" }, + + -- setting a mapping to false will disable it + -- [""] = false, + -- Normal mode : Custom mappings [""] = { "Neotree toggle", desc = "File Explorer" }, -- F26 corresponds to on my keyboard [""] = { @@ -160,7 +155,7 @@ return { -- Clear Ctrl+l so that we can use it to clear the terminal [""] = false, [""] = false, - -- Clear Ctrl-J and Ctrl-K so that we can use them for apps running in the terminal (for example lazygit) + -- Clear Ctrl-J and Ctrl-K so that we can use them to navigate the terminal (for lazygit) [""] = false, [""] = false, -- My terms diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 720b9d3..b8b121f 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -41,19 +41,18 @@ return { servers = { -- "pyright" }, - -- customize language server configuration options passed to `lspconfig` - ---@diagnostic disable: missing-fields + -- customize language server configuration passed to `vim.lsp.config` + -- client specific configuration can also go in `lsp/` in your configuration root (see `:h lsp-config`) config = { - -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + -- ["*"] = { capabilities = {} }, -- modify default LSP client settings such as capabilities }, -- customize how language servers are attached handlers = { - -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server - -- function(server, opts) require("lspconfig")[server].setup(opts) end + -- a function with the key `*` modifies the default handler, functions takes the server name as the parameter + -- ["*"] = function(server) vim.lsp.enable(server) end - -- the key is the server that is being setup with `lspconfig` + -- the key is the server that is being setup with `vim.lsp.config` -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server - -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed }, -- Configure buffer local auto commands to add when attaching a language server autocmds = { @@ -72,7 +71,7 @@ return { -- the rest of the autocmd options (:h nvim_create_autocmd) desc = "Refresh codelens (buffer)", callback = function(args) - if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end + if require("astrolsp").config.features.codelens then vim.lsp.codelens.enable(true, { bufnr = args.buf }) end end, }, }, @@ -90,13 +89,13 @@ return { function() require("astrolsp.toggles").buffer_semantic_tokens() end, desc = "Toggle LSP semantic highlight (buffer)", cond = function(client) - return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil + return client:supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil end, }, }, }, -- A custom `on_attach` function to be run after the default `on_attach` function - -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + -- takes two parameters `client` and `bufnr` (`:h lsp-attach`) on_attach = function(client, bufnr) -- this would disable semanticTokensProvider for all clients -- client.server_capabilities.semanticTokensProvider = nil diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 94436aa..3a9afe9 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,15 +1,24 @@ if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE -- Customize Treesitter +-- -------------------- +-- Treesitter customizations are handled with AstroCore +-- as nvim-treesitter simply provides a download utility for parsers ---@type LazySpec return { - "nvim-treesitter/nvim-treesitter", + "AstroNvim/astrocore", + ---@type AstroCoreOpts opts = { - ensure_installed = { - "lua", - "vim", - -- add more arguments for adding more treesitter parsers + treesitter = { + highlight = true, -- enable/disable treesitter based highlighting + indent = true, -- enable/disable treesitter based indentation + auto_install = true, -- enable/disable automatic installation of detected languages + ensure_installed = { + "lua", + "vim", + -- add more arguments for adding more treesitter parsers + }, }, }, } diff --git a/lua/plugins/user.lua b/lua/plugins/user.lua index b7de6df..d332627 100644 --- a/lua/plugins/user.lua +++ b/lua/plugins/user.lua @@ -49,10 +49,12 @@ return { { "L3MON4D3/LuaSnip", config = function(plugin, opts) - require "astronvim.plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call -- add more custom luasnip configuration such as filetype extend or custom snippets local luasnip = require "luasnip" luasnip.filetype_extend("javascript", { "javascriptreact" }) + + -- include the default astronvim config that calls the setup call + require "astronvim.plugins.configs.luasnip"(plugin, opts) end, }, diff --git a/lua/polish.lua b/lua/polish.lua index 6b68109..642719f 100644 --- a/lua/polish.lua +++ b/lua/polish.lua @@ -1,11 +1,5 @@ +if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + -- This will run last in the setup process. -- This is just pure lua so anything that doesn't -- fit in the normal config locations above can go here - --- Needed for python3 through mise --- Locate python3 using PATH -local python_path = vim.fn.exepath "python3" -if python_path == nil or python_path == "" then -else - vim.g.python3_host_prog = python_path -end