From 20d1b9e7f56aa5f484f54e93b3ddc020efd65a2a Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Sun, 9 Nov 2025 13:41:37 +0100 Subject: [PATCH] nvim config updated --- .config/nvim/.gitignore | 2 - .config/nvim/.neoconf.json | 20 ++++ .config/nvim/.stylua.toml | 7 ++ .config/nvim/README.md | 41 ++++++++ .config/nvim/init.lua | 32 +++--- .config/nvim/lazy-lock.json | 68 +++++++++++++ .config/nvim/lua/autocmds.lua | 21 ++++ .config/nvim/lua/community.lua | 13 +++ .config/nvim/lua/completion.lua | 128 ------------------------ .config/nvim/lua/config.lua | 47 --------- .config/nvim/lua/ftplugin/yaml.lua | 5 - .config/nvim/lua/lazy_setup.lua | 32 ++++++ .config/nvim/lua/plugins/astrocore.lua | 71 +++++++++++++ .config/nvim/lua/plugins/astrolsp.lua | 104 +++++++++++++++++++ .config/nvim/lua/plugins/astroui.lua | 39 ++++++++ .config/nvim/lua/plugins/autopairs.lua | 4 - .config/nvim/lua/plugins/bufferline.lua | 10 -- .config/nvim/lua/plugins/flutter.lua | 11 ++ .config/nvim/lua/plugins/git.lua | 17 ---- .config/nvim/lua/plugins/init.lua | 48 --------- .config/nvim/lua/plugins/lualine.lua | 16 --- .config/nvim/lua/plugins/mason.lua | 37 +++++++ .config/nvim/lua/plugins/neo-tree.lua | 19 ---- .config/nvim/lua/plugins/treesitter.lua | 15 +++ .config/nvim/lua/plugins/user.lua | 83 +++++++++++++++ .config/nvim/lua/plugins/which-key.lua | 8 -- .config/nvim/lua/plugins/zen-mode.lua | 35 ++----- .config/nvim/lua/polish.lua | 18 ++++ .config/nvim/neovim.yml | 6 ++ .config/nvim/selene.toml | 8 ++ 30 files changed, 618 insertions(+), 347 deletions(-) delete mode 100644 .config/nvim/.gitignore create mode 100644 .config/nvim/.neoconf.json create mode 100644 .config/nvim/.stylua.toml create mode 100644 .config/nvim/README.md create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/autocmds.lua create mode 100644 .config/nvim/lua/community.lua delete mode 100644 .config/nvim/lua/completion.lua delete mode 100644 .config/nvim/lua/config.lua delete mode 100644 .config/nvim/lua/ftplugin/yaml.lua create mode 100644 .config/nvim/lua/lazy_setup.lua create mode 100644 .config/nvim/lua/plugins/astrocore.lua create mode 100644 .config/nvim/lua/plugins/astrolsp.lua create mode 100644 .config/nvim/lua/plugins/astroui.lua delete mode 100644 .config/nvim/lua/plugins/autopairs.lua delete mode 100644 .config/nvim/lua/plugins/bufferline.lua create mode 100644 .config/nvim/lua/plugins/flutter.lua delete mode 100644 .config/nvim/lua/plugins/git.lua delete mode 100644 .config/nvim/lua/plugins/init.lua delete mode 100644 .config/nvim/lua/plugins/lualine.lua create mode 100644 .config/nvim/lua/plugins/mason.lua delete mode 100644 .config/nvim/lua/plugins/neo-tree.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua create mode 100644 .config/nvim/lua/plugins/user.lua delete mode 100644 .config/nvim/lua/plugins/which-key.lua create mode 100644 .config/nvim/lua/polish.lua create mode 100644 .config/nvim/neovim.yml create mode 100644 .config/nvim/selene.toml diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore deleted file mode 100644 index 8b55343..0000000 --- a/.config/nvim/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -lazy-lock.json - diff --git a/.config/nvim/.neoconf.json b/.config/nvim/.neoconf.json new file mode 100644 index 0000000..2d7a81f --- /dev/null +++ b/.config/nvim/.neoconf.json @@ -0,0 +1,20 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + }, + "lspconfig": { + "lua_ls": { + "Lua.format.enable": false + } + } +} diff --git a/.config/nvim/.stylua.toml b/.config/nvim/.stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/.config/nvim/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/.config/nvim/README.md b/.config/nvim/README.md new file mode 100644 index 0000000..a026b21 --- /dev/null +++ b/.config/nvim/README.md @@ -0,0 +1,41 @@ +# AstroNvim Template + +**NOTE:** This is for AstroNvim v4+ + +A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim) + +## System dependencies +- `lazygit` for lazygit integration +- `typescript-language-server` and `typescript` installed globally from npm +```bash +npm install -g typescript-language-server typescript +``` + +## 🛠️ Installation + +#### Make a backup of your current nvim and shared folder + +```shell +mv ~/.config/nvim ~/.config/nvim.bak +mv ~/.local/share/nvim ~/.local/share/nvim.bak +mv ~/.local/state/nvim ~/.local/state/nvim.bak +mv ~/.cache/nvim ~/.cache/nvim.bak +``` + +#### Create a new user repository from this template + +Press the "Use this template" button above to create a new repository to store your user configuration. + +You can also just clone this repository directly if you do not want to track your user configuration in GitHub. + +#### Clone the repository + +```shell +git clone https://github.com// ~/.config/nvim +``` + +#### Start Neovim + +```shell +nvim +``` diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 1ec385c..77ca2f6 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,20 +1,20 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) +-- 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 }) end vim.opt.rtp:prepend(lazypath) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - -require('lazy').setup('plugins') -require('config') -require('completion') +-- validate that lazy is available +if not pcall(require, "lazy") then + -- stylua: ignore + vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() +end +require "lazy_setup" +require "polish" +require "autocmds" diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..bfe72d6 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,68 @@ +{ + "AstroNvim": { "branch": "main", "commit": "c5e610f614e74c9dd9bf11760c4d0ad2c98c0abe" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "aerial.nvim": { "branch": "master", "commit": "6ab1a0ce4874d21610fc5a67a6c82c7b943c635b" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "astrocommunity": { "branch": "main", "commit": "d451f1d8e90e21c0cad730add858d8f952c66f01" }, + "astrocore": { "branch": "main", "commit": "44a3dc0bf1591022b2a6bc89dccdfac1be17bec9" }, + "astrolsp": { "branch": "main", "commit": "909fbe64f3f87d089ff3777751261544557117cc" }, + "astrotheme": { "branch": "main", "commit": "4a2af93815e4e6adfe69c836e46047a9451de858" }, + "astroui": { "branch": "main", "commit": "e923a84c488d879a260fc9cfb2dc27dd870fb6ac" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, + "flutter-tools.nvim": { "branch": "main", "commit": "6faf2c70bd56f1fe78620591a2bb73f4dc6f4870" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" }, + "heirline.nvim": { "branch": "master", "commit": "fae936abb5e0345b85c3a03ecf38525b0828b992" }, + "hover.nvim": { "branch": "main", "commit": "3b49066e09e03e63be6d6f43ae2b8bcd58301f63" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, + "lsp_signature.nvim": { "branch": "master", "commit": "a793d02b6a5e639fa9d3f2a89a839fa688ab2d0a" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mini.animate": { "branch": "main", "commit": "8ce6df739aa9d14c876bace722af28c3d09e9971" }, + "mini.bufremove": { "branch": "main", "commit": "285bdac9596ee7375db50c0f76ed04336dcd2685" }, + "neo-tree.nvim": { "branch": "main", "commit": "c4c168e459395275c552179a1baf9c3d885d6a74" }, + "neoconf.nvim": { "branch": "main", "commit": "f630568a4d04154803886f21ca60923f12709f0f" }, + "none-ls.nvim": { "branch": "main", "commit": "a117163db44c256d53c3be8717f3e1a2a28e6299" }, + "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, + "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, + "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, + "nvim-dap": { "branch": "master", "commit": "6a5bba0ddea5d419a783e170c20988046376090d" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, + "nvim-lspconfig": { "branch": "master", "commit": "185b2af444b27d6541c02d662b5b68190e5cf0c4" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, + "nvim-treesitter": { "branch": "master", "commit": "f8aaf5ce4e27cd20de917946b2ae5c968a2c2858" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "nvim-ufo": { "branch": "main", "commit": "61463090a4f55f5d080236ea62f09d1cd8976ff3" }, + "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, + "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, + "promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" }, + "resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" }, + "schemastore.nvim": { "branch": "main", "commit": "960a5cf992c033170499ccc7003df59734ed40a8" }, + "smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope.nvim": { "branch": "master", "commit": "a17d611a0e111836a1db5295f04945df407c5135" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" }, + "vim-illuminate": { "branch": "master", "commit": "19cb21f513fc2b02f0c66be70107741e837516a1" }, + "which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" }, + "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } +} diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua new file mode 100644 index 0000000..3cdfcb9 --- /dev/null +++ b/.config/nvim/lua/autocmds.lua @@ -0,0 +1,21 @@ +-- Autocommand: trigger Flutter hot reload on save +-- +-- This runs whenever you save a *.dart file (BufWritePost). +-- It checks if a tmux session named "flutter" exists. +-- If it does, it sends the keys "r" to the "app" window +-- of that session, which tells `flutter run` to hot-reload. +-- +-- Workflow: +-- 1. Start tmux: tmux new -s flutter -n app +-- 2. Inside tmux "app" window, run: flutter run +-- 3. Open another window/pane for nvim. +-- 4. Whenever you :w a Dart file in nvim, hot reload will fire. +-- + +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "*.dart", + callback = function() + local result = vim.fn.system({ "tmux", "send-keys", "-t", "flutter:app", "r", "Enter" }) + vim.notify("Flutter hot reload triggered", vim.log.levels.INFO) + end, +}) diff --git a/.config/nvim/lua/community.lua b/.config/nvim/lua/community.lua new file mode 100644 index 0000000..f0b957a --- /dev/null +++ b/.config/nvim/lua/community.lua @@ -0,0 +1,13 @@ +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec +return { + "AstroNvim/astrocommunity", + { import = "astrocommunity.pack.lua" }, + -- import/override with your plugins folder + { import = "astrocommunity.utility.hover-nvim" }, + { import = "astrocommunity.diagnostics.trouble-nvim" }, + { import = "astrocommunity.scrolling.mini-animate" }, +} diff --git a/.config/nvim/lua/completion.lua b/.config/nvim/lua/completion.lua deleted file mode 100644 index 80ce0e7..0000000 --- a/.config/nvim/lua/completion.lua +++ /dev/null @@ -1,128 +0,0 @@ -local cmp_status_ok, cmp = pcall(require, "cmp") - if not cmp_status_ok then - return - end - - local snip_status_ok, luasnip = pcall(require, "luasnip") - if not snip_status_ok then - return - end - - require("luasnip/loaders/from_vscode").lazy_load() - - local check_backspace = function() - local col = vim.fn.col "." - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" - end - - --   פּ ﯟ   some other good icons - local kind_icons = { - Text = "", - Method = "m", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - } - -- find more here: https://www.nerdfonts.com/cheat-sheet - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [""] = cmp.mapping { - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }, - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping.confirm { select = false }, - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - 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", - }), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind - vim_item.menu = ({ - luasnip = "[Snippet]", - buffer = "[Buffer]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, - }, - sources = { - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - -- documentation = { - -- border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - -- }, - -- experimental = { - -- ghost_text = false, - -- native_menu = false, - -- }, - } - diff --git a/.config/nvim/lua/config.lua b/.config/nvim/lua/config.lua deleted file mode 100644 index a4fa29e..0000000 --- a/.config/nvim/lua/config.lua +++ /dev/null @@ -1,47 +0,0 @@ -local set = vim.opt - -set.mouse = 'a' -set.encoding = 'UTF-8' -set.fileencoding = 'UTF-8' - -set.number = true -set.relativenumber = true -set.showcmd = true -vim.o.syntax = true - -set.ignorecase = true -set.smartcase = true - -set.cursorline = true --- bold line number at cursor -vim.cmd [[ highlight CursorLineNr cterm=bold ]] - -set.linebreak = true - --- special characters -set.list = true -set.listchars = 'tab:→ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨' - -set.tabstop = 4 -set.shiftwidth = 4 -vim.o.expandtab = false -vim.o.smartindent = true - -set.swapfile = false - --- spellcheck (enable with `set spell`) -vim.o.spelllang = 'cs,en_gb' -vim.cmd [[ hi SpellBad cterm=bold ctermbg=red ctermfg=white ]] - --- cursor padding from top and bottom -vim.o.scrolloff = 5 - --- better navigation in split windows -vim.keymap.set('n', '', 'h') -vim.keymap.set('n', '', 'j') -vim.keymap.set('n', '', 'k') -vim.keymap.set('n', '', 'l') - --- colorscheme -vim.cmd [[ color base16-default-dark ]] - diff --git a/.config/nvim/lua/ftplugin/yaml.lua b/.config/nvim/lua/ftplugin/yaml.lua deleted file mode 100644 index 21a2eb3..0000000 --- a/.config/nvim/lua/ftplugin/yaml.lua +++ /dev/null @@ -1,5 +0,0 @@ -vim.o.tabstop = 2 -vim.o.softtabstop = 2 -vim.o.shiftwidth = 2 -vim.o.expandtab = true - diff --git a/.config/nvim/lua/lazy_setup.lua b/.config/nvim/lua/lazy_setup.lua new file mode 100644 index 0000000..8a19892 --- /dev/null +++ b/.config/nvim/lua/lazy_setup.lua @@ -0,0 +1,32 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + version = "^4", -- 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 + maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up + icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) + pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override + update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrotheme", "habamax" } }, + ui = { backdrop = 100 }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) diff --git a/.config/nvim/lua/plugins/astrocore.lua b/.config/nvim/lua/plugins/astrocore.lua new file mode 100644 index 0000000..b2c2173 --- /dev/null +++ b/.config/nvim/lua/plugins/astrocore.lua @@ -0,0 +1,71 @@ +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start + }, + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + -- vim options can be configured here + options = { + opt = { -- vim.opt. + relativenumber = true, -- sets vim.opt.relativenumber + number = true, -- sets vim.opt.number + spell = false, -- sets vim.opt.spell + signcolumn = "yes", -- sets vim.opt.signcolumn to yes + wrap = false, -- sets vim.opt.wrap + scrolloff = 8, + }, + g = { -- vim.g. + -- configure global vim variables (vim.g) + -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- This can be found in the `lua/lazy_setup.lua` file + }, + }, + -- 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 = { + -- 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" + ["bd"] = { + function() + require("astroui.status.heirline").buffer_picker( + function(bufnr) require("astrocore.buffer").close(bufnr) end + ) + end, + desc = "Close buffer from tabline", + }, + + -- 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, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/astrolsp.lua b/.config/nvim/lua/plugins/astrolsp.lua new file mode 100644 index 0000000..8c9c535 --- /dev/null +++ b/.config/nvim/lua/plugins/astrolsp.lua @@ -0,0 +1,104 @@ +-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine +-- Configuration documentation can be found with `:h astrolsp` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 1000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + ts_ls = {}, + -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + }, + -- 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 + + -- the key is the server that is being setup with `lspconfig` + -- 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 = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + lsp_codelens_refresh = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + cond = "textDocument/codeLens", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "InsertLeave", "BufEnter" }, + -- 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 + end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + 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 + end, + }, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + end, + }, +} diff --git a/.config/nvim/lua/plugins/astroui.lua b/.config/nvim/lua/plugins/astroui.lua new file mode 100644 index 0000000..737a2fb --- /dev/null +++ b/.config/nvim/lua/plugins/astroui.lua @@ -0,0 +1,39 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + -- change colorscheme + colorscheme = "astrodark", + -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + highlights = { + init = { -- this table overrides highlights in all themes + -- Normal = { bg = "#000000" }, + }, + astrodark = { -- a table of overrides/changes when applying the astrotheme theme + -- Normal = { bg = "#000000" }, + }, + }, + -- Icons can be configured throughout the interface + icons = { + -- configure the loading of the lsp in the status line + LSPLoading1 = "⠋", + LSPLoading2 = "⠙", + LSPLoading3 = "⠹", + LSPLoading4 = "⠸", + LSPLoading5 = "⠼", + LSPLoading6 = "⠴", + LSPLoading7 = "⠦", + LSPLoading8 = "⠧", + LSPLoading9 = "⠇", + LSPLoading10 = "⠏", + }, + }, +} diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua deleted file mode 100644 index 103fec9..0000000 --- a/.config/nvim/lua/plugins/autopairs.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'windwp/nvim-autopairs', - config = function() require("nvim-autopairs").setup {} end -} diff --git a/.config/nvim/lua/plugins/bufferline.lua b/.config/nvim/lua/plugins/bufferline.lua deleted file mode 100644 index c563cb4..0000000 --- a/.config/nvim/lua/plugins/bufferline.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - 'akinsho/bufferline.nvim', - config = function() - vim.opt.termguicolors = true - require("bufferline").setup{} - end - }, -} - diff --git a/.config/nvim/lua/plugins/flutter.lua b/.config/nvim/lua/plugins/flutter.lua new file mode 100644 index 0000000..b4dcd72 --- /dev/null +++ b/.config/nvim/lua/plugins/flutter.lua @@ -0,0 +1,11 @@ +return { + -- Add the community repository of plugin specifications + "AstroNvim/astrocommunity", + { import = "astrocommunity.pack.dart" }, + -- Configure flutter-tools + { "akinsho/flutter-tools.nvim", + opts = { + ... + } + } +} diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua deleted file mode 100644 index c43221d..0000000 --- a/.config/nvim/lua/plugins/git.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - { - 'f-person/git-blame.nvim', - config = function() - vim.g.gitblame_date_format = '%r' - vim.g.gitblame_message_when_not_committed = '' - vim.g.gitblame_display_virtual_text = 0 - end - }, - { - 'lewis6991/gitsigns.nvim', - config = function() - require('gitsigns').setup() - end - }, -} - diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua deleted file mode 100644 index 569e731..0000000 --- a/.config/nvim/lua/plugins/init.lua +++ /dev/null @@ -1,48 +0,0 @@ -return { - 'RRethy/nvim-base16', - 'tpope/vim-commentary', - - -- completion - 'hrsh7th/nvim-cmp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'saadparwaiz1/cmp_luasnip', - - -- snippets - 'L3MON4D3/LuaSnip', - 'rafamadriz/friendly-snippets', - - -- emmet - 'mattn/emmet-vim', - - -- LSP - 'neovim/nvim-lspconfig', - - -- LSP, DAP, linters and formatters - -- 'jose-elias-alvarez/null-ls.nvim', - { - 'dense-analysis/ale', - config = function() - vim.cmd [[ g:ale_sign_column_always = 1 ]] - end - }, - - -- management for LSP, DAP, linters and formatters - { - 'williamboman/mason.nvim', - config = function() - require('mason').setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - } - } - }) - end - }, - 'williamboman/mason-lspconfig.nvim', -} - diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua deleted file mode 100644 index 1925098..0000000 --- a/.config/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - 'nvim-lualine/lualine.nvim', - dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true }, - config = function() - local git_blame = require('gitblame') - require('lualine').setup({ - sections = { - lualine_c = { - { git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available } - } - } - }) - vim.o.showmode = false - end -} - diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..b6be8eb --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,37 @@ +-- Customize Mason plugins + +---@type LazySpec +return { + -- use mason-lspconfig to configure LSP installations + { + "williamboman/mason-lspconfig.nvim", + -- overrides `require("mason-lspconfig").setup(...)` + opts = { + ensure_installed = { + "lua_ls", + -- add more arguments for adding more language servers + }, + }, + }, + -- use mason-null-ls to configure Formatters/Linter installation for null-ls sources + { + "jay-babu/mason-null-ls.nvim", + -- overrides `require("mason-null-ls").setup(...)` + opts = { + ensure_installed = { + "stylua", + -- add more arguments for adding more null-ls sources + }, + }, + }, + { + "jay-babu/mason-nvim-dap.nvim", + -- overrides `require("mason-nvim-dap").setup(...)` + opts = { + ensure_installed = { + "python", + -- add more arguments for adding more debuggers + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua deleted file mode 100644 index 76d8096..0000000 --- a/.config/nvim/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - 'nvim-neo-tree/neo-tree.nvim', - cmd = 'Neotree', - branch = 'v2.x', - keys = { - { 'ft', 'Neotree toggle', desc = 'NeoTree' }, - }, - dependencies = { - 'nvim-lua/plenary.nvim', - 'MunifTanjim/nui.nvim', - }, - opts = { - filesystem = { - follow_current_file = true, - hijack_netrw_behavior = 'open_current', - }, - }, -} - diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..94436aa --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,15 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Treesitter + +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "lua", + "vim", + -- add more arguments for adding more treesitter parsers + }, + }, +} diff --git a/.config/nvim/lua/plugins/user.lua b/.config/nvim/lua/plugins/user.lua new file mode 100644 index 0000000..76fd493 --- /dev/null +++ b/.config/nvim/lua/plugins/user.lua @@ -0,0 +1,83 @@ +-- You can also add or configure plugins by creating files in this `plugins/` folder +-- Here are some examples: + +---@type LazySpec +return { + + -- == Examples of Adding Plugins == + + "andweeb/presence.nvim", + { + "ray-x/lsp_signature.nvim", + event = "BufRead", + config = function() require("lsp_signature").setup() end, + }, + + -- == Examples of Overriding Plugins == + + -- customize alpha options + { + "goolord/alpha-nvim", + opts = function(_, opts) + -- customize the dashboard header + opts.section.header.val = { + " █████ ███████ ████████ ██████ ██████", + "██ ██ ██ ██ ██ ██ ██ ██", + "███████ ███████ ██ ██████ ██ ██", + "██ ██ ██ ██ ██ ██ ██ ██", + "██ ██ ███████ ██ ██ ██ ██████", + " ", + " ███  ██ ██  ██ ██ ███  ███", + " ████  ██ ██  ██ ██ ████  ████", + " ██ ██  ██ ██  ██ ██ ██ ████ ██", + " ██  ██ ██  ██  ██  ██ ██  ██  ██", + " ██   ████   ████   ██ ██      ██", + } + return opts + end, + }, + + -- You can disable default plugins as follows: + { "max397574/better-escape.nvim", enabled = false }, + + -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call + { + "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" }) + end, + }, + + { + "windwp/nvim-autopairs", + config = function(plugin, opts) + require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom autopairs configuration such as custom rules + local npairs = require "nvim-autopairs" + local Rule = require "nvim-autopairs.rule" + local cond = require "nvim-autopairs.conds" + npairs.add_rules( + { + Rule("$", "$", { "tex", "latex" }) + -- don't add a pair if the next character is % + :with_pair(cond.not_after_regex "%%") + -- don't add a pair if the previous character is xxx + :with_pair( + cond.not_before_regex("xxx", 3) + ) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex "xx") + -- disable adding a newline when you press + :with_cr(cond.none()), + }, + -- disable for .vim files, but it work for another filetypes + Rule("a", "a", "-vim") + ) + end, + }, +} diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua deleted file mode 100644 index 750ef0b..0000000 --- a/.config/nvim/lua/plugins/which-key.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "folke/which-key.nvim", - config = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end -} - diff --git a/.config/nvim/lua/plugins/zen-mode.lua b/.config/nvim/lua/plugins/zen-mode.lua index 14a8d2f..fd78d58 100644 --- a/.config/nvim/lua/plugins/zen-mode.lua +++ b/.config/nvim/lua/plugins/zen-mode.lua @@ -1,29 +1,10 @@ return { - 'folke/zen-mode.nvim', - config = { - window = { - backdrop = 1, - width = 80, - height = .9, - options = { - signcolumn = "no", - number = false, - relativenumber = false, - cursorline = false, - cursorcolumn = false, - foldcolumn = "0", - list = false, - } - }, - opts = { - alacritty = { - enabled = true, - font = "13", - }, - }, - }, - keys = { - { 'fg', 'ZenMode', desc = 'Zen Mode' }, - }, + { + "folke/zen-mode.nvim", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + }, } - diff --git a/.config/nvim/lua/polish.lua b/.config/nvim/lua/polish.lua new file mode 100644 index 0000000..5b65b7d --- /dev/null +++ b/.config/nvim/lua/polish.lua @@ -0,0 +1,18 @@ +if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- This will run last in the setup process and is a good place to configure +-- things like custom filetypes. This is just pure lua so anything that doesn't +-- fit in the normal config locations above can go here + +-- Set up custom filetypes +vim.filetype.add { + extension = { + foo = "fooscript", + }, + filename = { + ["Foofile"] = "fooscript", + }, + pattern = { + ["~/%.config/foo/.*"] = "fooscript", + }, +} diff --git a/.config/nvim/neovim.yml b/.config/nvim/neovim.yml new file mode 100644 index 0000000..b9235ab --- /dev/null +++ b/.config/nvim/neovim.yml @@ -0,0 +1,6 @@ +--- +base: lua51 + +globals: + vim: + any: true diff --git a/.config/nvim/selene.toml b/.config/nvim/selene.toml new file mode 100644 index 0000000..e7005c3 --- /dev/null +++ b/.config/nvim/selene.toml @@ -0,0 +1,8 @@ +std = "neovim" + +[rules] +global_usage = "allow" +if_same_then_else = "allow" +incorrect_standard_library_use = "allow" +mixed_table = "allow" +multiple_statements = "allow"