From 6224efd4a8c21223de7f87966ab0e0eca8af1148 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 22 Aug 2024 07:38:23 +0545 Subject: [PATCH] wip --- dotfyle.json | 1972 ------------------------------ init.lua | 4 +- lua/configs/alpha.lua | 76 -- lua/configs/dashboard.lua | 73 ++ lua/configs/lsp.lua | 220 ++-- lua/configs/lualine.lua | 324 +++-- lua/configs/mason.lua | 75 +- lua/configs/none-ls.lua | 92 +- lua/core/autocmd.lua | 232 ++-- lua/core/functions.lua | 2 +- lua/core/keymaps.lua | 75 -- lua/core/keys.lua | 72 ++ lua/core/lazy.lua | 175 +-- lua/core/options.lua | 143 ++- lua/core/util.lua | 66 - lua/lib/icons.lua | 164 +++ lua/lib/util.lua | 66 + lua/lock.json | 34 +- lua/plugins/coding.lua | 425 ++++--- lua/plugins/colorscheme.lua | 45 +- lua/plugins/editor.lua | 493 ++++---- lua/plugins/formater.lua | 63 + lua/plugins/lint.lua | 27 + lua/plugins/linter_formatter.lua | 44 +- lua/plugins/mini.lua | 136 ++- lua/plugins/other.lua | 358 +++--- lua/plugins/ui.lua | 403 +++--- lua/plugins/whichkey.lua | 13 +- mason-lock.json | 28 +- plugin/after/highlights.lua | 28 + 30 files changed, 2144 insertions(+), 3784 deletions(-) delete mode 100644 dotfyle.json delete mode 100644 lua/configs/alpha.lua create mode 100644 lua/configs/dashboard.lua delete mode 100644 lua/core/keymaps.lua create mode 100644 lua/core/keys.lua delete mode 100644 lua/core/util.lua create mode 100644 lua/lib/icons.lua create mode 100644 lua/lib/util.lua create mode 100644 lua/plugins/formater.lua create mode 100644 lua/plugins/lint.lua create mode 100644 plugin/after/highlights.lua diff --git a/dotfyle.json b/dotfyle.json deleted file mode 100644 index 95cf53f..0000000 --- a/dotfyle.json +++ /dev/null @@ -1,1972 +0,0 @@ -{ - "distribution": "custom", - "masonTools": [ - "biome", - "black", - "clang-format", - "clangd", - "eslint_d", - "isort", - "jdtls", - "lua-language-server", - "prettier", - "pylint", - "pyright", - "pyright-langserver", - "stylua", - "vscode-html-language-server" - ], - "plugins": [ - "2kabhishek/tdo.nvim", - "2kabhishek/termim.nvim", - "Exafunction/codeium.vim", - "HiPhish/rainbow-delimiters.nvim", - "L3MON4D3/LuaSnip", - "LudoPinelli/comment-box.nvim", - "LunarVim/bigfile.nvim", - "MunifTanjim/nui.nvim", - "NStefan002/screenkey.nvim", - "SmiteshP/nvim-navic", - "WhoIsSethDaniel/mason-tool-installer.nvim", - "akinsho/bufferline.nvim", - "akinsho/toggleterm.nvim", - "altermo/ultimate-autopair.nvim", - "antosha417/nvim-lsp-file-operations", - "bluz71/vim-moonfly-colors", - "chrisgrieser/nvim-recorder", - "creativenull/dotfyle-metadata.nvim", - "debugloop/telescope-undo.nvim", - "echasnovski/mini.files", - "echasnovski/mini.nvim", - "folke/flash.nvim", - "folke/lazy.nvim", - "folke/noice.nvim", - "folke/persistence.nvim", - "folke/trouble.nvim", - "folke/which-key.nvim", - "folke/zen-mode.nvim", - "gbprod/yanky.nvim", - "goolord/alpha-nvim", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-path", - "hrsh7th/nvim-cmp", - "iamcco/markdown-preview.nvim", - "jay-babu/mason-null-ls.nvim", - "kristijanhusak/vim-dadbod-completion", - "kristijanhusak/vim-dadbod-ui", - "lukas-reineke/indent-blankline.nvim", - "m-demare/hlargs.nvim", - "m4xshen/hardtime.nvim", - "max397574/better-escape.nvim", - "mfussenegger/nvim-dap", - "mstuttgart/odoo-snippets", - "mvllow/modes.nvim", - "nacro90/numb.nvim", - "neovim/nvim-lspconfig", - "numToStr/Navigator.nvim", - "nvim-lua/plenary.nvim", - "nvim-lualine/lualine.nvim", - "nvim-neo-tree/neo-tree.nvim", - "nvim-neotest/neotest", - "nvim-neotest/neotest-jest", - "nvim-neotest/neotest-python", - "nvim-neotest/nvim-nio", - "nvim-pack/nvim-spectre", - "nvim-telescope/telescope-file-browser.nvim", - "nvim-telescope/telescope-fzf-native.nvim", - "nvim-telescope/telescope-symbols.nvim", - "nvim-telescope/telescope-ui-select.nvim", - "nvim-telescope/telescope.nvim", - "nvim-tree/nvim-web-devicons", - "nvim-treesitter/nvim-treesitter", - "nvim-treesitter/nvim-treesitter-context", - "nvim-treesitter/nvim-treesitter-textobjects", - "nvimdev/lspsaga.nvim", - "nvimtools/none-ls.nvim", - "olimorris/neotest-rspec", - "onsails/lspkind.nvim", - "rafamadriz/friendly-snippets", - "rcarriga/nvim-dap-ui", - "rcarriga/nvim-notify", - "saadparwaiz1/cmp_luasnip", - "smjonas/inc-rename.nvim", - "stevearc/dressing.nvim", - "szw/vim-maximizer", - "tpope/vim-dadbod", - "utilyre/barbecue.nvim", - "wakatime/vim-wakatime", - "williamboman/mason-lspconfig.nvim", - "williamboman/mason.nvim", - "willothy/flatten.nvim", - "windwp/nvim-ts-autotag", - "zapling/mason-lock.nvim" - ], - "pluginManager": "lazy.nvim", - "keymaps": [ - { - "desc": "Next Buffer", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "bnext" - }, - { - "desc": "Escape and clear hlsearch", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "noh" - }, - { - "desc": " Left File Explorer", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": ":Neotree toggle left" - }, - { - "desc": "Float File Explorer", - "noremap": true, - "lhs": "ee", - "mode": "n", - "rhs": ":Neotree toggle float" - }, - { - "desc": "Current Word", - "noremap": true, - "lhs": "jw", - "mode": "v", - "rhs": "lua require(\"flash\").jump({ pattern = vim.fn.expand(\"cword>\")})" - }, - { - "desc": "Current Word", - "noremap": true, - "lhs": "jw", - "mode": "n", - "rhs": "lua require(\"flash\").jump({ pattern = vim.fn.expand(\"cword>\")})" - }, - { - "desc": "Remote Treesitter", - "noremap": true, - "lhs": "jt", - "mode": "v", - "rhs": "lua require('flash').treesitter_search()" - }, - { - "desc": "Remote Treesitter", - "noremap": true, - "lhs": "jt", - "mode": "n", - "rhs": "lua require('flash').treesitter_search()" - }, - { - "desc": "Search", - "noremap": true, - "lhs": "js", - "mode": "v", - "rhs": "lua require('flash').jump()" - }, - { - "desc": "Search", - "noremap": true, - "lhs": "js", - "mode": "n", - "rhs": "lua require('flash').jump()" - }, - { - "desc": "Previous Jump", - "noremap": true, - "lhs": "jp", - "mode": "v", - "rhs": "lua require('flash').jump({continue = true})" - }, - { - "desc": "Previous Jump", - "noremap": true, - "lhs": "jp", - "mode": "n", - "rhs": "lua require('flash').jump({continue = true})" - }, - { - "desc": "Search Forward", - "noremap": true, - "lhs": "jn", - "mode": "v", - "rhs": "lua require('flash').jump({search = { forward = true, wrap = false, multi_window = false },})" - }, - { - "desc": "Search Forward", - "noremap": true, - "lhs": "jn", - "mode": "n", - "rhs": "lua require('flash').jump({search = { forward = true, wrap = false, multi_window = false },})" - }, - { - "desc": "Forward", - "noremap": true, - "lhs": "jl", - "mode": "n", - "rhs": "" - }, - { - "desc": "Treesitter", - "noremap": true, - "lhs": "jk", - "mode": "v", - "rhs": "lua require('flash').treesitter()" - }, - { - "desc": "Treesitter", - "noremap": true, - "lhs": "jk", - "mode": "n", - "rhs": "lua require('flash').treesitter()" - }, - { - "desc": "Remote", - "noremap": true, - "lhs": "jj", - "mode": "v", - "rhs": "lua require('flash').remote()" - }, - { - "desc": "Remote", - "noremap": true, - "lhs": "jj", - "mode": "n", - "rhs": "lua require('flash').remote()" - }, - { - "desc": "Backward", - "noremap": true, - "lhs": "jh", - "mode": "n", - "rhs": "" - }, - { - "desc": "Jumplist", - "noremap": true, - "lhs": "jf", - "mode": "n", - "rhs": "Telescope jumplist" - }, - { - "desc": "Diagnostics", - "noremap": true, - "lhs": "jd", - "mode": "v", - "rhs": "FlashDiagnostics" - }, - { - "desc": "Diagnostics", - "noremap": true, - "lhs": "jd", - "mode": "n", - "rhs": "FlashDiagnostics" - }, - { - "desc": "Word", - "noremap": true, - "lhs": "jc", - "mode": "n", - "rhs": "*" - }, - { - "desc": "Search Backward", - "noremap": true, - "lhs": "jN", - "mode": "v", - "rhs": "lua require('flash').jump({search = { forward = false, wrap = false, multi_window = false },})" - }, - { - "desc": "Search Backward", - "noremap": true, - "lhs": "jN", - "mode": "n", - "rhs": "lua require('flash').jump({search = { forward = false, wrap = false, multi_window = false },})" - }, - { - "desc": "Sort Desc", - "noremap": true, - "lhs": "cS", - "mode": "v", - "rhs": ":sort!" - }, - { - "desc": "Time", - "noremap": true, - "lhs": "it", - "mode": "n", - "rhs": "put =strftime('## %r')" - }, - { - "desc": "Registers", - "noremap": true, - "lhs": "ir", - "mode": "n", - "rhs": "Telescope registers" - }, - { - "desc": "Relative Path", - "noremap": true, - "lhs": "ip", - "mode": "n", - "rhs": "put %" - }, - { - "desc": "Nerd Glyphs", - "noremap": true, - "lhs": "in", - "mode": "n", - "rhs": "Nerdy" - }, - { - "desc": "File Name", - "noremap": true, - "lhs": "if", - "mode": "n", - "rhs": "put =expand('%:t')" - }, - { - "desc": "Emojis", - "noremap": true, - "lhs": "ie", - "mode": "n", - "rhs": "Telescope symbols" - }, - { - "desc": "Date", - "noremap": true, - "lhs": "id", - "mode": "n", - "rhs": "put =strftime('## %a, %d %b, %Y, %r')" - }, - { - "desc": "Absolute Path", - "noremap": true, - "lhs": "iP", - "mode": "n", - "rhs": "put %:p" - }, - { - "desc": "New File", - "noremap": true, - "lhs": "en", - "mode": "n", - "rhs": "enew" - }, - { - "desc": " Buffer Local Keymaps (which-key)", - "noremap": true, - "lhs": "?", - "mode": "n", - "rhs": "" - }, - { - "desc": "Reload Configs", - "noremap": true, - "lhs": "cR", - "mode": "n", - "rhs": "ReloadConfig" - }, - { - "desc": "Root Directory", - "noremap": true, - "lhs": "cd", - "mode": "n", - "rhs": "RootDir" - }, - { - "desc": "Clean Empty Lines", - "noremap": true, - "lhs": "cl", - "mode": "n", - "rhs": ":g/^\\s*$/d" - }, - { - "desc": "Alpha", - "noremap": true, - "lhs": "co", - "mode": "n", - "rhs": "Alpha" - }, - { - "desc": "Sort Case Insensitive", - "noremap": true, - "lhs": "ci", - "mode": "v", - "rhs": ":sort i" - }, - { - "desc": "Sort Asc", - "noremap": true, - "lhs": "cs", - "mode": "v", - "rhs": ":sort" - }, - { - "desc": "Unique", - "noremap": true, - "lhs": "cu", - "mode": "v", - "rhs": ":!uniq" - }, - { - "desc": "Close Tab", - "noremap": true, - "lhs": "sc", - "mode": "n", - "rhs": "tabclose" - }, - { - "desc": "Horizontal Split", - "noremap": true, - "lhs": "sa", - "mode": "n", - "rhs": "split" - }, - { - "desc": "Previous Window", - "noremap": true, - "lhs": "s`", - "mode": "n", - "rhs": "p" - }, - { - "desc": "Decrease window height", - "noremap": true, - "lhs": "s_", - "mode": "n", - "rhs": "resize -10" - }, - { - "desc": "Split Right", - "noremap": true, - "lhs": "s\\", - "mode": "n", - "rhs": "v" - }, - { - "desc": "Increase window width", - "noremap": true, - "lhs": "sL", - "mode": "n", - "rhs": "vertical resize +10" - }, - { - "desc": "Increase window height", - "noremap": true, - "lhs": "sK", - "mode": "n", - "rhs": "resize +5" - }, - { - "desc": "Decrease window height", - "noremap": true, - "lhs": "sJ", - "mode": "n", - "rhs": "resize -5" - }, - { - "desc": "Decrease window width", - "noremap": true, - "lhs": "sH", - "mode": "n", - "rhs": "vertical resize -10" - }, - { - "desc": "Increase window width", - "noremap": true, - "lhs": "s=", - "mode": "n", - "rhs": "vertical resize +20" - }, - { - "desc": "Split Below", - "noremap": true, - "lhs": "s/", - "mode": "n", - "rhs": "s" - }, - { - "desc": "Decrease window width", - "noremap": true, - "lhs": "s-", - "mode": "n", - "rhs": "vertical resize -20" - }, - { - "desc": "Increase window height", - "noremap": true, - "lhs": "s+", - "mode": "n", - "rhs": "resize +10" - }, - { - "desc": "Readme", - "noremap": true, - "lhs": "em", - "mode": "n", - "rhs": "e README.md" - }, - { - "desc": "Config Dir", - "noremap": true, - "lhs": "ed", - "mode": "n", - "rhs": "lua require(\"telescope.builtin\").find_files({cwd = vim.fn.stdpath(\"config\")})" - }, - { - "desc": "Config", - "noremap": true, - "lhs": "ec", - "mode": "n", - "rhs": "e $MYVIMRC" - }, - { - "desc": "Alternate File", - "noremap": true, - "lhs": "ea", - "mode": "n", - "rhs": "b#" - }, - { - "desc": "Write and Quit", - "noremap": true, - "lhs": "qw", - "mode": "n", - "rhs": "wq" - }, - { - "desc": "Close Split", - "noremap": true, - "lhs": "qs", - "mode": "n", - "rhs": "c" - }, - { - "desc": "Quit", - "noremap": true, - "lhs": "qq", - "mode": "n", - "rhs": "q" - }, - { - "desc": "Close Others", - "noremap": true, - "lhs": "qo", - "mode": "n", - "rhs": ":%bdelete|b#|bdelete#" - }, - { - "desc": "Force Quit", - "noremap": true, - "lhs": "qf", - "mode": "n", - "rhs": "qall!" - }, - { - "desc": "Delete Buffer", - "noremap": true, - "lhs": "qd", - "mode": "n", - "rhs": "bdelete" - }, - { - "desc": "Close Buffer", - "noremap": true, - "lhs": "qc", - "mode": "n", - "rhs": "bw" - }, - { - "desc": "Quit All", - "noremap": true, - "lhs": "qa", - "mode": "n", - "rhs": "qall" - }, - { - "desc": " Save and Quit", - "noremap": true, - "lhs": "x", - "mode": "n", - "rhs": "x" - }, - { - "desc": "Write and Quit", - "noremap": true, - "lhs": "ww", - "mode": "n", - "rhs": "w" - }, - { - "desc": "Suggestions", - "noremap": true, - "lhs": "ws", - "mode": "n", - "rhs": "Telescope spell_suggest" - }, - { - "desc": "Write and Quit", - "noremap": true, - "lhs": "wq", - "mode": "n", - "rhs": "wq" - }, - { - "desc": "Prev Misspell", - "noremap": true, - "lhs": "wk", - "mode": "n", - "rhs": "[s" - }, - { - "desc": "Next Misspell", - "noremap": true, - "lhs": "wj", - "mode": "n", - "rhs": "]s" - }, - { - "desc": "Force Write", - "noremap": true, - "lhs": "wf", - "mode": "n", - "rhs": "lua require'utils'.sudo_write()" - }, - { - "desc": "Spellcheck", - "noremap": true, - "lhs": "wc", - "mode": "n", - "rhs": "set spell!" - }, - { - "desc": "Quote", - "noremap": true, - "lhs": "vq", - "mode": "n", - "rhs": "viq" - }, - { - "desc": "Paragraph", - "noremap": true, - "lhs": "vp", - "mode": "n", - "rhs": "vip" - }, - { - "desc": "Bracket", - "noremap": true, - "lhs": "vb", - "mode": "n", - "rhs": "vib" - }, - { - "desc": "Around Quote", - "noremap": true, - "lhs": "vQ", - "mode": "n", - "rhs": "vaq" - }, - { - "desc": "Around Para", - "noremap": true, - "lhs": "vP", - "mode": "n", - "rhs": "vap" - }, - { - "desc": "Around Bracket", - "noremap": true, - "lhs": "vB", - "mode": "n", - "rhs": "vab" - }, - { - "desc": "Vertical Split", - "noremap": true, - "lhs": "ss", - "mode": "n", - "rhs": "vsplit" - }, - { - "desc": "Close Split", - "noremap": true, - "lhs": "sq", - "mode": "n", - "rhs": "c" - }, - { - "desc": "Previous Pane", - "noremap": true, - "lhs": "sp", - "mode": "n", - "rhs": "NavigatorPrevious" - }, - { - "desc": "Move Right", - "noremap": true, - "lhs": "sl", - "mode": "n", - "rhs": "l" - }, - { - "desc": "Move Up", - "noremap": true, - "lhs": "sk", - "mode": "n", - "rhs": "k" - }, - { - "desc": "Move Down", - "noremap": true, - "lhs": "sj", - "mode": "n", - "rhs": "j" - }, - { - "desc": "Move Left", - "noremap": true, - "lhs": "sh", - "mode": "n", - "rhs": "h" - }, - { - "desc": "First Tab", - "noremap": true, - "lhs": "sf", - "mode": "n", - "rhs": "tabfirst" - }, - { - "desc": "Dismiss All Notifications", - "noremap": true, - "lhs": "mn", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle Hardtime", - "noremap": true, - "lhs": "ch", - "mode": "n", - "rhs": "HardtimeToggle" - }, - { - "desc": "Don't Save Current Session", - "noremap": true, - "lhs": "md", - "mode": "n", - "rhs": "" - }, - { - "desc": "Restore Last Session", - "noremap": true, - "lhs": "ml", - "mode": "n", - "rhs": "" - }, - { - "desc": "Restore Session", - "noremap": true, - "lhs": "ms", - "mode": "n", - "rhs": "" - }, - { - "desc": "Marked", - "noremap": true, - "lhs": "Cm", - "mode": "n", - "rhs": "" - }, - { - "desc": "Line", - "noremap": true, - "lhs": "Cl", - "mode": "n", - "rhs": "" - }, - { - "desc": "Tiled line", - "noremap": true, - "lhs": "Ct", - "mode": "v", - "rhs": "" - }, - { - "desc": "Tiled line", - "noremap": true, - "lhs": "Ct", - "mode": "n", - "rhs": "" - }, - { - "desc": "Comment Box", - "noremap": true, - "lhs": "Cb", - "mode": "v", - "rhs": "" - }, - { - "desc": "Comment Box", - "noremap": true, - "lhs": "Cb", - "mode": "n", - "rhs": "" - }, - { - "desc": "Delete Comment Style", - "noremap": true, - "lhs": "Cd", - "mode": "v", - "rhs": "" - }, - { - "desc": "Delete Comment Style", - "noremap": true, - "lhs": "Cd", - "mode": "n", - "rhs": "" - }, - { - "desc": "Catalog", - "noremap": true, - "lhs": "Cc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Marked", - "noremap": true, - "lhs": "Cm", - "mode": "v", - "rhs": "" - }, - { - "desc": "Diagnostics", - "noremap": true, - "lhs": "fd", - "mode": "n", - "rhs": "" - }, - { - "desc": "Search History", - "noremap": true, - "lhs": "ks", - "mode": "n", - "rhs": "" - }, - { - "desc": "Command History", - "noremap": true, - "lhs": "kh", - "mode": "n", - "rhs": "" - }, - { - "desc": "Commands", - "noremap": true, - "lhs": "kc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Keymaps", - "noremap": true, - "lhs": "kk", - "mode": "n", - "rhs": "" - }, - { - "desc": "Grep String", - "noremap": true, - "lhs": "fG", - "mode": "n", - "rhs": "" - }, - { - "desc": "Find Highlight Groups", - "noremap": true, - "lhs": "fH", - "mode": "n", - "rhs": "" - }, - { - "desc": "Marks", - "noremap": true, - "lhs": "fm", - "mode": "n", - "rhs": "" - }, - { - "desc": "Old Recent Files", - "noremap": true, - "lhs": "fo", - "mode": "n", - "rhs": "" - }, - { - "desc": "Find Help", - "noremap": true, - "lhs": "fh", - "mode": "n", - "rhs": "" - }, - { - "desc": "Buffers", - "noremap": true, - "lhs": "fb", - "mode": "n", - "rhs": "" - }, - { - "desc": "Live Grep", - "noremap": true, - "lhs": "fg", - "mode": "n", - "rhs": "" - }, - { - "desc": "Find Files (CWD)", - "noremap": true, - "lhs": "ff", - "mode": "n", - "rhs": "" - }, - { - "desc": "File Browser", - "noremap": true, - "lhs": "ef", - "mode": "n", - "rhs": "" - }, - { - "desc": "Fuzzy Find in File", - "noremap": true, - "lhs": "fs", - "mode": "n", - "rhs": "" - }, - { - "desc": "Quickfix", - "noremap": true, - "lhs": "fq", - "mode": "n", - "rhs": "" - }, - { - "desc": "Undo History", - "noremap": true, - "lhs": "fu", - "mode": "n", - "rhs": "" - }, - { - "desc": "Notifications", - "noremap": true, - "lhs": "cn", - "mode": "n", - "rhs": "" - }, - { - "desc": "Run Current Test", - "noremap": true, - "lhs": "uc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle Output Panel", - "noremap": true, - "lhs": "uO", - "mode": "n", - "rhs": "" - }, - { - "desc": "Stop", - "noremap": true, - "lhs": "us", - "mode": "n", - "rhs": "" - }, - { - "desc": "Run Nearest Test", - "noremap": true, - "lhs": "ur", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle Summary", - "noremap": true, - "lhs": "uS", - "mode": "n", - "rhs": "" - }, - { - "desc": "Show Output", - "noremap": true, - "lhs": "uo", - "mode": "n", - "rhs": "" - }, - { - "desc": "Run Test File", - "noremap": true, - "lhs": "uf", - "mode": "n", - "rhs": "" - }, - { - "desc": "toggle markdown preview", - "noremap": true, - "lhs": "cm", - "mode": "n", - "rhs": "" - }, - { - "desc": "DB Last query", - "noremap": true, - "lhs": "dl", - "mode": "n", - "rhs": "" - }, - { - "desc": "DB Rename buffer", - "noremap": true, - "lhs": "dr", - "mode": "n", - "rhs": "" - }, - { - "desc": "DB Find buffer", - "noremap": true, - "lhs": "db", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle DB UI", - "noremap": true, - "lhs": "du", - "mode": "n", - "rhs": "" - }, - { - "desc": "Reload Module", - "noremap": true, - "lhs": "cr", - "mode": "n", - "rhs": "" - }, - { - "desc": "Vertical Terminal", - "noremap": true, - "lhs": "tv", - "mode": "n", - "rhs": "" - }, - { - "desc": "Horizontal Terminal", - "noremap": true, - "lhs": "th", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle Terminal", - "noremap": true, - "lhs": "t1", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle Terminal", - "noremap": true, - "lhs": "t2", - "mode": "n", - "rhs": "" - }, - { - "desc": "toggle barbecue", - "noremap": true, - "lhs": "bq", - "mode": "n", - "rhs": "" - }, - { - "desc": "Find Notes", - "noremap": true, - "lhs": "ng", - "mode": "n", - "rhs": "" - }, - { - "desc": "All Notes", - "noremap": true, - "lhs": "nf", - "mode": "n", - "rhs": "" - }, - { - "desc": "Today's Entry", - "noremap": true, - "lhs": "ne", - "mode": "n", - "rhs": "" - }, - { - "desc": "Today's Todo", - "noremap": true, - "lhs": "nd", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle Todo", - "noremap": true, - "lhs": "nx", - "mode": "n", - "rhs": "" - }, - { - "desc": "Incomplete Todos", - "noremap": true, - "lhs": "nt", - "mode": "n", - "rhs": "" - }, - { - "desc": "New Note", - "noremap": true, - "lhs": "nn", - "mode": "n", - "rhs": "" - }, - { - "desc": "Tomorrow's Todo", - "noremap": true, - "lhs": "nl", - "mode": "n", - "rhs": "" - }, - { - "desc": "Yesterday's Todo", - "noremap": true, - "lhs": "nh", - "mode": "n", - "rhs": "" - }, - { - "desc": "Location List (Trouble)", - "noremap": true, - "lhs": "xL", - "mode": "n", - "rhs": "" - }, - { - "desc": "LSP references/definitions/... (Trouble)", - "noremap": true, - "lhs": "xS", - "mode": "n", - "rhs": "" - }, - { - "desc": "Symbols (Trouble)", - "noremap": true, - "lhs": "xs", - "mode": "n", - "rhs": "" - }, - { - "desc": "Buffer Diagnostics (Trouble)", - "noremap": true, - "lhs": "xX", - "mode": "n", - "rhs": "" - }, - { - "desc": "Diagnostics (Trouble)", - "noremap": true, - "lhs": "xx", - "mode": "n", - "rhs": "" - }, - { - "desc": "Quickfix List (Trouble)", - "noremap": true, - "lhs": "xQ", - "mode": "n", - "rhs": "" - }, - { - "desc": "Breakpoint", - "noremap": true, - "lhs": "bb", - "mode": "n", - "rhs": "" - }, - { - "desc": "Restart Frame", - "noremap": true, - "lhs": "bR", - "mode": "n", - "rhs": "" - }, - { - "desc": "Out", - "noremap": true, - "lhs": "bO", - "mode": "n", - "rhs": "" - }, - { - "desc": "Exit", - "noremap": true, - "lhs": "bx", - "mode": "n", - "rhs": "" - }, - { - "desc": "Debugger", - "noremap": true, - "lhs": "bt", - "mode": "n", - "rhs": "" - }, - { - "desc": "Repl", - "noremap": true, - "lhs": "br", - "mode": "n", - "rhs": "" - }, - { - "desc": "Over", - "noremap": true, - "lhs": "bo", - "mode": "n", - "rhs": "" - }, - { - "desc": "Last", - "noremap": true, - "lhs": "bl", - "mode": "n", - "rhs": "" - }, - { - "desc": "Into", - "noremap": true, - "lhs": "bi", - "mode": "n", - "rhs": "" - }, - { - "desc": "Continue", - "noremap": true, - "lhs": "bc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Relative Path", - "noremap": true, - "lhs": "yp", - "mode": "n", - "rhs": "" - }, - { - "desc": "Copy Git URL", - "noremap": true, - "lhs": "yg", - "mode": "n", - "rhs": "" - }, - { - "desc": "File Name", - "noremap": true, - "lhs": "yf", - "mode": "n", - "rhs": "" - }, - { - "desc": "Copy Whole File", - "noremap": true, - "lhs": "ya", - "mode": "n", - "rhs": "" - }, - { - "desc": "Absolute Path", - "noremap": true, - "lhs": "yP", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle zen mode", - "noremap": true, - "lhs": "wz", - "mode": "n", - "rhs": "" - }, - { - "desc": "Maximize/minimize a split", - "noremap": true, - "lhs": "mm", - "mode": "n", - "rhs": "" - }, - { - "desc": "Replace in Files (Spectre)", - "noremap": true, - "lhs": "mr", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle keys", - "noremap": true, - "lhs": "kt", - "mode": "n", - "rhs": "Screenkey" - }, - { - "desc": " Insert Macro Breakpoint.", - "noremap": true, - "lhs": "##", - "mode": "n", - "rhs": "" - }, - { - "desc": ":help v_#-default", - "noremap": true, - "lhs": "#", - "mode": "x", - "rhs": "" - }, - { - "desc": ":help &-default", - "noremap": true, - "lhs": "&", - "mode": "n", - "rhs": ":&&" - }, - { - "desc": ":help v_star-default", - "noremap": true, - "lhs": "*", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": ",", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": ",", - "mode": "n", - "rhs": "" - }, - { "desc": "", "noremap": true, "lhs": "-", "mode": "x", "rhs": "" }, - { - "desc": "", - "noremap": true, - "lhs": "-", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": ";", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": ";", - "mode": "n", - "rhs": "" - }, - { "desc": "", "noremap": true, "lhs": "<", "mode": "v", "rhs": "gv" }, - { "desc": "", "noremap": true, "lhs": "=", "mode": "x", "rhs": "" }, - { "desc": "", "noremap": true, "lhs": "=", "mode": "n", "rhs": "" }, - { "desc": "", "noremap": true, "lhs": ">", "mode": "v", "rhs": ">gv" }, - { - "desc": ":help v_@-default", - "noremap": true, - "lhs": "@", - "mode": "x", - "rhs": "mode() ==# 'V' ? ':normal! @'.getcharstr().'' : '@'" - }, - { - "desc": "", - "noremap": true, - "lhs": "F", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "F", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "J", - "mode": "x", - "rhs": ":move '>+1gv-gv" - }, - { "desc": "", "noremap": true, "lhs": "J", "mode": "n", "rhs": "mzJ`z" }, - { - "desc": "LSP Hover", - "noremap": true, - "lhs": "K", - "mode": "n", - "rhs": "Lspsaga hover_doc" - }, - { - "desc": "", - "noremap": true, - "lhs": "K", - "mode": "x", - "rhs": ":move '-2gv-gv" - }, - { - "desc": "Prev search result", - "noremap": true, - "lhs": "N", - "mode": "x", - "rhs": "'nN'[v:searchforward]" - }, - { - "desc": "Prev search result", - "noremap": true, - "lhs": "N", - "mode": "n", - "rhs": "'nN'[v:searchforward]" - }, - { - "desc": "Put yanked text before cursor", - "noremap": true, - "lhs": "P", - "mode": "n", - "rhs": "" - }, - { - "desc": "Put yanked text before cursor", - "noremap": true, - "lhs": "P", - "mode": "x", - "rhs": "" - }, - { - "desc": " Play Macro", - "noremap": true, - "lhs": "Q", - "mode": "n", - "rhs": "" - }, - { - "desc": ":help v_Q-default", - "noremap": true, - "lhs": "Q", - "mode": "x", - "rhs": "mode() ==# 'V' ? ':normal! @=reg_recorded()' : 'Q'" - }, - { - "desc": "", - "noremap": true, - "lhs": "T", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "T", - "mode": "n", - "rhs": "" - }, - { - "desc": "Redo", - "noremap": true, - "lhs": "U", - "mode": "n", - "rhs": "redo" - }, - { - "desc": ":help Y-default", - "noremap": true, - "lhs": "Y", - "mode": "n", - "rhs": "y$" - }, - { - "desc": "First Buffer", - "noremap": true, - "lhs": "[B", - "mode": "n", - "rhs": "bfirst" - }, - { - "desc": "Buffer", - "noremap": true, - "lhs": "[b", - "mode": "n", - "rhs": "bprevious" - }, - { - "desc": "Diagnostic", - "noremap": true, - "lhs": "[d", - "mode": "n", - "rhs": "Lspsaga diagnostic_jump_prev" - }, - { "desc": "Edit", "noremap": true, "lhs": "[e", "mode": "n", "rhs": "g;" }, - { - "desc": "Jump", - "noremap": true, - "lhs": "[j", - "mode": "n", - "rhs": "" - }, - { - "desc": "Previous Trouble/Quickfix Item", - "noremap": true, - "lhs": "[q", - "mode": "n", - "rhs": "" - }, - { - "desc": "Buffer", - "noremap": true, - "lhs": "]B", - "mode": "n", - "rhs": "blast" - }, - { - "desc": "Buffer", - "noremap": true, - "lhs": "]b", - "mode": "n", - "rhs": "bnext" - }, - { - "desc": "Diagnostic", - "noremap": true, - "lhs": "]d", - "mode": "n", - "rhs": "Lspsaga diagnostic_jump_next" - }, - { "desc": "Edit", "noremap": true, "lhs": "]e", "mode": "n", "rhs": "g," }, - { - "desc": "Jump", - "noremap": true, - "lhs": "]j", - "mode": "n", - "rhs": "" - }, - { - "desc": "Next Trouble/Quickfix Item", - "noremap": true, - "lhs": "]q", - "mode": "n", - "rhs": "" - }, - { - "desc": " Edit Macro", - "noremap": true, - "lhs": "cq", - "mode": "n", - "rhs": "" - }, - { - "desc": " Delete All Macros", - "noremap": true, - "lhs": "dq", - "mode": "n", - "rhs": "" - }, - { - "desc": "Don't Yank Empty Line to Clipboard", - "noremap": true, - "lhs": "dd", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "f", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "f", - "mode": "n", - "rhs": "" - }, - { - "desc": "Put yanked text after selection", - "noremap": true, - "lhs": "gp", - "mode": "n", - "rhs": "" - }, - { - "desc": "Put yanked text before selection", - "noremap": true, - "lhs": "gP", - "mode": "n", - "rhs": "" - }, - { - "desc": "Put yanked text before selection", - "noremap": true, - "lhs": "gP", - "mode": "x", - "rhs": "" - }, - { - "desc": "Put yanked text after selection", - "noremap": true, - "lhs": "gp", - "mode": "x", - "rhs": "" - }, - { - "desc": "Beginning of line", - "noremap": true, - "lhs": "gh", - "mode": "x", - "rhs": "^" - }, - { - "desc": "Beginning of line", - "noremap": true, - "lhs": "gh", - "mode": "n", - "rhs": "^" - }, - { - "desc": "End of line", - "noremap": true, - "lhs": "gl", - "mode": "x", - "rhs": "$" - }, - { - "desc": "End of line", - "noremap": true, - "lhs": "gl", - "mode": "n", - "rhs": "$" - }, - { - "desc": "Toggle comment line", - "noremap": true, - "lhs": "gcc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Toggle comment", - "noremap": true, - "lhs": "gc", - "mode": "x", - "rhs": "" - }, - { - "desc": "Toggle comment", - "noremap": true, - "lhs": "gc", - "mode": "n", - "rhs": "" - }, - { - "desc": "Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)", - "noremap": true, - "lhs": "gx", - "mode": "x", - "rhs": "" - }, - { - "desc": "Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)", - "noremap": true, - "lhs": "gx", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "j", - "mode": "n", - "rhs": "v:count == 0 ? 'gj' : 'j'" - }, - { - "desc": "", - "noremap": true, - "lhs": "k", - "mode": "n", - "rhs": "v:count == 0 ? 'gk' : 'k'" - }, - { - "desc": "Next search result", - "noremap": true, - "lhs": "n", - "mode": "x", - "rhs": "'Nn'[v:searchforward]" - }, - { - "desc": "Next search result", - "noremap": true, - "lhs": "n", - "mode": "n", - "rhs": "'Nn'[v:searchforward]" - }, - { - "desc": "Put yanked text after cursor", - "noremap": true, - "lhs": "p", - "mode": "n", - "rhs": "" - }, - { - "desc": "Put yanked text after cursor", - "noremap": true, - "lhs": "p", - "mode": "x", - "rhs": "" - }, - { - "desc": " Start/Stop Recording", - "noremap": true, - "lhs": "q", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "t", - "mode": "x", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "t", - "mode": "n", - "rhs": "" - }, - { "desc": "", "noremap": true, "lhs": "x", "mode": "x", "rhs": "\"_x" }, - { - "desc": " Yank Macro", - "noremap": true, - "lhs": "yq", - "mode": "n", - "rhs": "" - }, - { - "desc": "Yank text", - "noremap": true, - "lhs": "y", - "mode": "n", - "rhs": "" - }, - { - "desc": "Yank text", - "noremap": true, - "lhs": "y", - "mode": "x", - "rhs": "" - }, - { - "desc": " Switch Macro Slot", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "Previous Buffer", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "bprevious" - }, - { - "desc": "Find browser", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "Telescope file_browser" - }, - { - "desc": "Find Files", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "Telescope find_files" - }, - { - "desc": "Increase window height", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "resize +10" - }, - { - "desc": "Increase window width", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "vertical resize +10" - }, - { - "desc": "Decrease window width", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "vertical resize -10" - }, - { - "desc": "Decrease window height", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "resize -10" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "zz" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "zz" - }, - { "desc": "", "noremap": true, "lhs": "", "mode": "n", "rhs": "ggVG" }, - { - "desc": "Show diagnostics under the cursor", - "noremap": false, - "lhs": "", - "mode": "n", - "rhs": "d" - }, - { - "desc": "Show diagnostics under the cursor", - "noremap": true, - "lhs": "d", - "mode": "n", - "rhs": "" - }, - { - "desc": "", - "noremap": true, - "lhs": "", - "mode": "n", - "rhs": "" - } - ], - "treesitterParsers": [ - "bash", - "c", - "cpp", - "css", - "html", - "java", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "scss", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc" - ], - "lspServers": [ - "bashls", - "clangd", - "cssls", - "html", - "lua_ls", - "pyright", - "svelte", - "tailwindcss", - "tsserver" - ], - "leaderKey": "" -} diff --git a/init.lua b/init.lua index ee117dc..10b4a2b 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ -require('core.keymaps') require('core.options') require('core.functions') -require('core.lazy') +require('core.keys') require('core.autocmd') +require('core.lazy') diff --git a/lua/configs/alpha.lua b/lua/configs/alpha.lua deleted file mode 100644 index 8172ed1..0000000 --- a/lua/configs/alpha.lua +++ /dev/null @@ -1,76 +0,0 @@ --- Header -local function header() - local banner_small = { - ' ', - ' ', - ' ', - ' ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ', - ' ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ', - ' ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ', - ' ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ', - ' ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ', - ' ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ', - ' ', - ' With experience comes perspective ', - } - - return banner_small -end --- Footer -local function footer() - local version = vim.version() - local print_version = 'v' .. version.major .. '.' .. version.minor .. '.' .. version.patch - local stats = require('lazy').stats() - local plugins_count = stats.loaded .. '/' .. stats.count - local ms = math.floor(stats.startuptime + 0.5) - local time = vim.fn.strftime('%H:%M:%S') - local date = vim.fn.strftime('%d.%m.%Y') - local line1 = ' ' .. plugins_count .. ' plugins loaded in ' .. ms .. 'ms' - local line2 = '󰃭 ' .. date .. '  ' .. time - local line3 = ' ' .. print_version - - -- Calculate padding for centering lines - local line1_width = vim.fn.strdisplaywidth(line1) - local line2_padding = math.max(0, math.floor((line1_width - vim.fn.strdisplaywidth(line2)) / 2)) - local line3_padding = math.max(0, math.floor((line1_width - vim.fn.strdisplaywidth(line3)) / 2)) - - -- Apply padding to lines - line2 = string.rep(' ', line2_padding) .. line2 - line3 = string.rep(' ', line3_padding) .. line3 - - return { - ' ', - line1, - line2, - line3, - } -end -local alpha = require('alpha') -local dashboard = require('alpha.themes.dashboard') - -dashboard.section.header.val = header() -dashboard.section.footer.val = footer() - --- Menu --- TODO: Add projects and Frecency? -dashboard.section.buttons.val = { - dashboard.button('e', ' New file', ':ene startinsert'), - dashboard.button('f', ' Find files', 'Telescope find_files'), - dashboard.button('t', '󰊄 Find text', 'Telescope live_grep'), - dashboard.button('F', ' File browser', 'Telescope file_browser'), - dashboard.button('r', '󰔠 Recent files', 'Telescope oldfiles'), - dashboard.button('s', ' Open last session', ':lua require("persistence").load({ last = true })'), - dashboard.button('c', ' Config', 'e $MYVIMRC'), - dashboard.button('l', ' Plugins', 'Lazy'), - dashboard.button('q', ' Quit', 'qa'), -} - -alpha.setup(dashboard.config) --- Update the footer after all plugins are fully loaded -vim.api.nvim_create_autocmd('User', { - pattern = 'LazyVimStarted', - callback = function() - dashboard.section.footer.val = footer() - pcall(vim.cmd, 'AlphaRedraw') - end, -}) diff --git a/lua/configs/dashboard.lua b/lua/configs/dashboard.lua new file mode 100644 index 0000000..6866abc --- /dev/null +++ b/lua/configs/dashboard.lua @@ -0,0 +1,73 @@ +local dashboard = require("dashboard") +local icons = require("lib.icons") + +dashboard.setup({ + theme = "hyper", + disable_move = false, + shortcut_type = "letter", + change_to_vcs_root = true, + hide = { + statusline = true, + tabline = false, + winbar = false, + }, + config = { + week_header = { + enable = true, + append = { "", icons.ui.Circle .. " Learn, Make, Explore! " .. icons.ui.Circle }, + }, + packages = { enable = true }, + project = { enable = true, limit = 8 }, + mru = { limit = 8 }, + shortcut = { + { + desc = icons.ui.Package .. "Mason", + group = "@property", + action = "Mason", + key = "m", + }, + { + desc = icons.ui.Sleep .. "Lazy", + group = "@property", + action = "Lazy", + key = "l", + }, + { + desc = icons.documents.OpenFolder .. "Files", + group = "Label", + action = "Telescope find_files", + key = "f", + }, + { + desc = icons.ui.Search .. "Search", + group = "Label", + action = "Telescope live_grep", + key = "g", + }, + { + desc = icons.ui.Note .. "Todo", + group = "Label", + action = "Tdo", + key = "d", + }, + { + desc = icons.ui.Power, + group = "Action", + action = "quit", + key = "q", + }, + }, + footer = { "", icons.ui.Heart .. " Happiness is a state of mind. " .. icons.ui.Heart }, + }, +}) + +-- Show dashboard when lazy closes +if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "DashboardLoaded", + callback = function() + require("lazy").show() + end, + }) +end diff --git a/lua/configs/lsp.lua b/lua/configs/lsp.lua index 1feb91b..503e339 100644 --- a/lua/configs/lsp.lua +++ b/lua/configs/lsp.lua @@ -1,172 +1,160 @@ -local lspconfig = require('lspconfig') +local lspconfig = require("lspconfig") -- import cmp-nvim-lsp plugin -local cmp_nvim_lsp = require('cmp_nvim_lsp') +local cmp_nvim_lsp = require("cmp_nvim_lsp") local keymap = vim.keymap -- for conciseness -vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) - -- Buffer local mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local opts = { buffer = ev.buf, silent = true } +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf, silent = true } - -- set keybinds - opts.desc = 'Show LSP references' - keymap.set('n', 'lR', 'Telescope lsp_references', opts) -- show definition, references + -- set keybinds + opts.desc = "Show LSP references" + keymap.set("n", "lR", "Telescope lsp_references", opts) -- show definition, references - opts.desc = 'Go to declaration' - keymap.set('n', 'lD', vim.lsp.buf.declaration, opts) -- go to declaration + opts.desc = "Go to declaration" + keymap.set("n", "lD", vim.lsp.buf.declaration, opts) -- go to declaration - opts.desc = 'Show LSP definitions' - keymap.set('n', 'ld', 'Telescope lsp_definitions', opts) -- show lsp definitions + opts.desc = "Show LSP definitions" + keymap.set("n", "ld", "Telescope lsp_definitions", opts) -- show lsp definitions - opts.desc = 'Show LSP implementations' - keymap.set('n', 'li', 'Telescope lsp_implementations', opts) -- show lsp implementations + opts.desc = "Show LSP implementations" + keymap.set("n", "li", "Telescope lsp_implementations", opts) -- show lsp implementations - opts.desc = 'Show LSP type definitions' - keymap.set('n', 'lt', 'Telescope lsp_type_definitions', opts) -- show lsp type definitions + opts.desc = "Show LSP type definitions" + keymap.set("n", "lt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions - opts.desc = 'See available code actions' - keymap.set({ 'n', 'v' }, 'la', vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "la", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection - opts.desc = 'Smart rename' - keymap.set('n', 'mr', vim.lsp.buf.rename, opts) -- smart rename + opts.desc = "Smart rename" + keymap.set("n", "mr", vim.lsp.buf.rename, opts) -- smart rename - opts.desc = 'Show buffer diagnostics' - keymap.set('n', 'lD', 'Telescope diagnostics bufnr=0', opts) -- show diagnostics for file + opts.desc = "Show buffer diagnostics" + keymap.set("n", "lD", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file - opts.desc = 'Show line diagnostics' - keymap.set('n', 'ld', vim.diagnostic.open_float, opts) -- show diagnostics for line + opts.desc = "Show line diagnostics" + keymap.set("n", "ld", vim.diagnostic.open_float, opts) -- show diagnostics for line - opts.desc = 'Show documentation for what is under cursor' - keymap.set('n', 'K', vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor - opts.desc = 'Restart LSP' - keymap.set('n', 'ls', ':LspRestart', opts) -- mapping to restart lsp if necessary - end, + opts.desc = "Restart LSP" + keymap.set("n", "ls", ":LspRestart", opts) -- mapping to restart lsp if necessary + end, }) -- used to enable autocompletion (assign to every lsp server config) local capabilities = cmp_nvim_lsp.default_capabilities() -- configure matlab server -lspconfig['clangd'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["clangd"].setup({ + capabilities = capabilities, }) -- configure bash server -lspconfig['bashls'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["bashls"].setup({ + capabilities = capabilities, }) -- configure html server -lspconfig['html'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["html"].setup({ + capabilities = capabilities, }) -- configure typescript server with plugin -lspconfig['tsserver'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["tsserver"].setup({ + capabilities = capabilities, }) -- configure css server -lspconfig['cssls'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["cssls"].setup({ + capabilities = capabilities, }) -- configure tailwindcss server -lspconfig['tailwindcss'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["tailwindcss"].setup({ + capabilities = capabilities, }) -- configure svelte server -lspconfig['svelte'].setup({ - capabilities = capabilities, - on_attach = function(client, bufnr) - on_attach(client, bufnr) - - vim.api.nvim_create_autocmd('BufWritePost', { - pattern = { '*.js', '*.ts' }, - callback = function(ctx) - if client.name == 'svelte' then - client.notify('$/onDidChangeTsOrJsFile', { uri = ctx.file }) - end - end, - }) - end, +lspconfig["svelte"].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "*.js", "*.ts" }, + callback = function(ctx) + if client.name == "svelte" then + client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file }) + end + end, + }) + end, }) -- configure prisma orm server -lspconfig['prismals'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["prismals"].setup({ + capabilities = capabilities, }) -- configure emmet language server -lspconfig['emmet_ls'].setup({ - capabilities = capabilities, - on_attach = on_attach, - filetypes = { 'html', 'typescriptreact', 'javascriptreact', 'css', 'sass', 'scss', 'less', 'svelte' }, +lspconfig["emmet_ls"].setup({ + capabilities = capabilities, + filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, }) -- configure python server -lspconfig['pyright'].setup({ - capabilities = capabilities, - on_attach = on_attach, +lspconfig["pyright"].setup({ + capabilities = capabilities, }) -- configure lua server (with special settings) -lspconfig['lua_ls'].setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { -- custom settings for lua - Lua = { - -- make the language server recognize "vim" global - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - -- make language server aware of runtime files - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.stdpath('config') .. '/lua'] = true, - }, - }, - }, - }, +lspconfig["lua_ls"].setup({ + capabilities = capabilities, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, }) local x = vim.diagnostic.severity local config = { - -- Enable virtual text - virtual_text = { -- or false for disable - prefix = '', -- ■  󰊠 - suffix = '', - format = function(diagnostic) - local prefix = '󰊠 ' - local suffix = ' ' - -- return full message with custom prefix & suffix - return prefix .. diagnostic.message .. suffix - end, - }, - update_in_insert = true, - signs = { text = { [x.ERROR] = '', [x.WARN] = '', [x.HINT] = '󰌵', [x.INFO] = '' } }, - underline = false, - severity_sort = true, - float = { - focusable = false, - style = 'minimal', - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, + -- Enable virtual text + virtual_text = { -- or false for disable + prefix = "", -- ■  󰊠 + suffix = "", + format = function(diagnostic) + local prefix = "󰊠 " + local suffix = " " + -- return full message with custom prefix & suffix + return prefix .. diagnostic.message .. suffix + end, + }, + update_in_insert = true, + signs = { text = { [x.ERROR] = "", [x.WARN] = "", [x.HINT] = "󰌵", [x.INFO] = "" } }, + underline = false, + severity_sort = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, } vim.diagnostic.config(config) -- add borders to lsp info window -require('lspconfig.ui.windows').default_options.border = 'single' +require("lspconfig.ui.windows").default_options.border = "single" diff --git a/lua/configs/lualine.lua b/lua/configs/lualine.lua index 44e0cba..2dcbcdd 100644 --- a/lua/configs/lualine.lua +++ b/lua/configs/lualine.lua @@ -1,25 +1,50 @@ local lualine = require('lualine') +local icons = require('lib.icons') --- Color table for highlights - -- stylua: ignore - local colors = { - bg = 'none', - fg = '#bbc2cf', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - green = '#98be65', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#51afef', - red = '#ec5f67', - } +local colors = { + bg = '#202328', + fg = '#bbc2cf', + yellow = '#ECBE7B', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#FF8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', +} + +local mode_color = { + n = colors.green, + i = colors.blue, + v = colors.magenta, + [''] = colors.magenta, + V = colors.magenta, + c = colors.yellow, + t = colors.red, + R = colors.orange, + Rv = colors.orange, + no = colors.fg, + s = colors.violet, + S = colors.violet, + [''] = colors.violet, + ic = colors.yellow, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, +} local conditions = { buffer_not_empty = function() return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end, + buffer_is_file = function() + return vim.bo.buftype == '' + end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, @@ -29,170 +54,143 @@ local conditions = { return gitdir and #gitdir > 0 and #gitdir < #filepath end, } +local searchcount = { 'searchcount', color = { fg = colors.fg, gui = 'bold' } } +local selectioncount = { 'selectioncount', color = { fg = colors.fg, gui = 'bold' } } +local progress = { 'progress', color = { fg = colors.fg, gui = 'bold' } } +local filetype = { 'filetype', color = { fg = colors.blue, gui = 'bold' } } +local filesize = { 'filesize', color = { fg = colors.fg, gui = 'bold' }, cond = conditions.buffer_not_empty } +local fileformat = { 'fileformat', icons_enabled = true, color = { fg = colors.white, gui = 'bold' } } --- Config -local config = { - options = { - -- Disable sections and component separators - component_separators = '', - section_separators = '', - disabled_filetypes = { - 'NeoTree', - 'NvimTree', - 'Outline', - 'alpha', - }, - theme = { - -- We are going to use lualine_c an lualine_x as left and - -- right section. Both are highlighted by c theme . So we - -- are just setting default looks o statusline - normal = { c = { fg = colors.fg, bg = colors.bg } }, - inactive = { c = { fg = colors.fg, bg = colors.bg } }, - }, - }, - sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - -- These will be filled later - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, +local filename = { + 'filename', + cond = conditions.buffer_not_empty and conditions.buffer_is_file, + color = { fg = colors.magenta, gui = 'bold' }, } --- Inserts a component in lualine_c at left section -local function ins_left(component) - table.insert(config.sections.lualine_c, component) -end - --- Inserts a component in lualine_x at right section -local function ins_right(component) - table.insert(config.sections.lualine_x, component) -end - -ins_left({ - function() - return '▊' - end, - color = { fg = colors.blue }, -- Sets highlighting of component - padding = { left = 0, right = 1 }, -- We don't need space before this -}) - -ins_left({ - -- mode component - function() - return '' - end, - color = function() - -- auto change color according to neovims mode - local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - ['␖'] = colors.blue, - V = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - S = colors.orange, - ['␓'] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red, - } - return { fg = mode_color[vim.fn.mode()] } - end, - padding = { right = 1 }, -}) - -ins_left({ - 'filename', - cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = 'bold' }, -}) - -ins_left({ - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = ' ', warn = ' ', info = ' ' }, - diagnostics_color = { - error = { fg = colors.red }, - warn = { fg = colors.yellow }, - info = { fg = colors.cyan }, +local buffers = { + 'buffers', + filetype_names = { + TelescopePrompt = icons.ui.Telescope .. 'Telescope', + dashboard = icons.ui.Dashboard .. 'Dashboard', + lazy = icons.ui.Sleep .. 'Lazy', + mason = icons.ui.Package .. 'Mason', + NvimTree = icons.documents.OpenFolder .. 'Files', + spectre_panel = icons.ui.Search .. 'Spectre', }, -}) + use_mode_colors = true, +} --- Insert mid section. You can make any number of sections in neovim :) --- for lualine it's any number greater then 2 -ins_left({ - function() - return '%=' +local branch = { + 'branch', + icon = icons.git.Branch, + fmt = function(str) + return str:sub(1, 32) end, -}) + color = { fg = colors.green, gui = 'bold' }, +} -ins_left({ - -- Lsp server name . - function() - local msg = 'No Active Lsp' - local clients = vim.lsp.get_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes) ~= -1 then - return client.name - end - end - return msg - end, - icon = ' LSP:', - color = { fg = '#ffffff', gui = 'bold' }, -}) - -ins_right({ +local diff_icons = { 'diff', - -- Is it me or the symbol for modified us really weird - symbols = { added = ' ', modified = ' ', removed = ' ' }, + symbols = { added = icons.git.AddAlt, modified = icons.git.DiffAlt, removed = icons.git.RemoveAlt }, diff_color = { added = { fg = colors.green }, modified = { fg = colors.orange }, removed = { fg = colors.red }, }, cond = conditions.hide_in_width, -}) +} -ins_right({ - 'branch', - icon = '', - color = { fg = colors.violet, gui = 'bold' }, -}) +local diagnostics = { + 'diagnostics', + sources = { 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic' }, + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warning, + info = icons.diagnostics.Information, + hint = icons.diagnostics.Hint, + }, + diagnostics_color = { + color_error = { fg = colors.red }, + color_warn = { fg = colors.yellow }, + color_info = { fg = colors.blue }, + color_hint = { fg = colors.yellow }, + }, +} -ins_right({ +local lsp = { function() - return '▊' + local msg = 'No LSP' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg end, - color = { fg = colors.blue }, - padding = { left = 1 }, -}) + icon = icons.ui.Gear, + color = { fg = colors.fg, gui = 'bold' }, +} --- Now don't forget to initialize lualine -lualine.setup(config) +local encoding = { + 'o:encoding', + fmt = string.upper, + cond = conditions.hide_in_width, + color = { fg = colors.green, gui = 'bold' }, +} + +local separator = { + function() + return icons.ui.Separator + end, + color = function() + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { left = 0, right = 0 }, +} + +local function mode(icon) + icon = icon or icons.ui.Neovim + return { + function() + return icon + end, + color = function() + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { left = 1, right = 0 }, + } +end + +lualine.setup({ + options = { + component_separators = '', + -- section_separators = '', + theme = 'onedark', + disabled_filetypes = { + 'dashboard', + }, + }, + -- extensions = { 'quickfix', 'man', 'mason', 'lazy', 'toggleterm', 'nvim-tree' }, + tabline = { + lualine_a = {}, + lualine_b = { mode(), buffers }, + lualine_c = {}, + lualine_x = { diff_icons, branch }, + lualine_y = { searchcount, selectioncount }, + lualine_z = {}, + }, + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { separator, mode(icons.ui.Heart), 'location', progress, filename }, + lualine_x = { diagnostics, lsp, filetype, filesize, fileformat, encoding, separator }, + lualine_y = {}, + lualine_z = {}, + }, +}) diff --git a/lua/configs/mason.lua b/lua/configs/mason.lua index 5a2e78a..141abed 100644 --- a/lua/configs/mason.lua +++ b/lua/configs/mason.lua @@ -1,47 +1,48 @@ -local mason = require('mason') -local mason_lspconfig = require('mason-lspconfig') -local mason_tool_installer = require('mason-tool-installer') +local mason = require("mason") +local mason_lspconfig = require("mason-lspconfig") +local mason_tool_installer = require("mason-tool-installer") -- enable mason and configure icons mason.setup({ - ui = { - border = 'rounded', - icons = { - package_installed = '✓', - package_pending = '➜', - package_uninstalled = '✗', - }, - }, + automatic_installation = true, + ui = { + border = "rounded", + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, }) mason_lspconfig.setup({ - -- list of servers for mason to install - ensure_installed = { - 'tsserver', - 'html', - 'cssls', - 'tailwindcss', - 'svelte', - 'lua_ls', - 'pyright', - 'jdtls', - 'bashls', - 'jsonls', - 'clangd', - 'emmet_ls', - 'prismals', - }, + -- list of servers for mason to install + ensure_installed = { + "tsserver", + "html", + "cssls", + "tailwindcss", + "svelte", + "lua_ls", + "pyright", + "jdtls", + "bashls", + "jsonls", + "clangd", + "emmet_ls", + "prismals", + }, }) mason_tool_installer.setup({ - ensure_installed = { - 'prettier', -- prettier formatter - 'biome', -- js formatter - 'stylua', -- lua formatter - 'black', -- python formatter - 'isort', -- python formatter - 'clang-format', -- c/c++ formatter - 'pylint', - 'eslint_d', - }, + ensure_installed = { + "prettier", -- prettier formatter + "biome", -- js formatter + "stylua", -- lua formatter + "black", -- python formatter + "isort", -- python formatter + "clang-format", -- c/c++ formatter + "pylint", + "eslint_d", + }, }) diff --git a/lua/configs/none-ls.lua b/lua/configs/none-ls.lua index ffff12a..5477207 100644 --- a/lua/configs/none-ls.lua +++ b/lua/configs/none-ls.lua @@ -1,19 +1,19 @@ -local mason_null_ls = require('mason-null-ls') +local mason_null_ls = require("mason-null-ls") -local null_ls = require('null-ls') +local null_ls = require("null-ls") -local null_ls_utils = require('null-ls.utils') +local null_ls_utils = require("null-ls.utils") mason_null_ls.setup({ - ensure_installed = { - 'prettier', -- prettier formatter - 'biome', -- js formatter - 'clang-format', -- c/c++ formatter - 'stylua', -- lua formatter - 'black', -- python formatter - 'pylint', -- python linter - -- "eslint_d", -- js linter - }, + ensure_installed = { + "prettier", -- prettier formatter + "biome", -- js formatter + "clang-format", -- c/c++ formatter + "stylua", -- lua formatter + "black", -- python formatter + "pylint", -- python linter + -- "eslint_d", -- js linter + }, }) -- for conciseness @@ -21,41 +21,41 @@ local formatting = null_ls.builtins.formatting -- to setup formatters local diagnostics = null_ls.builtins.diagnostics -- to setup linters -- to setup format on save -local augroup = vim.api.nvim_create_augroup('LspFormatting', {}) +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) -- configure null_ls null_ls.setup({ - root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git', 'package.json'), - sources = { - formatting.prettier, -- js/ts formatter - formatting.stylua, -- lua formatter - formatting.isort, - formatting.black, - formatting.clang_format, - diagnostics.pylint, - -- diagnostics.eslint_d.with({ -- js/ts linter - -- condition = function(utils) - -- return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs - -- end, - -- }), - }, - -- configure format on save - on_attach = function(current_client, bufnr) - if current_client.supports_method('textDocument/formatting') then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd('BufWritePre', { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ - filter = function(client) - -- only use null-ls for formatting instead of lsp server - return client.name == 'null-ls' - end, - bufnr = bufnr, - }) - end, - }) - end - end, + root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"), + sources = { + formatting.prettier, -- js/ts formatter + formatting.stylua, -- lua formatter + formatting.isort, + formatting.black, + formatting.clang_format, + diagnostics.pylint, + -- diagnostics.eslint_d.with({ -- js/ts linter + -- condition = function(utils) + -- return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs + -- end, + -- }), + }, + -- configure format on save + on_attach = function(current_client, bufnr) + if current_client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + filter = function(client) + -- only use null-ls for formatting instead of lsp server + return client.name == "null-ls" + end, + bufnr = bufnr, + }) + end, + }) + end + end, }) diff --git a/lua/core/autocmd.lua b/lua/core/autocmd.lua index 523e42f..788db00 100644 --- a/lua/core/autocmd.lua +++ b/lua/core/autocmd.lua @@ -1,161 +1,105 @@ local function augroup(name) - return vim.api.nvim_create_augroup('nvim2k_' .. name, { clear = true }) + return vim.api.nvim_create_augroup("nvim" .. name, { clear = true }) end --- don't auto comment new line -vim.api.nvim_create_autocmd('BufEnter', { command = [[set formatoptions-=cro]] }) - --- to make border as same as neovim ColorScheme -vim.api.nvim_create_autocmd({ 'UIEnter', 'ColorScheme' }, { - callback = function() - local normal = vim.api.nvim_get_hl(0, { name = 'Normal' }) - if not normal.bg then - return - end - io.write(string.format('\027Ptmux;\027\027]11;#%06x\007\027\\', normal.bg)) - io.write(string.format('\027]11;#%06x\027\\', normal.bg)) - end, -}) - -vim.api.nvim_create_autocmd('UILeave', { - callback = function() - io.write('\027Ptmux;\027\027]111;\007\027\\') - io.write('\027]111\027\\') - end, -}) - --- Highlight on yank -vim.api.nvim_create_autocmd('TextYankPost', { - group = augroup('highlight_yank'), - callback = function() - vim.highlight.on_yank() - end, -}) - --- go to last loc when opening a buffer --- this mean that when you open a file, you will be at the last position -vim.api.nvim_create_autocmd('BufReadPost', { - callback = function() - local mark = vim.api.nvim_buf_get_mark(0, '"') - local lcount = vim.api.nvim_buf_line_count(0) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end - end, -}) - --- auto close brackets -vim.api.nvim_create_autocmd('FileType', { pattern = 'man', command = [[nnoremap q :quit]] }) - --- show cursor line only in active window -local cursorGrp = vim.api.nvim_create_augroup('CursorLine', { clear = true }) -vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, { - pattern = '*', - command = 'set cursorline', - group = cursorGrp, -}) -vim.api.nvim_create_autocmd( - { 'InsertEnter', 'WinLeave' }, - { pattern = '*', command = 'set nocursorline', group = cursorGrp } -) - --- Enable spell checking for certain file types -vim.api.nvim_create_autocmd( - { 'BufRead', 'BufNewFile' }, - -- { pattern = { "*.txt", "*.md", "*.tex" }, command = [[setlocal spell setlocal spelllang=en,de]] } - { - pattern = { '*.txt', '*.md', '*.tex' }, - callback = function() - vim.opt.spell = true - vim.opt.spelllang = 'en,de' - end, - } -) - --- go to last loc when opening a buffer -vim.api.nvim_create_autocmd('BufReadPost', { - group = augroup('last_loc'), - callback = function() - local mark = vim.api.nvim_buf_get_mark(0, '"') - local lcount = vim.api.nvim_buf_line_count(0) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end - end, -}) - -- Strip trailing spaces before write -vim.api.nvim_create_autocmd({ 'BufWritePre' }, { - group = augroup('strip_space'), - pattern = { '*' }, - callback = function() - vim.cmd([[ %s/\s\+$//e ]]) - end, +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = augroup("strip_space"), + pattern = { "*" }, + callback = function() + vim.cmd([[ %s/\s\+$//e ]]) + end, }) -- Check if we need to reload the file when it changed -vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, { - group = augroup('checktime'), - command = 'checktime', +vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { + group = augroup("checktime"), + command = "checktime", +}) + +-- Highlight on yank +vim.api.nvim_create_autocmd("TextYankPost", { + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, }) -- resize splits if window got resized -vim.api.nvim_create_autocmd({ 'VimResized' }, { - group = augroup('resize_splits'), - callback = function() - vim.cmd('tabdo wincmd =') - end, +vim.api.nvim_create_autocmd({ "VimResized" }, { + group = augroup("resize_splits"), + callback = function() + vim.cmd("tabdo wincmd =") + end, }) --- wrap and check for spell in text filetypes -vim.api.nvim_create_autocmd('FileType', { - group = augroup('wrap_spell'), - pattern = { 'gitcommit', 'markdown' }, - callback = function() - vim.opt_local.wrap = true - vim.opt_local.spell = true - end, -}) - --- Auto create dir when saving a file, in case some intermediate directory does not exist -vim.api.nvim_create_autocmd({ 'BufWritePre' }, { - group = augroup('auto_create_dir'), - callback = function(event) - local file = vim.loop.fs_realpath(event.match) or event.match - vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p') - end, -}) - --- Set arb filetype -vim.api.nvim_create_autocmd({ 'BufEnter' }, { - group = augroup('set_file_type'), - pattern = { '*.arb' }, - command = require('core.util').get_file_type_cmd('arb'), +-- go to last loc when opening a buffer +vim.api.nvim_create_autocmd("BufReadPost", { + group = augroup("last_loc"), + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local lcount = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, }) -- close some filetypes with -vim.api.nvim_create_autocmd('FileType', { - group = vim.api.nvim_create_augroup('close_with_q', { clear = true }), - pattern = { - 'PlenaryTestPopup', - 'help', - 'lspinfo', - 'man', - 'notify', - 'qf', - 'spectre_panel', - 'startuptime', - 'tsplayground', - 'neotest-output', - 'checkhealth', - 'neotest-summary', - 'neotest-output-panel', - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - vim.keymap.set('n', 'q', 'close', { buffer = event.buf, silent = true }) - end, +vim.api.nvim_create_autocmd("FileType", { + group = augroup("close_with_q"), + pattern = { + "DressingSelect", + "Jaq", + "PlenaryTestPopup", + "fugitive", + "help", + "lir", + "lspinfo", + "man", + "notify", + "qf", + "spectre_panel", + "startuptime", + "tsplayground", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, }) --- resize neovim split when terminal is resized -vim.api.nvim_command('autocmd VimResized * wincmd =') +-- wrap and check for spell in text filetypes +vim.api.nvim_create_autocmd("FileType", { + group = augroup("wrap_spell"), + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) + +-- Auto create dir when saving a file, in case some intermediate directory does not exist +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = augroup("auto_create_dir"), + callback = function(event) + local file = vim.loop.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, +}) + +-- Set arb filetype +vim.api.nvim_create_autocmd({ "BufEnter" }, { + group = augroup("set_file_type"), + pattern = { "*.arb" }, + command = require("lib.util").get_file_type_cmd("arb"), +}) + +-- Disable format options +vim.api.nvim_create_autocmd("FileType", { + group = augroup("disable_formatoptions"), + pattern = "*", + callback = function() + vim.opt_local.formatoptions:remove({ "c", "r", "o" }) + end, +}) diff --git a/lua/core/functions.lua b/lua/core/functions.lua index e49a9fd..b2a1bce 100644 --- a/lua/core/functions.lua +++ b/lua/core/functions.lua @@ -30,7 +30,7 @@ end, {}) -- Switch to git root or file parent dir vim.api.nvim_create_user_command('RootDir', function() - local root = require('core.util').get_root_dir() + local root = require('lib.util').get_root_dir() if root == '' then return diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua deleted file mode 100644 index 0bc455f..0000000 --- a/lua/core/keymaps.lua +++ /dev/null @@ -1,75 +0,0 @@ -local function map(mode, lhs, rhs, opts) - opts = opts or {} - opts.silent = opts.silent ~= false - vim.keymap.set(mode, lhs, rhs, opts) -end -local opts = { noremap = true, silent = true } - --- Use jj as escape -map('i', 'jj', '', opts) -map('t', 'JJ', '', opts) - --- Visual overwrite paste -map({ 'v', 'x' }, 'p', '"_dP', opts) - --- Do not copy on x -map({ 'v', 'x' }, 'x', '"_x', opts) - --- Increment/decrement -map({ 'n', 'v', 'x' }, '-', '', opts) -map({ 'n', 'v', 'x' }, '=', '', opts) - --- Move to line beginning and end -map({ 'n', 'v', 'x' }, 'gl', '$', { desc = 'End of line' }) -map({ 'n', 'v', 'x' }, 'gh', '^', { desc = 'Beginning of line' }) - --- Select all -map('n', '', 'ggG') - --- Deleting without yanking empty line -map('n', 'dd', function() - local is_empty_line = vim.api.nvim_get_current_line():match('^%s*$') - if is_empty_line then - return '"_dd' - else - return 'dd' - end -end, { noremap = true, expr = true, desc = "Don't Yank Empty Line to Clipboard" }) - --- Center Cursors -map('n', 'J', 'mzJ`z', opts) -map('n', '', 'zz', opts) -map('n', '', 'zz', opts) -map('n', 'n', 'nzzzv', opts) -map('n', 'N', 'Nzzzv', opts) - --- Better up/down -map('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) - --- Move text up and down -map({ 'v', 'x' }, 'J', ":move '>+1gv-gv", opts) -map({ 'v', 'x' }, 'K', ":move '<-2gv-gv", opts) - --- Clear search, diff update and redraw -map({ 'i', 'n' }, '', 'noh', { desc = 'Escape and clear hlsearch' }) - --- Consistent n/N search navigation -map('n', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('n', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) -map('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) -map('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) - --- Better indenting -map('v', '<', '', '>gv') - --- Add undo breakpoints -map('i', ',', ',u') -map('i', '.', '.u') -map('i', ';', ';u') - -map({ 'i' }, '', '', { desc = 'Move cursor to right' }) -map({ 'i' }, '', '', { desc = 'Move cursor to right' }) diff --git a/lua/core/keys.lua b/lua/core/keys.lua new file mode 100644 index 0000000..fb4dfe5 --- /dev/null +++ b/lua/core/keys.lua @@ -0,0 +1,72 @@ +local function map(mode, lhs, rhs, opts) + opts = opts or {} + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) +end +local opts = { noremap = true, silent = true } + +-- Use jj as escape +map("i", "jj", "", opts) +map("t", "JJ", "", opts) + +-- Visual overwrite paste +map({ "v", "x" }, "p", '"_dP', opts) + +-- Do not copy on x +map({ "v", "x" }, "x", '"_x', opts) + +-- Increment/decrement +map({ "n", "v", "x" }, "-", "", opts) +map({ "n", "v", "x" }, "=", "", opts) + +-- Move to line beginning and end +map({ "n", "v", "x" }, "gl", "$", { desc = "End of line" }) +map({ "n", "v", "x" }, "gh", "^", { desc = "Beginning of line" }) + +-- Select all +map("n", "", "ggG") + +map("n", "", "up", { desc = "Save File" }) + +-- Center Cursors +map("n", "J", "mzJ`z", opts) +map("n", "", "zz", opts) +map("n", "", "zz", opts) +map("n", "n", "nzzzv", opts) +map("n", "N", "Nzzzv", opts) + +-- Better up/down +map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) + +-- Move text up and down +map({ "v", "x" }, "J", ":move '>+1gv-gv", opts) +map({ "v", "x" }, "K", ":move '<-2gv-gv", opts) + +-- Clear search, diff update and redraw +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) + +-- Consistent n/N search navigation +map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) + +-- Better indenting +map("v", "<", "", ">gv") + +-- Add undo breakpoints +map("i", ",", ",u") +map("i", ".", ".u") +map("i", ";", ";u") + +map({ "i" }, "", "", { desc = "Move cursor to right" }) +map({ "i" }, "", "", { desc = "Move cursor to right" }) + +map("n", "d", '"_d', { desc = "Delete without replacing clipboad" }) +map("n", "x", '"_x', { desc = "Cut without replacing clipboad" }) +map("n", "c", '"_c', { desc = "Change without replacing clipboad" }) +map("v", "p", '"_dP', { desc = "Paste without replacing clipboard" }) diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua index 7b2677e..226b06c 100644 --- a/lua/core/lazy.lua +++ b/lua/core/lazy.lua @@ -1,95 +1,108 @@ --- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' ----@diagnostic disable-next-line: undefined-field -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, - { out, 'WarningMsg' }, - { '\nPress any key to exit...' }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + 'git', + 'clone', + '--filter=blob:none', + '--single-branch', + 'https://github.com/folke/lazy.nvim.git', + lazypath, + }) end -vim.opt.rtp:prepend(lazypath) +vim.opt.runtimepath:prepend(lazypath) -require('lazy').setup({ - spec = { - { import = 'plugins' }, - }, - install = { - missing = true, - colorscheme = { 'moonfly' }, - }, - checker = { - enabled = true, - notify = false, - }, - change_detection = { - enabled = true, - notify = false, - }, - ui = { - icons = { - cmd = ' ', - config = ' ', - event = '', - ft = ' ', - init = ' ', - import = ' ', - keys = ' ', - lazy = '󰒲 ', - loaded = '●', - not_loaded = '○', - plugin = ' ', - runtime = ' ', - require = '󰢱 ', - source = ' ', - start = '', - task = '✔ ', - list = { - '●', - '➜', - '★', - '‒', - }, - }, - }, +local status_ok, lazy = pcall(require, 'lazy') +if not status_ok then + return +end + +local icons = require('lib.icons') + +lazy.setup({ + root = vim.fn.stdpath('data') .. '/lazy', + defaults = { lazy = true }, + spec = 'plugins', lockfile = vim.fn.stdpath('config') .. '/lua/lock.json', + concurrency = 8, + dev = { path = '~/Projects/GitHub/', patterns = {}, fallback = false }, + install = { missing = true, colorscheme = { 'onedark' } }, + + git = { + log = { '--since=3 days ago' }, + timeout = 120, + url_format = 'https://github.com/%s.git', + filter = true, + }, + + ui = { + size = { width = 0.9, height = 0.8 }, + wrap = true, + border = 'rounded', + icons = { + cmd = icons.ui.Terminal, + config = icons.ui.Gear, + event = icons.ui.Electric, + ft = icons.documents.File, + init = icons.ui.Rocket, + import = icons.documents.Import, + keys = icons.ui.Keyboard, + lazy = icons.ui.Sleep, + loaded = icons.ui.CircleSmall, + not_loaded = icons.ui.CircleSmallEmpty, + plugin = icons.ui.Package, + runtime = icons.ui.Neovim, + source = icons.ui.Code, + start = icons.ui.Play, + task = icons.ui.Check, + list = { + icons.ui.CircleSmall, + icons.ui.Arrow, + icons.ui.Star, + icons.ui.Minus, + }, + }, + browser = nil, + throttle = 20, + custom_keys = { + ['l'] = function(plugin) + require('lazy.util').float_term({ 'lazygit', 'log' }, { + cwd = plugin.dir, + }) + end, + + ['t'] = function(plugin) + require('lazy.util').float_term(nil, { + cwd = plugin.dir, + }) + end, + }, + }, + + diff = { cmd = 'git' }, + checker = { enabled = false, concurrency = nil, notify = true, frequency = 3600 }, + change_detection = { enabled = true, notify = true }, performance = { + cache = { enabled = true }, + reset_packpath = true, rtp = { + reset = true, + paths = {}, disabled_plugins = { - '2html_plugin', - 'tohtml', - 'getscript', - 'getscriptPlugin', 'gzip', - 'logipat', - 'netrw', - 'netrwPlugin', - 'netrwSettings', - 'netrwFileHandlers', - 'matchit', - 'tar', 'tarPlugin', - 'rrhelper', - 'spellfile_plugin', - 'vimball', - 'vimballPlugin', - 'zip', 'zipPlugin', - 'tutor', - 'rplugin', - 'syntax', - 'synmenu', - 'optwin', - 'compiler', - 'bugreport', - 'ftplugin', + 'tohtml', + -- 'tutor', + -- 'matchit', + -- 'matchparen', + -- 'netrwPlugin', }, }, }, + readme = { + root = vim.fn.stdpath('state') .. '/lazy/readme', + files = { 'README.md', 'lua/**/README.md' }, + skip_if_doc_exists = true, + }, + state = vim.fn.stdpath('state') .. '/lazy/state.json', }) diff --git a/lua/core/options.lua b/lua/core/options.lua index 90bed82..d793439 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -1,59 +1,92 @@ ---Remap space as leader key -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +vim.g.mapleader = " " +vim.g.maplocalleader = " " -vim.opt.backup = false -- creates a backup file -vim.opt.clipboard = 'unnamedplus' -- allows neovim to access the system clipboard -vim.opt.cmdheight = 0 -- more space in the neovim command line for displaying messages -vim.opt.completeopt = { 'menuone', 'noselect' } -- mostly just for cmp -vim.opt.conceallevel = 0 -- so that `` is visible in markdown files --- vim.opt.fileencoding = "utf-8" -- the encoding written to a file -vim.opt.hlsearch = true -- highlight all matches on previous search pattern -vim.opt.ignorecase = true -- ignore case in search patterns -vim.opt.mouse = 'a' -- allow the mouse to be used in neovim -vim.opt.pumheight = 10 -- pop up menu height -vim.opt.pumblend = 10 -vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore -vim.opt.showtabline = 2 -- always show tabs -vim.opt.smartcase = true -- smart case -vim.opt.smartindent = true -- make indenting smarter again -vim.opt.splitbelow = true -- force all horizontal splits to go below current window -vim.opt.splitright = true -- force all vertical splits to go to the right of current window -vim.opt.swapfile = false -- creates a swapfile -vim.opt.termguicolors = true -- set term gui colors (most terminals support this) -vim.opt.timeoutlen = 1000 -- time to wait for a mapped sequence to complete (in milliseconds) -vim.opt.undofile = true -- enable persistent undo -vim.opt.updatetime = 100 -- faster completion (4000ms default) -vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited -vim.opt.expandtab = true -- convert tabs to spaces -vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation -vim.opt.tabstop = 2 -- insert 2 spaces for a tab -vim.opt.cursorline = false -- highlight the current line -vim.opt.cursorlineopt = 'number' -vim.opt.number = true -- set numbered lines -vim.opt.laststatus = 0 --disable native statusline -vim.opt.showcmd = false -vim.opt.ruler = false -vim.opt.relativenumber = true -- set relative numbered lines -vim.opt.numberwidth = 4 -- set number column width to 2 {default 4} -vim.opt.signcolumn = 'yes' -- always show the sign column, otherwise it would shift the text each time -vim.opt.wrap = false -- display lines as one long line -vim.opt.scrolloff = 0 -vim.opt.sidescrolloff = 8 -vim.opt.guifont = 'monospace:h17' -- the font used in graphical neovim applications -vim.opt.title = true -vim.opt.titlelen = 0 -- do not shorten title -vim.opt.inccommand = 'split' -- split below for to show replaces -vim.opt.virtualedit = 'block' -vim.opt.fillchars = vim.opt.fillchars + 'eob: ' -vim.opt.fillchars:append({ - stl = ' ', -}) +local options = { + ai = true, + autoindent = true, + autowrite = true, + backspace = "indent,eol,start", + backup = false, -- creates a backup file + breakindent = true, + clipboard = "unnamedplus", -- allows neovim to access the system clipboard + cmdheight = 1, -- more space in the neovim command line for displaying messages + completeopt = "menu,menuone,noselect", -- mostly just for cmp + conceallevel = 0, -- so that `` is visible in markdown files + confirm = true, -- Confirm to save changes before exiting modified buffer + cursorline = true, -- highlight the current line + expandtab = true, -- convert tabs to spaces + fileencoding = "utf-8", -- the encoding written to a file + formatoptions = "jlnqt", -- set formatoptions, check help fo-table + grepformat = "%f:%l:%c:%m", + grepprg = "rg --vimgrep", + hlsearch = true, -- highlight all matches on previous search pattern + ignorecase = true, -- ignore case in search patterns + inccommand = "split", -- preview incremental substitute + laststatus = 3, + list = false, + -- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight + mouse = "a", -- allow the mouse to be used in neovim + number = true, -- set numbered lines + numberwidth = 4, -- set number column width to 3 {default 4} + pumblend = 10, -- Popup blen + pumheight = 10, -- pop up menu height + relativenumber = true, -- set relative numbered lines + scrolloff = 10, -- is one of my fav + sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal", + shiftround = true, -- Round indent + shiftwidth = 4, -- the number of spaces inserted for each indentation + showcmd = false, + showmode = false, -- we don't need to see things like -- INSERT -- anymore + showtabline = 0, -- always show tabs + si = true, + sidescrolloff = 8, + signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time + smartcase = true, -- smart case + smartindent = true, -- make indenting smarter again + smarttab = true, + splitbelow = true, -- force all horizontal splits to go below current window + splitright = true, -- force all vertical splits to go to the right of current window + swapfile = false, -- creates a swapfile + tabstop = 4, -- insert 2 spaces for a tab + termguicolors = true, -- set term gui colors (most terminals support this) + timeoutlen = 300, -- time to wait for a mapped sequence to complete (in milliseconds) + undofile = true, -- enable persistent undo + undolevels = 10000, + updatetime = 50, -- faster completion (4000ms default) + wildmenu = true, -- wildmenu + wildmode = "longest:full,full", -- Command-line completion mode + winminwidth = 5, -- Minimum window width + wrap = false, -- display lines as one long line + writebackup = false, -- do not edit backups +} -vim.opt.shortmess:append('c') - -vim.cmd('set whichwrap+=<,>,[,],h,l') -vim.cmd([[set iskeyword+=-]]) +for k, v in pairs(options) do + vim.opt[k] = v +end +-- netrw file explorer settings +vim.g.netrw_winsize = 20 vim.g.netrw_banner = 0 -vim.g.netrw_mouse = 2 +vim.g.netrw_liststyle = 1 + +-- Fix markdown indentation settings +vim.g.markdown_recommended_style = 0 + +vim.opt.path:append({ "**" }) +vim.opt.shortmess:append({ W = true, I = true, c = true }) + +-- hides `~` at the end of the buffer +vim.cmd([[set fillchars+=eob:\ ]]) + +vim.cmd([[ + setlocal spell spelllang=en "Set spellcheck language to en + setlocal spell! "Disable spell checks by default + filetype plugin indent on + if has('win32') + let g:python3_host_prog = $HOME . '/scoop/apps/python/current/python.exe' + endif + let &t_Cs = "\e[4:3m" "Undercurl + let &t_Ce = "\e[4:0m" + set whichwrap+=<,>,[,],h,l + set iskeyword+=- + ]]) diff --git a/lua/core/util.lua b/lua/core/util.lua deleted file mode 100644 index b2f3de1..0000000 --- a/lua/core/util.lua +++ /dev/null @@ -1,66 +0,0 @@ -local util = {} - -util.get_user_config = function(key, default) - local status_ok, user = pcall(require, 'user') - if not status_ok then - return default - end - - local user_config = user[key] - if user_config == nil then - return default - end - return user_config -end - -util.get_root_dir = function() - local bufname = vim.fn.expand('%:p') - if vim.fn.filereadable(bufname) == 0 then - return - end - - local parent = vim.fn.fnamemodify(bufname, ':h') - local git_root = vim.fn.systemlist('git -C ' .. parent .. ' rev-parse --show-toplevel') - if #git_root > 0 and git_root[1] ~= '' then - return git_root[1] - else - return parent - end -end - -util.get_file_type_cmd = function(extension) - local root = util.get_root_dir() - - if extension == 'arb' and root then - local gemfile_exists = vim.fn.filereadable(root .. '/Gemfile') == 1 - local pubspec_exists = vim.fn.filereadable(root .. '/pubspec.yaml') == 1 - if gemfile_exists then - return 'setfiletype ruby' - end - if pubspec_exists then - return 'setfiletype json' - end - end - return '' -end - -util.is_present = function(bin) - return vim.fn.executable(bin) == 1 -end - -util.telescope_select = function(options, options_desc, select_prompt) - require('telescope.pickers') - .new({}, { - prompt_title = select_prompt, - results_title = options_desc, - finder = require('telescope.finders').new_table({ - results = options, - entry_maker = require('telescope.make_entry').gen_from_file(), - }), - sorter = require('telescope.sorters').get_fzy_sorter(), - previewer = require('telescope.previewers').vim_buffer_cat.new({}), - }) - :find() -end - -return util diff --git a/lua/lib/icons.lua b/lua/lib/icons.lua new file mode 100644 index 0000000..00bcf56 --- /dev/null +++ b/lua/lib/icons.lua @@ -0,0 +1,164 @@ +return { + diagnostics = { + Error = ' ', + Hint = '󰠠 ', + Information = ' ', + Question = ' ', + Warning = ' ', + }, + documents = { + File = ' ', + FileEmpty = ' ', + Files = ' ', + Folder = ' ', + FolderEmpty = ' ', + OpenFolder = ' ', + OpenFolderEmpty = ' ', + SymLink = ' ', + SymlinkFolder = ' ', + Import = ' ', + }, + git = { + Add = ' ', + AddAlt = ' ', + Branch = ' ', + Diff = ' ', + DiffAlt = ' ', + Ignore = '◌ ', + Mod = ' ', + Octoface = ' ', + Remove = ' ', + RemoveAlt = ' ', + Rename = ' ', + Repo = ' ', + Tag = ' ', + Untrack = ' ', + }, + kind = { + Class = ' ', + Color = ' ', + Constant = ' ', + Constructor = '󰈏 ', + Enum = ' ', + EnumMember = ' ', + Event = ' ', + Field = ' ', + File = ' ', + Folder = ' ', + Function = '󰊕 ', + Interface = ' ', + Keyword = ' ', + Method = ' ', + Module = '', + Operator = ' ', + Property = ' ', + Reference = ' ', + Snippet = ' ', + Struct = ' ', + Text = ' ', + TypeParameter = ' ', + Unit = ' ', + Value = ' ', + Variable = ' ', + }, + type = { + Array = ' ', + Boolean = '⏻ ', + Number = ' ', + Object = ' ', + String = ' ', + }, + ui = { + Arrow = ' ', + ArrowClosed = ' ', + ArrowLeft = ' ', + ArrowOpen = ' ', + ArrowRight = ' ', + Bluetooth = ' ', + Bookmark = ' ', + Bug = ' ', + Calendar = ' ', + Camera = ' ', + Check = ' ', + ChevronRight = '', + Circle = ' ', + CircleSmall = '● ', + CircleSmallEmpty = '○ ', + Clipboard = ' ', + Close = ' ', + Code = ' ', + Collection = ' ', + Color = ' ', + Command = ' ', + Comment = ' ', + Copilot = ' ', + CopilotError = ' ', + Corner = '└ ', + Dashboard = ' ', + Database = ' ', + Download = ' ', + Edge = '│ ', + Electric = ' ', + Eye = ' ', + Fire = ' ', + Firefox = ' ', + Flag = ' ', + Game = ' ', + Gear = ' ', + GitHub = ' ', + Heart = ' ', + History = ' ', + Home = ' ', + Incoming = ' ', + Jump = ' ', + Keyboard = ' ', + Ligthbulb = '󰌵 ', + List = '', + Lock = ' ', + Minus = '‒ ', + Music = '󰝚 ', + Neovim = ' ', + NewFile = ' ', + None = ' ', + Note = ' ', + Outgoing = ' ', + Package = ' ', + Paint = ' ', + Pause = ' ', + Pencil = ' ', + Person = ' ', + Pin = ' ', + Play = ' ', + Plug = ' ', + Plus = ' ', + Power = ' ', + PowerlineArrowLeft = '', + PowerlineArrowRight = '', + PowerlineLeftRound = '', + PowerlineRightRound = '', + Project = ' ', + Question = ' ', + Reload = ' ', + Rocket = ' ', + Save = '󰆓 ', + Search = ' ', + Separator = '▊ ', + SeparatorLight = '▍', + SeparatorDashed = '┆', + SignIn = ' ', + SignOut = ' ', + Sleep = '󰒲 ', + Star = ' ', + Table = ' ', + Telescope = ' ', + Terminal = ' ', + Test = ' ', + Time = ' ', + Topline = '‾', + Trash = ' ', + User = ' ', + Vim = ' ', + Wifi = ' ', + Windows = ' ', + }, +} diff --git a/lua/lib/util.lua b/lua/lib/util.lua new file mode 100644 index 0000000..3ab34a5 --- /dev/null +++ b/lua/lib/util.lua @@ -0,0 +1,66 @@ +local util = {} + +util.get_user_config = function(key, default) + local status_ok, user = pcall(require, "user") + if not status_ok then + return default + end + + local user_config = user[key] + if user_config == nil then + return default + end + return user_config +end + +util.get_root_dir = function() + local bufname = vim.fn.expand("%:p") + if vim.fn.filereadable(bufname) == 0 then + return + end + + local parent = vim.fn.fnamemodify(bufname, ":h") + local git_root = vim.fn.systemlist("git -C " .. parent .. " rev-parse --show-toplevel") + if #git_root > 0 and git_root[1] ~= "" then + return git_root[1] + else + return parent + end +end + +util.get_file_type_cmd = function(extension) + local root = util.get_root_dir() + + if extension == "arb" and root then + local gemfile_exists = vim.fn.filereadable(root .. "/Gemfile") == 1 + local pubspec_exists = vim.fn.filereadable(root .. "/pubspec.yaml") == 1 + if gemfile_exists then + return "setfiletype ruby" + end + if pubspec_exists then + return "setfiletype json" + end + end + return "" +end + +util.is_present = function(bin) + return vim.fn.executable(bin) == 1 +end + +util.telescope_select = function(options, options_desc, select_prompt) + require("telescope.pickers") + .new({}, { + prompt_title = select_prompt, + results_title = options_desc, + finder = require("telescope.finders").new_table({ + results = options, + entry_maker = require("telescope.make_entry").gen_from_file(), + }), + sorter = require("telescope.sorters").get_fzy_sorter(), + previewer = require("telescope.previewers").vim_buffer_cat.new({}), + }) + :find() +end + +return util diff --git a/lua/lock.json b/lua/lock.json index fbbe76c..815a83c 100644 --- a/lua/lock.json +++ b/lua/lock.json @@ -1,28 +1,27 @@ { - "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, + "LuaSnip": { "branch": "master", "commit": "7ad2eaeaca56d6ed63acacbfc114b99f1f67b982" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, - "alpha-nvim": { "branch": "main", "commit": "355fbb81a59637a8963cf5847074f8c44dbef11f" }, - "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, "better-escape.nvim": { "branch": "master", "commit": "d337e02b140d909345441392de47a42d283747c1" }, "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, - "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" }, "codeium.vim": { "branch": "main", "commit": "0b74f274b82c00eaad4b5b5cd8b2e76f872d19f1" }, "comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" }, + "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" }, "dotfyle-metadata.nvim": { "branch": "main", "commit": "342ef8f3f98f3ccc451c9cf2be74e95149ced05d" }, "dressing.nvim": { "branch": "master", "commit": "c5775a888adbc50652cb370073fcfec963eca93e" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "flatten.nvim": { "branch": "main", "commit": "e420e531d2ab24aebcf7b3c9fca28e6c5c34964d" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, - "hardtime.nvim": { "branch": "main", "commit": "91c6be1a54fa057002e21ae209a49436bd215355" }, + "hardtime.nvim": { "branch": "main", "commit": "6513bf42cd9261669d1ee41ff8b4065dfdc53a09" }, "hlargs.nvim": { "branch": "main", "commit": "cc0d9ee75e5ffba730393049119361b9e3a5b1b6" }, "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, - "indent-blankline.nvim": { "branch": "master", "commit": "dddb5d21811c319eb6e51a993d8fb44b193aae3f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, "lspsaga.nvim": { "branch": "main", "commit": "4ce44df854f447cf0a8972e5387b3aeb5efc798b" }, @@ -33,15 +32,17 @@ "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.files": { "branch": "main", "commit": "170d0dd321ca377cb427fb5576d4d75601c1c2da" }, - "mini.nvim": { "branch": "main", "commit": "d6e6a6fb010cc452b491704aa9ecc96a8aa2cde1" }, + "mini.files": { "branch": "main", "commit": "9de79b28e5b7a9dc92b9ae2ba21296f7075b51a7" }, + "mini.icons": { "branch": "main", "commit": "12e7b5d47bfc1b4c5ba4278fb49ec9100138df14" }, + "mini.nvim": { "branch": "main", "commit": "71b5694a2df4f7e3661855eb8e2814980d2e0ac9" }, + "mini.pick": { "branch": "main", "commit": "27fc7862b7a1fc2e04356dc5ed1caf7049baccb4" }, "modes.nvim": { "branch": "main", "commit": "3188692abf02a8838ec75e59d68c2ce3e4323f5c" }, - "moonfly": { "branch": "master", "commit": "4f7d18cb471ede7407dd966c7563868cae7f4f99" }, "neo-tree.nvim": { "branch": "main", "commit": "206241e451c12f78969ff5ae53af45616ffc9b72" }, "neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" }, "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, - "neotest-python": { "branch": "master", "commit": "e5bff6dcf3cb33e6dfb97722e142961099c6021e" }, + "neotest-python": { "branch": "master", "commit": "72603dfdbaad5695160268cb10531a14cc37236e" }, "neotest-rspec": { "branch": "main", "commit": "53fc108a06ae43d7f873d42ee5189c2301e33623" }, + "nerdy.nvim": { "branch": "main", "commit": "b467d6609b78d6a5f1e12cbc08fcc1ac87af20f5" }, "noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" }, "none-ls.nvim": { "branch": "main", "commit": "cfa65d86e21eeb60544d5e823f6db43941322a53" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, @@ -50,21 +51,22 @@ "nvim-dap": { "branch": "master", "commit": "281a2e4cd1e7a17cea7ecb1745d84a8ab1249925" }, "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, - "nvim-lspconfig": { "branch": "master", "commit": "a89de2e049b5f89a0ee55029d5a31213bd4de6f8" }, - "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-lspconfig": { "branch": "master", "commit": "6ecab74936b16b8a4d76246906b729e546220f1b" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-recorder": { "branch": "main", "commit": "ce96792c1ff750977fc3affc56f0561b0c20a7e2" }, "nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" }, - "nvim-treesitter": { "branch": "master", "commit": "ec8776ed9ef56ffe7a61e67b64d5d6b6aba2c631" }, + "nvim-treesitter": { "branch": "master", "commit": "0b8b78f9d08dc338a146eb4cd4bcbed8dd36a783" }, "nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ced6375723b20616282f9f6a1018a63ae19b106a" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "41e3abf6bfd9a9a681eb1f788bdeba91c9004b2b" }, "nvim-ts-autotag": { "branch": "main", "commit": "0cb76eea80e9c73b88880f0ca78fbd04c5bdcac7" }, "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, "odoo-snippets": { "branch": "main", "commit": "5e6b7191e3ea60bba00df6cdbc031291b194768d" }, + "onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" }, "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "c097f728a409d9923a3c70c1507e8389978a9b85" }, + "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "9f3d10e66a79e8975926f8cb930856e4930d9da4" }, + "refactoring.nvim": { "branch": "master", "commit": "c406fc5fb4d7ba5fce7b668637075fad6e75e9f8" }, "screenkey.nvim": { "branch": "main", "commit": "b1516d5d610c89555062397d29fa7f32fc8ec431" }, "tdo.nvim": { "branch": "main", "commit": "f8d4ee275309c8a696236fcee92d78ecd98971bd" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "a46780830b576049c675680650f773bedfa8677a" }, diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index f382178..494e91e 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -1,211 +1,236 @@ return { - { - 'max397574/better-escape.nvim', - event = 'InsertEnter', - opts = { - k = function() - vim.api.nvim_input('') - local current_line = vim.api.nvim_get_current_line() - if current_line:match('^%s+j$') then - vim.schedule(function() - vim.api.nvim_set_current_line('') - end) - end - end, - }, - }, - { - 'L3MON4D3/LuaSnip', - event = { 'BufReadPost', 'BufNewFile' }, - dependencies = { - 'rafamadriz/friendly-snippets', - 'mstuttgart/odoo-snippets', - }, - opts = { - history = true, - updateevents = 'TextChanged,TextChangedI', - }, - keys = function() - return {} - end, - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - { - 'altermo/ultimate-autopair.nvim', - event = { 'InsertEnter', 'CmdlineEnter' }, - branch = 'v0.6', --recommended as each new version will have breaking changes - opts = {}, - }, - { - 'hrsh7th/nvim-cmp', - event = { 'InsertEnter' }, - dependencies = { - -- autocomplete plugins - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-nvim-lua', - 'saadparwaiz1/cmp_luasnip', - -- "hrsh7th/cmp-nvim-lsp-signature-help", - -- "hrsh7th/cmp-calc", + { + "max397574/better-escape.nvim", + event = "InsertEnter", + opts = { + k = function() + vim.api.nvim_input("") + local current_line = vim.api.nvim_get_current_line() + if current_line:match("^%s+j$") then + vim.schedule(function() + vim.api.nvim_set_current_line("") + end) + end + end, + }, + }, + { + "CRAG666/code_runner.nvim", + config = true, + vim.keymap.set("n", "rc", "RunCode", { desc = "Run Code " }), + vim.keymap.set("n", "rf", "RunFile", { desc = "Run Code File " }), + vim.keymap.set("n", "rp", "RunProject", { desc = "Run Code Project " }), + vim.keymap.set("n", "rx", "RunClose", { desc = "Close Code Run " }), + opts = { + filetype = { + python = "python3 -u", + c = "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", + cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", + sh = "bash", + go = "go run", + lua = "lua", + julia = "julia", + typescript = "ts-node", + javascript = "node", + rust = "cd $dir && cargo run", + php = "php", + java = "cd $dir && javac $fileName && java $fileNameWithoutExt", + kotlin = "cd $dir && kotlinc $fileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar", + }, + }, + }, + { + "L3MON4D3/LuaSnip", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "rafamadriz/friendly-snippets", + "mstuttgart/odoo-snippets", + }, + opts = { + history = true, + updateevents = "TextChanged,TextChangedI", + }, + keys = function() + return {} + end, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + { + "altermo/ultimate-autopair.nvim", + event = { "InsertEnter", "CmdlineEnter" }, + branch = "v0.6", --recommended as each new version will have breaking changes + opts = {}, + }, + { + "hrsh7th/nvim-cmp", + event = { "InsertEnter" }, + dependencies = { + -- autocomplete plugins + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lua", + "saadparwaiz1/cmp_luasnip", + -- "hrsh7th/cmp-nvim-lsp-signature-help", + -- "hrsh7th/cmp-calc", - -- vscode like icons to autocomplete list - 'onsails/lspkind.nvim', - -- snippet plugin - { 'L3MON4D3/LuaSnip', event = { 'BufReadPost', 'BufNewFile' } }, - { 'rafamadriz/friendly-snippets', event = { 'BufReadPost', 'BufNewFile' } }, - }, - config = function() - require('configs.cmp') - end, - }, - { - 'Exafunction/codeium.vim', - event = 'InsertEnter', - config = function() - local cmp = require('cmp') - cmp.event:on('menu_opened', function() - vim.g.codeium_manual = true - vim.fn['codeium#Clear']() - end) - cmp.event:on('menu_closed', function() - vim.g.codeium_manual = false - vim.fn['codeium#Complete']() - end) + -- vscode like icons to autocomplete list + "onsails/lspkind.nvim", + -- snippet plugin + { "L3MON4D3/LuaSnip", event = { "BufReadPost", "BufNewFile" } }, + { "rafamadriz/friendly-snippets", event = { "BufReadPost", "BufNewFile" } }, + }, + config = function() + require("configs.cmp") + end, + }, + { + "Exafunction/codeium.vim", + event = "InsertEnter", + config = function() + local cmp = require("cmp") + cmp.event:on("menu_opened", function() + vim.g.codeium_manual = true + vim.fn["codeium#Clear"]() + end) + cmp.event:on("menu_closed", function() + vim.g.codeium_manual = false + vim.fn["codeium#Complete"]() + end) - vim.g.codeium_filetypes = { - TelescopePrompt = false, - DressingInput = false, - ['neo-tree-popup'] = false, - ['dap-repl'] = false, - } + vim.g.codeium_filetypes = { + TelescopePrompt = false, + DressingInput = false, + ["neo-tree-popup"] = false, + ["dap-repl"] = false, + } - local opts = { expr = true, silent = true } - vim.g.codeium_disable_bindings = 1 + local opts = { expr = true, silent = true } + vim.g.codeium_disable_bindings = 1 - vim.keymap.set('i', '', function() - return vim.fn['codeium#Accept']() - end, opts) + vim.keymap.set("i", "", function() + return vim.fn["codeium#Accept"]() + end, opts) - vim.keymap.set('n', 'ch', function() - return vim.fn['codeium#Chat']() - end, { desc = 'Chat with IA (Codeium)' }) + vim.keymap.set("n", "ch", function() + return vim.fn["codeium#Chat"]() + end, { desc = "Chat with IA (Codeium)" }) - vim.keymap.set('i', '', function() - return vim.fn['codeium#CycleCompletions'](1) - end, opts) + vim.keymap.set("i", "", function() + return vim.fn["codeium#CycleCompletions"](1) + end, opts) - vim.keymap.set('i', '', function() - return vim.fn['codeium#CycleCompletions'](-1) - end, opts) + vim.keymap.set("i", "", function() + return vim.fn["codeium#CycleCompletions"](-1) + end, opts) - vim.keymap.set('i', '', function() - return vim.fn['codeium#Clear']() - end, opts) + vim.keymap.set("i", "", function() + return vim.fn["codeium#Clear"]() + end, opts) - vim.keymap.set('n', 'cI', 'CodeiumToggle', { desc = 'Toggle IA (Codeium)' }) - end, - }, - { - 'nacro90/numb.nvim', - event = 'CmdlineEnter', - config = function() - require('numb').setup({ - show_numbers = true, -- Enable 'number' for the window while peeking - show_cursorline = true, -- Enable 'cursorline' for the window while peeking - hide_relativenumbers = true, -- Enable turning off 'relativenumber' for the window while peeking - number_only = false, -- Peek only when the command is only a number instead of when it starts with a number - centered_peeking = true, -- Peeked line will be centered relative to window - }) - end, - }, - { - 'NStefan002/screenkey.nvim', - cmd = 'Screenkey', - version = '*', - vim.keymap.set('n', 'kt', 'Screenkey', { desc = 'Toggle keys' }), - config = function() - require('screenkey').setup({ - win_opts = { - relative = 'editor', - anchor = 'SE', - width = 40, - height = 1, - border = 'single', - }, - compress_after = 3, - clear_after = 3, - disable = { - filetypes = {}, -- for example: "toggleterm" - buftypes = {}, -- for example: "terminal" - }, - }) - end, - }, - { - 'gbprod/yanky.nvim', - event = 'BufReadPost', - keys = { - { '', '(YankyCycleForward)' }, - { '', '(YankyCycleBackward)' }, - { - 'yp', - function() - require('telescope').extensions.yank_history.yank_history({}) - end, - desc = 'Open Yank History', - }, - { 'y', '(YankyYank)', mode = { 'n', 'x' }, desc = 'Yank text' }, - { 'p', '(YankyPutAfter)', mode = { 'n', 'x' }, desc = 'Put yanked text after cursor' }, - { 'P', '(YankyPutBefore)', mode = { 'n', 'x' }, desc = 'Put yanked text before cursor' }, - { 'gp', '(YankyGPutAfter)', mode = { 'n', 'x' }, desc = 'Put yanked text after selection' }, - { 'gP', '(YankyGPutBefore)', mode = { 'n', 'x' }, desc = 'Put yanked text before selection' }, - -- This is not plugin keymaps - { 'yP', 'CopyAbsolutePath', desc = 'Absolute Path' }, - { 'ya', '%y+', desc = 'Copy Whole File' }, - { 'yf', 'CopyFileName', desc = 'File Name' }, - { 'yg', 'lua require"gitlinker".get_buf_range_url()', desc = 'Copy Git URL' }, - { 'yp', 'CopyRelativePath', desc = 'Relative Path' }, - }, - opts = { - highlight = { - timer = 150, - }, - }, - }, - { - { - 'LudoPinelli/comment-box.nvim', - opts = {}, - vscode = true, - keys = { - { 'Cb', 'CBccbox', mode = { 'n', 'v' }, desc = 'Comment Box' }, - { 'Ct', 'CBllline', mode = { 'n', 'v' }, desc = 'Tiled line' }, - { 'Cl', 'CBline', desc = 'Line' }, - { 'Cm', 'CBllbox14', mode = { 'n', 'v' }, desc = 'Marked' }, - { 'Cc', 'CBcatalog', desc = 'Catalog' }, - { 'Cd', 'CBd', mode = { 'n', 'v' }, desc = 'Delete Comment Style' }, - }, - }, - }, - { - 'm-demare/hlargs.nvim', - event = { 'BufReadPost', 'BufNewFile' }, - }, - { - 'numToStr/Navigator.nvim', - keys = { - { '', 'NavigatorLeft' }, - { '', 'NavigatorDown' }, - { '', 'NavigatorUp' }, - { '', 'NavigatorRight' }, - { '', 'NavigatorPrevious' }, - }, - config = function() - require('Navigator').setup() - end, - }, + vim.keymap.set("n", "cI", "CodeiumToggle", { desc = "Toggle IA (Codeium)" }) + end, + }, + { + "nacro90/numb.nvim", + event = "CmdlineEnter", + config = function() + require("numb").setup({ + show_numbers = true, -- Enable 'number' for the window while peeking + show_cursorline = true, -- Enable 'cursorline' for the window while peeking + hide_relativenumbers = true, -- Enable turning off 'relativenumber' for the window while peeking + number_only = false, -- Peek only when the command is only a number instead of when it starts with a number + centered_peeking = true, -- Peeked line will be centered relative to window + }) + end, + }, + { + "NStefan002/screenkey.nvim", + cmd = "Screenkey", + version = "*", + vim.keymap.set("n", "kt", "Screenkey", { desc = "Toggle keys" }), + config = function() + require("screenkey").setup({ + win_opts = { + relative = "editor", + anchor = "SE", + width = 40, + height = 1, + border = "single", + }, + compress_after = 3, + clear_after = 3, + disable = { + filetypes = {}, -- for example: "toggleterm" + buftypes = {}, -- for example: "terminal" + }, + }) + end, + }, + { + "gbprod/yanky.nvim", + event = "BufReadPost", + keys = { + { "", "(YankyCycleForward)" }, + { "", "(YankyCycleBackward)" }, + { + "yp", + function() + require("telescope").extensions.yank_history.yank_history({}) + end, + desc = "Open Yank History", + }, + { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank text" }, + { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" }, + { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" }, + { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" }, + { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" }, + -- This is not plugin keymaps + { "yP", "CopyAbsolutePath", desc = "Absolute Path" }, + { "ya", "%y+", desc = "Copy Whole File" }, + { "yf", "CopyFileName", desc = "File Name" }, + { "yg", 'lua require"gitlinker".get_buf_range_url()', desc = "Copy Git URL" }, + { "yp", "CopyRelativePath", desc = "Relative Path" }, + }, + opts = { + highlight = { + timer = 150, + }, + }, + }, + { + { + "LudoPinelli/comment-box.nvim", + opts = {}, + vscode = true, + keys = { + { "Cb", "CBccbox", mode = { "n", "v" }, desc = "Comment Box" }, + { "Ct", "CBllline", mode = { "n", "v" }, desc = "Tiled line" }, + { "Cl", "CBline", desc = "Line" }, + { "Cm", "CBllbox14", mode = { "n", "v" }, desc = "Marked" }, + { "Cc", "CBcatalog", desc = "Catalog" }, + { "Cd", "CBd", mode = { "n", "v" }, desc = "Delete Comment Style" }, + }, + }, + }, + { + "m-demare/hlargs.nvim", + event = { "BufReadPost", "BufNewFile" }, + }, + { + "numToStr/Navigator.nvim", + keys = { + { "", "NavigatorLeft" }, + { "", "NavigatorDown" }, + { "", "NavigatorUp" }, + { "", "NavigatorRight" }, + { "", "NavigatorPrevious" }, + }, + config = function() + require("Navigator").setup() + end, + }, } diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index b8233e9..f13fbe5 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,14 +1,35 @@ return { - { - 'bluz71/vim-moonfly-colors', - name = 'moonfly', - lazy = false, - priority = 1000, - config = function() - require('moonfly').custom_colors({ - bg = '#000000', - }) - vim.cmd([[colorscheme moonfly]]) - end, - }, + { + "navarasu/onedark.nvim", + lazy = false, + priority = 1000, + config = function() + local onedark = require("onedark") + local util = require("lib.util") + + onedark.setup({ + style = "deep", + transparent = true, + term_colors = false, + ending_tildes = false, + cmp_itemkind_reverse = false, + + toggle_style_key = "mt", + toggle_style_list = { "dark", "darker", "cool", "warm", "warmer", "deep", "light" }, + + -- Options are italic, bold, underline, none and combos 'italic,bold' + code_style = { + comments = "italic", + keywords = "none", + functions = "none", + strings = "none", + variables = "none", + }, + + lualine = { transparent = true }, + diagnostics = { darker = true, undercurl = true, background = false }, + }) + onedark.load() + end, + }, } diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 8f3084b..07dc232 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,50 +1,43 @@ return { - { - 'echasnovski/mini.files', - version = false, - keys = { - { '-', "lua require('mini.files').open(vim.api.nvim_buf_get_name(0))", { silent = true } }, - }, - }, - { - 'nvim-neo-tree/neo-tree.nvim', - keys = { - { 'ee', ':Neotree toggle float', silent = true, desc = 'Float File Explorer' }, - { '', ':Neotree toggle left', silent = true, desc = ' Left File Explorer' }, - }, - cmd = { 'Neotree' }, - opts = { - filesystem = { - filtered_items = { - visible = true, - show_hidden_count = true, - hide_dotfiles = false, - hide_gitignored = true, - hide_by_name = { - '.git', - '.DS_Store', - 'thumbs.db', - '.venv', - }, - never_show = {}, - }, - }, - window = { - position = 'right', - width = 35, - }, - }, - }, - { - 'folke/flash.nvim', - event = 'VeryLazy', - opts = { - modes = { - char = { - jump_labels = true, - }, - }, - }, + { + "nvim-neo-tree/neo-tree.nvim", + keys = { + { "ee", ":Neotree toggle float", silent = true, desc = "Float File Explorer" }, + { "", ":Neotree toggle left", silent = true, desc = " Left File Explorer" }, + }, + cmd = { "Neotree" }, + opts = { + filesystem = { + filtered_items = { + visible = true, + show_hidden_count = true, + hide_dotfiles = false, + hide_gitignored = true, + hide_by_name = { + ".git", + ".DS_Store", + "thumbs.db", + ".venv", + }, + never_show = {}, + }, + }, + window = { + position = "right", + width = 35, + }, + }, + }, + { + "folke/flash.nvim", + event = "VeryLazy", + opts = { + modes = { + char = { + jump_labels = true, + }, + }, + }, -- stylua: ignore keys = { { @@ -74,208 +67,212 @@ return { }, }, - }, - { - 'folke/trouble.nvim', - lazy = true, - cmd = { 'Trouble', 'TroubleToggle', 'TroubleRefresh' }, - opts = { - modes = { - lsp = { - win = { position = 'right' }, - }, - }, - }, - keys = { - { 'xx', 'Trouble diagnostics toggle', desc = 'Diagnostics (Trouble)' }, - { 'xX', 'Trouble diagnostics toggle filter.buf=0', desc = 'Buffer Diagnostics (Trouble)' }, - { 'xs', 'Trouble symbols toggle', desc = 'Symbols (Trouble)' }, - { 'xS', 'Trouble lsp toggle', desc = 'LSP references/definitions/... (Trouble)' }, - { 'xL', 'Trouble loclist toggle', desc = 'Location List (Trouble)' }, - { 'xQ', 'Trouble qflist toggle', desc = 'Quickfix List (Trouble)' }, - { - '[q', - function() - if require('trouble').is_open() then - require('trouble').prev({ skip_groups = true, jump = true }) - else - local ok, err = pcall(vim.cmd.cprev) - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end - end, - desc = 'Previous Trouble/Quickfix Item', - }, - { - ']q', - function() - if require('trouble').is_open() then - require('trouble').next({ skip_groups = true, jump = true }) - else - local ok, err = pcall(vim.cmd.cnext) - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end - end, - desc = 'Next Trouble/Quickfix Item', - }, - }, - }, - { - 'nvim-telescope/telescope.nvim', - cmd = 'Telescope', - version = false, - lazy = true, - dependencies = { - { 'nvim-tree/nvim-web-devicons' }, - { 'nvim-telescope/telescope-fzf-native.nvim', build = 'zig' }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - { 'nvim-telescope/telescope-symbols.nvim' }, - { 'nvim-telescope/telescope-file-browser.nvim' }, - { 'debugloop/telescope-undo.nvim' }, - }, - keys = { - { 'ff', 'Telescope find_files', desc = 'Find Files (CWD)' }, - { 'fg', 'Telescope live_grep', desc = 'Live Grep' }, - { 'fb', 'Telescope buffers', desc = 'Buffers' }, - { 'fh', 'Telescope help_tags', desc = 'Find Help' }, - { 'fo', 'Telescope oldfiles', desc = 'Old Recent Files' }, - { 'fm', 'Telescope marks', desc = 'Marks' }, - { 'fH', 'Telescope highlights', desc = 'Find Highlight Groups' }, - { 'fG', 'Telescope grep_string', desc = 'Grep String' }, - { 'kk', 'Telescope keymaps', desc = 'Keymaps' }, - { 'kc', 'Telescope commands', desc = 'Commands' }, - { 'kh', 'Telescope command_history', desc = 'Command History' }, - { 'ks', 'Telescope search_history', desc = 'Search History' }, - { 'fd', 'Telescope diagnostics', desc = 'Diagnostics' }, - { 'ef', 'Telescope file_browser', desc = 'File Browser' }, - { 'cr', 'Telescope reloader', desc = 'Reload Module' }, - { 'cn', 'Telescope notify', desc = 'Notifications' }, - { 'fu', 'Telescope undo', desc = 'Undo History' }, - { 'fb', 'Telescope buffers', desc = 'Buffers' }, - { 'fq', 'Telescope quickfix', desc = 'Quickfix' }, - { 'fs', 'Telescope current_buffer_fuzzy_find', desc = 'Fuzzy Find in File' }, - }, + }, + { + "folke/trouble.nvim", + lazy = true, + cmd = { "Trouble", "TroubleToggle", "TroubleRefresh" }, + opts = { + modes = { + lsp = { + win = { position = "right" }, + }, + }, + }, + keys = { + { "xx", "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, + { "xX", "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics (Trouble)" }, + { "xs", "Trouble symbols toggle", desc = "Symbols (Trouble)" }, + { "xS", "Trouble lsp toggle", desc = "LSP references/definitions/... (Trouble)" }, + { "xL", "Trouble loclist toggle", desc = "Location List (Trouble)" }, + { "xQ", "Trouble qflist toggle", desc = "Quickfix List (Trouble)" }, + { + "[q", + function() + if require("trouble").is_open() then + require("trouble").prev({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Previous Trouble/Quickfix Item", + }, + { + "]q", + function() + if require("trouble").is_open() then + require("trouble").next({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Next Trouble/Quickfix Item", + }, + }, + }, + { + "nvim-telescope/telescope.nvim", + cmd = "Telescope", + version = false, + lazy = true, + dependencies = { + { "nvim-tree/nvim-web-devicons" }, + { "nvim-telescope/telescope-fzf-native.nvim", build = "zig" }, + { "nvim-telescope/telescope-ui-select.nvim" }, + { "nvim-telescope/telescope-symbols.nvim" }, + { "nvim-telescope/telescope-file-browser.nvim" }, + { "debugloop/telescope-undo.nvim" }, + }, + keys = { + { "ff", "Telescope find_files", desc = "Find Files (CWD)" }, + { "fg", "Telescope live_grep", desc = "Live Grep" }, + { "fb", "Telescope buffers", desc = "Buffers" }, + { "fh", "Telescope help_tags", desc = "Find Help" }, + { "fo", "Telescope oldfiles", desc = "Old Recent Files" }, + { "fm", "Telescope marks", desc = "Marks" }, + { "fH", "Telescope highlights", desc = "Find Highlight Groups" }, + { "fG", "Telescope grep_string", desc = "Grep String" }, + { "kk", "Telescope keymaps", desc = "Keymaps" }, + { "kc", "Telescope commands", desc = "Commands" }, + { "kh", "Telescope command_history", desc = "Command History" }, + { "ks", "Telescope search_history", desc = "Search History" }, + { "fd", "Telescope diagnostics", desc = "Diagnostics" }, + { "ef", "Telescope file_browser", desc = "File Browser" }, + { "cr", "Telescope reloader", desc = "Reload Module" }, + { "cn", "Telescope notify", desc = "Notifications" }, + { "fu", "Telescope undo", desc = "Undo History" }, + { "fb", "Telescope buffers", desc = "Buffers" }, + { "fq", "Telescope quickfix", desc = "Quickfix" }, + { "fs", "Telescope current_buffer_fuzzy_find", desc = "Fuzzy Find in File" }, + }, - config = function() - require('configs.telescope') - end, - }, - { - 'smjonas/inc-rename.nvim', - cmd = 'IncRename', - config = true, - }, - { + config = function() + require("configs.telescope") + end, + }, + { + "smjonas/inc-rename.nvim", + cmd = "IncRename", + config = true, + }, + { - 'akinsho/toggleterm.nvim', - cmd = { 'ToggleTerm' }, - version = 'v2.*', - keys = { - { 't1', '1ToggleTerm', desc = 'Toggle Terminal', mode = 'n' }, - { 't2', '2ToggleTerm', desc = 'Toggle Terminal', mode = 'n' }, - }, - config = function() - require('configs.toggleterm') - end, - }, - { - '2kabhishek/termim.nvim', - cmd = { 'Fterm', 'FTerm', 'Sterm', 'STerm', 'Vterm', 'VTerm' }, - keys = { - { 'th', 'Sterm', desc = 'Horizontal Terminal' }, - { 'tv', 'Vterm', desc = 'Vertical Terminal' }, - }, - }, - { - 'nvimdev/lspsaga.nvim', - lazy = true, - event = 'LspAttach', - config = function() - vim.keymap.set( - 'n', - 'lo', - 'Lspsaga outline', - { desc = 'Lspsaga | Code Outline', silent = true } - ) - require('lspsaga').setup({ - ui = { - theme = 'round', - border = 'rounded', - winblend = 0, - expand = '', - collaspe = '', - preview = ' ', - code_action = '󱧣 ', - diagnostic = ' ', - hover = ' ', - kind = {}, - }, - lightbulb = { - enable = false, - enable_in_insert = true, - sign = true, - sign_priority = 40, - virtual_text = true, - }, - symbol_in_winbar = { - enable = false, - separator = '  ', - hide_keyword = true, - show_file = true, - folder_level = 0, - }, - }) - end, - }, - { - 'HiPhish/rainbow-delimiters.nvim', - event = { 'BufReadPost', 'BufNewFile' }, - config = function() - local rainbow_delimiters = require('rainbow-delimiters') - require('rainbow-delimiters.setup').setup({ - { - strategy = { - [''] = rainbow_delimiters.strategy['global'], - vim = rainbow_delimiters.strategy['local'], - }, - query = { - [''] = 'rainbow-delimiters', - lua = 'rainbow-blocks', - }, - priority = { - [''] = 110, - lua = 210, - }, - highlight = { - 'RainbowDelimiterRed', - 'RainbowDelimiterYellow', - 'RainbowDelimiterBlue', - 'RainbowDelimiterOrange', - 'RainbowDelimiterGreen', - 'RainbowDelimiterViolet', - 'RainbowDelimiterCyan', - }, - }, - }) - end, - }, - { - '2kabhishek/tdo.nvim', - dependencies = 'nvim-telescope/telescope.nvim', - cmd = { 'Tdo', 'TdoEntry', 'TdoNote', 'TdoTodos', 'TdoToggle', 'TdoFind', 'TdoFiles' }, - keys = { - { 'nd', 'Tdo', desc = "Today's Todo" }, - { 'ne', 'TdoEntry', desc = "Today's Entry" }, - { 'nf', 'TdoFiles', desc = 'All Notes' }, - { 'ng', 'TdoFind', desc = 'Find Notes' }, - { 'nh', 'Tdo -1', desc = "Yesterday's Todo" }, - { 'nl', 'Tdo 1', desc = "Tomorrow's Todo" }, - { 'nn', 'TdoNote', desc = 'New Note' }, - { 'nt', 'TdoTodos', desc = 'Incomplete Todos' }, - { 'nx', 'TdoToggle', desc = 'Toggle Todo' }, - }, - }, + "akinsho/toggleterm.nvim", + cmd = { "ToggleTerm" }, + version = "v2.*", + keys = { + { "t1", "1ToggleTerm", desc = "Toggle Terminal", mode = "n" }, + { "t2", "2ToggleTerm", desc = "Toggle Terminal", mode = "n" }, + }, + config = function() + require("configs.toggleterm") + end, + }, + { + "2kabhishek/termim.nvim", + cmd = { "Fterm", "FTerm", "Sterm", "STerm", "Vterm", "VTerm" }, + keys = { + { "th", "Sterm", desc = "Horizontal Terminal" }, + { "tv", "Vterm", desc = "Vertical Terminal" }, + }, + }, + { + "nvimdev/lspsaga.nvim", + lazy = true, + event = "LspAttach", + config = function() + vim.keymap.set( + "n", + "lo", + "Lspsaga outline", + { desc = "Lspsaga | Code Outline", silent = true } + ) + local icons = require("lib.icons") + require("lspsaga").setup({ + ui = { + theme = "round", + border = "rounded", + devicon = true, + title = true, + winblend = 1, + expand = icons.ui.ArrowOpen, + collapse = icons.ui.ArrowClosed, + preview = icons.ui.List, + code_action = icons.diagnostics.Hint, + diagnostic = icons.ui.Bug, + incoming = icons.ui.Incoming, + outgoing = icons.ui.Outgoing, + hover = icons.ui.Comment, + }, + lightbulb = { + enable = false, + enable_in_insert = true, + sign = true, + sign_priority = 40, + virtual_text = true, + }, + symbol_in_winbar = { + enable = false, + separator = "  ", + hide_keyword = true, + show_file = true, + folder_level = 0, + }, + }) + end, + }, + { + "HiPhish/rainbow-delimiters.nvim", + event = { "BufReadPost", "BufNewFile" }, + config = function() + local rainbow_delimiters = require("rainbow-delimiters") + require("rainbow-delimiters.setup").setup({ + { + strategy = { + [""] = rainbow_delimiters.strategy["global"], + vim = rainbow_delimiters.strategy["local"], + }, + query = { + [""] = "rainbow-delimiters", + lua = "rainbow-blocks", + }, + priority = { + [""] = 110, + lua = 210, + }, + highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", + }, + }, + }) + end, + }, + { + "2kabhishek/tdo.nvim", + dependencies = "nvim-telescope/telescope.nvim", + cmd = { "Tdo", "TdoEntry", "TdoNote", "TdoTodos", "TdoToggle", "TdoFind", "TdoFiles" }, + keys = { + { "nd", "Tdo", desc = "Today's Todo" }, + { "ne", "TdoEntry", desc = "Today's Entry" }, + { "nf", "TdoFiles", desc = "All Notes" }, + { "ng", "TdoFind", desc = "Find Notes" }, + { "nh", "Tdo -1", desc = "Yesterday's Todo" }, + { "nl", "Tdo 1", desc = "Tomorrow's Todo" }, + { "nn", "TdoNote", desc = "New Note" }, + { "nt", "TdoTodos", desc = "Incomplete Todos" }, + { "nx", "TdoToggle", desc = "Toggle Todo" }, + }, + }, } diff --git a/lua/plugins/formater.lua b/lua/plugins/formater.lua new file mode 100644 index 0000000..f16931f --- /dev/null +++ b/lua/plugins/formater.lua @@ -0,0 +1,63 @@ +return { + "stevearc/conform.nvim", + enabled = false, + event = { "BufReadPre", "BufNewFile" }, + config = function() + local conform = require("conform") + + conform.setup({ + formatters_by_ft = { + cpp = { "clang-format" }, + c = { "clang-format" }, + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier", "biome" }, + typescriptreact = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + markdown = { "markdownlint", "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + php = { "php-cs-fixer" }, + java = { "google-java-formatter", "trivy" }, + graphql = { "prettier" }, + }, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { + lsp_fallback = true, + async = false, + timeout_ms = 500, + } + end, + }) + + vim.keymap.set({ "n", "v" }, "cf", function() + conform.format({ + lsp_fallback = true, + async = true, + timeout_ms = 1000, + }) + end, { desc = "Format file or range (in visual mode)" }) + + vim.keymap.set({ "n" }, "cfb", function() + vim.b.disable_autoformat = not vim.b.disable_autoformat + vim.notify( + "Buffer auto-format on-save: " .. (vim.b.disable_autoformat and "OFF" or "ON"), + vim.log.levels.INFO + ) + end, { desc = "Toggle auto-format on-save for buffer." }) + + vim.keymap.set({ "n" }, "ftg", function() + vim.g.disable_autoformat = not vim.g.disable_autoformat + vim.notify( + "Global auto-format on-save: " .. (vim.g.disable_autoformat and "OFF" or "ON"), + vim.log.levels.INFO + ) + end, { desc = "Toggle auto-format on-save globally." }) + end, +} diff --git a/lua/plugins/lint.lua b/lua/plugins/lint.lua new file mode 100644 index 0000000..dca7d28 --- /dev/null +++ b/lua/plugins/lint.lua @@ -0,0 +1,27 @@ +return { + "mfussenegger/nvim-lint", + enabled = false, + event = { "BufReadPre", "BufNewFile" }, + opts = { + linters_by_ft = { + lua = { "selene" }, + cpp = { "cpplint" }, + c = { "cpplint" }, + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + python = { "pylint" }, + markdown = { "markdownlint" }, + java = { "trivy" }, + php = { "phpcs" }, + }, + }, + config = function() + local lint = require("lint") + -- TODO create auto command ran after Buffer Wrote + vim.keymap.set("n", "cl", function() + lint.try_lint() + end, { desc = "Trigger linting for current file" }) + end, +} diff --git a/lua/plugins/linter_formatter.lua b/lua/plugins/linter_formatter.lua index aea0654..61bf368 100644 --- a/lua/plugins/linter_formatter.lua +++ b/lua/plugins/linter_formatter.lua @@ -1,24 +1,24 @@ return { - { - 'williamboman/mason.nvim', - cmd = { 'Mason', 'MasonInstall', 'MasonInstallAll', 'MasonUpdate' }, - dependencies = { - { 'williamboman/mason-lspconfig.nvim', event = { 'BufReadPre', 'BufNewFile' } }, - { 'WhoIsSethDaniel/mason-tool-installer.nvim' }, - { 'zapling/mason-lock.nvim', cmd = { 'MasonLock', 'MasonLockRestore' }, opts = {} }, - }, - config = function() - require('mason').setup() - end, - }, - { - 'nvimtools/none-ls.nvim', -- configure formatters & linters - event = { 'BufRead', 'FileType' }, - dependencies = { - 'jay-babu/mason-null-ls.nvim', - }, - config = function() - require('configs.none-ls') - end, - }, + { + "williamboman/mason.nvim", + cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" }, + dependencies = { + { "williamboman/mason-lspconfig.nvim", event = { "BufReadPre", "BufNewFile" } }, + { "WhoIsSethDaniel/mason-tool-installer.nvim" }, + { "zapling/mason-lock.nvim", cmd = { "MasonLock", "MasonLockRestore" }, opts = {} }, + }, + config = function() + require("mason").setup() + end, + }, + { + "nvimtools/none-ls.nvim", -- configure formatters & linters + event = { "BufRead", "FileType" }, + dependencies = { + "jay-babu/mason-null-ls.nvim", + }, + config = function() + require("configs.none-ls") + end, + }, } diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index 0819162..1e162c6 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -1,60 +1,82 @@ return { - { - 'echasnovski/mini.nvim', - event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, - version = false, - config = function() - require('mini.comment').setup({}) - require('mini.ai').setup({}) - require('mini.cursorword').setup() - -- require("mini.tabline").setup() - require('mini.bracketed').setup({ - file = { suffix = '' }, - window = { suffix = '' }, - quickfix = { suffix = '' }, - yank = { suffix = '' }, - treesitter = { suffix = 'n' }, - }) - require('mini.surround').setup({ - mappings = { - add = 'gsa', -- Add surrounding in Normal and Visual modes - delete = 'gsd', -- Delete surrounding - replace = 'gsr', -- Replace surrounding - find = 'gsf', -- Find surrounding (to the right) - find_left = 'gsF', -- Find surrounding (to the left) - highlight = 'gsh', -- Highlight surrounding - update_n_lines = 'gsn', -- Update `n_lines` - }, - keys = { - { 'gz', '', desc = '+surround' }, - }, - }) - require('mini.pairs').setup({ - odes = { command = true }, - mappings = { - ['<'] = { action = 'open', pair = '<>', neigh_pattern = '[^\\].' }, - ['>'] = { action = 'close', pair = '<>', neigh_pattern = '[^\\].' }, - }, - }) - require('mini.move').setup({ - keys = { - { '', mode = { 'n', 'v' } }, - { '', mode = { 'n', 'v' } }, - { '', mode = { 'n', 'v' } }, - { '', mode = { 'n', 'v' } }, - }, + { + "echasnovski/mini.nvim", + event = { "BufReadPost", "BufAdd", "BufNewFile" }, + version = false, + config = function() + require("mini.comment").setup({}) + require("mini.ai").setup({}) + require("mini.cursorword").setup() + require("mini.bracketed").setup({ + file = { suffix = "" }, + window = { suffix = "" }, + quickfix = { suffix = "" }, + yank = { suffix = "" }, + treesitter = { suffix = "n" }, + }) + require("mini.surround").setup({ + mappings = { + add = "gsa", -- Add surrounding in Normal and Visual modes + delete = "gsd", -- Delete surrounding + replace = "gsr", -- Replace surrounding + find = "gsf", -- Find surrounding (to the right) + find_left = "gsF", -- Find surrounding (to the left) + highlight = "gsh", -- Highlight surrounding + update_n_lines = "gsn", -- Update `n_lines` + }, + keys = { + { "gz", "", desc = "+surround" }, + }, + }) + require("mini.pairs").setup({ + -- odes = { command = true }, + -- mappings = { + -- ['<'] = { action = 'open', pair = '<>', neigh_pattern = '[^\\].' }, + -- ['>'] = { action = 'close', pair = '<>', neigh_pattern = '[^\\].' }, + -- }, + }) + require("mini.move").setup({ + keys = { + { "", mode = { "n", "v" } }, + { "", mode = { "n", "v" } }, + { "", mode = { "n", "v" } }, + { "", mode = { "n", "v" } }, + }, - mappings = { - left = '', - line_left = '', - right = '', - line_right = '', - down = '', - line_down = '', - up = '', - line_up = '', - }, - }) - end, - }, + mappings = { + left = "", + line_left = "", + right = "", + line_right = "", + down = "", + line_down = "", + up = "", + line_up = "", + }, + }) + end, + }, + { + "echasnovski/mini.files", + version = false, + keys = { + { "-", "lua require('mini.files').open(vim.api.nvim_buf_get_name(0))", { silent = true } }, + }, + }, + { + "echasnovski/mini.icons", + opts = {}, + lazy = true, + specs = { + { "nvim-tree/nvim-web-devicons", enabled = false, optional = true }, + }, + init = function() + package.preload["nvim-web-devicons"] = function() + -- needed since it will be false when loading and mini will fail + package.loaded["nvim-web-devicons"] = {} + require("mini.icons").mock_nvim_web_devicons() + return package.loaded["nvim-web-devicons"] + end + end, + }, } diff --git a/lua/plugins/other.lua b/lua/plugins/other.lua index 903e3f2..1210907 100644 --- a/lua/plugins/other.lua +++ b/lua/plugins/other.lua @@ -1,170 +1,198 @@ return { - { - 'folke/persistence.nvim', - event = 'BufReadPre', - opts = { options = vim.opt.sessionoptions:get() }, - keys = { - { - 'ms', - function() - require('persistence').load() - end, - desc = 'Restore Session', - }, - { - 'ml', - function() - require('persistence').load({ last = true }) - end, - desc = 'Restore Last Session', - }, - { - 'md', - function() - require('persistence').stop() - end, - desc = "Don't Save Current Session", - }, - }, - }, - { - 'nvim-lua/plenary.nvim', - lazy = true, - }, - { - 'iamcco/markdown-preview.nvim', - build = 'cd app && yarn install', - ft = { 'markdown' }, - keys = { - { - 'cm', - 'MarkdownPreviewToggle', - desc = 'toggle markdown preview', - }, - }, - }, - { - 'nvim-pack/nvim-spectre', - build = false, - cmd = 'Spectre', - opts = { open_cmd = 'noswapfile vnew' }, - keys = { - { - 'mr', - function() - require('spectre').open() - end, - desc = 'Replace in Files (Spectre)', - }, - }, - }, - { - 'szw/vim-maximizer', + { + "ThePrimeagen/refactoring.nvim", + config = function() + require("refactoring").setup() + -- vim.keymap.set("x", "re", ":Refactor extract ") + -- vim.keymap.set("x", "rf", ":Refactor extract_to_file ") + -- + -- vim.keymap.set("x", "rv", ":Refactor extract_var ") + -- + -- vim.keymap.set({ "n", "x" }, "ri", ":Refactor inline_var") + -- + -- vim.keymap.set("n", "rI", ":Refactor inline_func") + -- + -- vim.keymap.set("n", "rb", ":Refactor extract_block") + -- vim.keymap.set("n", "rbf", ":Refactor extract_block_to_file") + -- load refactoring Telescope extension + require("telescope").load_extension("refactoring") - keys = { - { 'mm', 'MaximizerToggle', desc = 'Maximize/minimize a split' }, - }, - }, - { - 'folke/zen-mode.nvim', - cmd = { 'ZenMode' }, - opts = {}, - keys = { - { 'wz', 'ZenMode', desc = 'Toggle zen mode' }, - }, - }, - { - 'chrisgrieser/nvim-recorder', - dependencies = { 'rcarriga/nvim-notify' }, - event = 'VeryLazy', - vscode = true, - keys = { - { 'q', desc = 'Start Recording' }, - { 'Q', desc = 'Play Recording' }, - { '', desc = 'Switch Slot' }, - { 'cq', desc = 'Edit Macro' }, - { 'yq', desc = 'Yank Macro' }, - { 'dq', desc = 'Delete All Macros' }, - }, - opts = { - useNerdFontsIcons = false, - slots = { 'a', 'b', 'c', 'd' }, - mapping = { - startStopRecording = 'q', - playMacro = 'Q', - editMacro = 'cq', - switchSlot = '', - deleteAllMacros = 'dq', - yankMacro = 'yq', - }, - }, - }, - { - 'creativenull/dotfyle-metadata.nvim', - cmd = { 'DotfyleGenerate', 'DotfyleOpen' }, - }, - { - 'willothy/flatten.nvim', - priority = 1001, - opts = { - window = { - open = 'alternate', - }, - }, - }, - { - 'wakatime/vim-wakatime', - lazy = false, - }, - { - 'mvllow/modes.nvim', - event = { 'BufReadPost', 'BufNewFile' }, - tag = 'v0.2.0', - config = function() - require('modes').setup({ + vim.keymap.set({ "n", "x" }, "rr", function() + require("telescope").extensions.refactoring.refactors() + end, { desc = "Refactor" }) + end, + }, + { + "2kabhishek/nerdy.nvim", + dependencies = { "stevearc/dressing.nvim" }, + cmd = "Nerdy", + }, + { + "folke/persistence.nvim", + event = "BufReadPre", + opts = { options = vim.opt.sessionoptions:get() }, + keys = { + { + "ms", + function() + require("persistence").load() + end, + desc = "Restore Session", + }, + { + "ml", + function() + require("persistence").load({ last = true }) + end, + desc = "Restore Last Session", + }, + { + "md", + function() + require("persistence").stop() + end, + desc = "Don't Save Current Session", + }, + }, + }, + { + "nvim-lua/plenary.nvim", + lazy = true, + }, + { + "iamcco/markdown-preview.nvim", + build = "cd app && yarn install", + ft = { "markdown" }, + keys = { + { + "cm", + "MarkdownPreviewToggle", + desc = "toggle markdown preview", + }, + }, + }, + { + "nvim-pack/nvim-spectre", + build = false, + cmd = "Spectre", + opts = { open_cmd = "noswapfile vnew" }, + keys = { + { + "mr", + function() + require("spectre").open() + end, + desc = "Replace in Files (Spectre)", + }, + }, + }, + { + "szw/vim-maximizer", - colors = { - visual = '#f5c359', - delete = '#c75c6a', - copy = '#78ccc5', - insert = '#c5739a', - }, - line_opacity = 0.15, - set_cursor = true, - set_cursorline = true, - set_number = true, - ignore_filetypes = { 'NvimTree', 'TelescopePrompt' }, - }) - end, - }, - { - 'LunarVim/bigfile.nvim', - event = { 'BufEnter', 'WinEnter' }, - opts = { - -- Disables LSP/treesitter, etc for files above 5000 lives (even if they have really long lines) - pattern = function(bufnr, filesize_mib) - if filesize_mib >= 2 then - return true - end - -- you can't use `nvim_buf_line_count` because this runs on BufReadPre - local file_contents = vim.fn.readfile(vim.api.nvim_buf_get_name(bufnr)) - local file_length = #file_contents - if file_length > 5000 then - return true - end + keys = { + { "mm", "MaximizerToggle", desc = "Maximize/minimize a split" }, + }, + }, + { + "folke/zen-mode.nvim", + cmd = { "ZenMode" }, + opts = {}, + keys = { + { "wz", "ZenMode", desc = "Toggle zen mode" }, + }, + }, + { + "chrisgrieser/nvim-recorder", + dependencies = { "rcarriga/nvim-notify" }, + event = "VeryLazy", + vscode = true, + keys = { + { "q", desc = "Start Recording" }, + { "Q", desc = "Play Recording" }, + { "", desc = "Switch Slot" }, + { "cq", desc = "Edit Macro" }, + { "yq", desc = "Yank Macro" }, + { "dq", desc = "Delete All Macros" }, + }, + opts = { + useNerdFontsIcons = false, + slots = { "a", "b", "c", "d" }, + mapping = { + startStopRecording = "q", + playMacro = "Q", + editMacro = "cq", + switchSlot = "", + deleteAllMacros = "dq", + yankMacro = "yq", + }, + }, + }, + { + "creativenull/dotfyle-metadata.nvim", + cmd = { "DotfyleGenerate", "DotfyleOpen" }, + }, + { + "willothy/flatten.nvim", + priority = 1001, + opts = { + window = { + open = "alternate", + }, + }, + }, + { + "wakatime/vim-wakatime", + lazy = false, + }, + { + "mvllow/modes.nvim", + event = { "BufReadPost", "BufNewFile" }, + tag = "v0.2.0", + config = function() + require("modes").setup({ - return false - end, - }, - }, - { - 'm4xshen/hardtime.nvim', - config = function() - require('hardtime').setup({ enabled = true }) - end, - cmd = 'Hardtime', - init = function() - vim.keymap.set('n', 'ch', 'HardtimeToggle', { desc = 'Toggle Hardtime' }) - end, - }, + colors = { + visual = "#f5c359", + delete = "#c75c6a", + copy = "#78ccc5", + insert = "#c5739a", + }, + line_opacity = 0.15, + set_cursor = true, + set_cursorline = true, + set_number = true, + ignore_filetypes = { "NvimTree", "TelescopePrompt" }, + }) + end, + }, + { + "LunarVim/bigfile.nvim", + event = { "BufEnter", "WinEnter" }, + opts = { + -- Disables LSP/treesitter, etc for files above 5000 lives (even if they have really long lines) + pattern = function(bufnr, filesize_mib) + if filesize_mib >= 2 then + return true + end + -- you can't use `nvim_buf_line_count` because this runs on BufReadPre + local file_contents = vim.fn.readfile(vim.api.nvim_buf_get_name(bufnr)) + local file_length = #file_contents + if file_length > 5000 then + return true + end + + return false + end, + }, + }, + { + "m4xshen/hardtime.nvim", + config = function() + require("hardtime").setup({ enabled = true }) + end, + cmd = "Hardtime", + init = function() + vim.keymap.set("n", "ch", "HardtimeToggle", { desc = "Toggle Hardtime" }) + end, + }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 914cef9..765b233 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,222 +1,187 @@ return { - { - 'rcarriga/nvim-notify', - event = 'VeryLazy', - keys = { - { - 'mn', - function() - require('notify').dismiss({ silent = true, pending = true }) - end, - desc = 'Dismiss All Notifications', - }, - }, - opts = { - level = 2, - minimum_width = 50, - stages = 'fade', - timeout = 3000, - top_down = true, - render = 'compact', - background_colour = '#000000', - }, - }, - { - 'folke/noice.nvim', - event = 'UIEnter', - dependencies = { - { 'MunifTanjim/nui.nvim', lazy = true }, - 'rcarriga/nvim-notify', - }, - opts = { - cmdline = { - view = 'cmdline', - format = { - cmdline = { icon = '▍' }, - substitute = { - pattern = '^:%%?s/', - icon = ' ', - ft = 'regex', - opts = { border = { text = { top = ' sub (old/new/) ' } } }, - }, - input = { view = 'cmdline_input', icon = '█' }, - }, - }, - routes = { - { - view = 'notify', - filter = { event = 'msg_showmode' }, - }, - { - filter = { - event = 'msg_show', - kind = '', - find = 'written', - }, - opts = { skip = true }, - }, - }, - lsp = { - progress = { - enabled = false, - -- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin - -- See the section on formatting for more details on how to customize. - format = 'lsp_progress', - format_done = 'lsp_progress_done', - throttle = 1000 / 30, -- frequency to update lsp progress message - view = 'mini', - }, - override = { - -- override the default lsp markdown formatter with Noice - ['vim.lsp.util.convert_input_to_markdown_lines'] = true, - -- override the lsp markdown formatter with Noice - ['vim.lsp.util.stylize_markdown'] = true, - -- override cmp documentation with Noice (needs the other options to work) - ['cmp.entry.get_documentation'] = true, - }, - hover = { - enabled = true, - silent = false, -- set to true to not show a message if hover is not available - view = nil, -- when nil, use defaults from documentation - opts = {}, -- merged with defaults from documentation - }, - signature = { - enabled = false, - auto_open = { - enabled = true, - trigger = true, -- Automatically show signature help when typing a trigger character from the LSP - luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes - throttle = 50, -- Debounce lsp signature help request by 50ms - }, - view = nil, -- when nil, use defaults from documentation - opts = {}, -- merged with defaults from documentation - }, - message = { - -- Messages shown by lsp servers - enabled = true, - view = 'notify', - opts = {}, - }, - -- defaults for hover and signature help - documentation = { - view = 'hover', - opts = { - lang = 'markdown', - replace = true, - render = 'plain', - format = { '{message}' }, - win_options = { concealcursor = 'n', conceallevel = 3 }, - }, - }, - }, - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = false, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = true, -- add a border to hover docs and signature help - }, - }, - }, - { - 'stevearc/dressing.nvim', - event = 'VeryLazy', - }, - { - 'akinsho/bufferline.nvim', - event = 'UIEnter', - version = '*', - config = function() - require('bufferline').setup({ - options = { - close_command = function() - require('bufdelete').bufdelete(0, true) - end, - right_mouse_command = function() - require('bufdelete').bugdelete(0, false) - end, - diagnostics = 'nvim_lsp', - always_show_bufferline = true, - buffer_close_icon = '', - modified_icon = '', - close_icon = '', - left_trunc_marker = '', - right_trunc_marker = '', - offsets = { - { - filetype = 'neo-tree', - text = 'Neo-tree', - highlight = 'Directory', - text_align = 'left', - }, - }, - }, - }) - end, - }, - { - 'nvim-lualine/lualine.nvim', - event = { 'BufReadPost', 'BufNewFile' }, - config = function() - require('configs.lualine') - end, - }, - { - 'nvim-tree/nvim-web-devicons', - config = true, - }, - { - 'lukas-reineke/indent-blankline.nvim', - main = 'ibl', - event = { 'BufReadPost', 'BufNewFile' }, - opts = { - exclude = { - filetypes = { 'help', 'alpha', 'dashboard', 'neo-tree', 'Trouble', 'lazy' }, - }, - }, - }, + { + "rcarriga/nvim-notify", + event = "VeryLazy", + keys = { + { + "mn", + function() + require("notify").dismiss({ silent = true, pending = true }) + end, + desc = "Dismiss All Notifications", + }, + }, + opts = { + level = 2, + minimum_width = 50, + stages = "fade", + timeout = 3000, + top_down = true, + render = "compact", + background_colour = "#000000", + }, + }, + { + "folke/noice.nvim", + event = "UIEnter", + dependencies = { + { "MunifTanjim/nui.nvim", lazy = true }, + "rcarriga/nvim-notify", + }, + opts = { + cmdline = { + view = "cmdline", + format = { + cmdline = { icon = "▍" }, + substitute = { + pattern = "^:%%?s/", + icon = " ", + ft = "regex", + opts = { border = { text = { top = " sub (old/new/) " } } }, + }, + input = { view = "cmdline_input", icon = "█" }, + }, + }, + routes = { + { + view = "notify", + filter = { event = "msg_showmode" }, + }, + { + filter = { + event = "msg_show", + kind = "", + find = "written", + }, + opts = { skip = true }, + }, + }, + lsp = { + progress = { + enabled = false, + -- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin + -- See the section on formatting for more details on how to customize. + format = "lsp_progress", + format_done = "lsp_progress_done", + throttle = 1000 / 30, -- frequency to update lsp progress message + view = "mini", + }, + override = { + -- override the default lsp markdown formatter with Noice + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + -- override the lsp markdown formatter with Noice + ["vim.lsp.util.stylize_markdown"] = true, + -- override cmp documentation with Noice (needs the other options to work) + ["cmp.entry.get_documentation"] = true, + }, + hover = { + enabled = true, + silent = false, -- set to true to not show a message if hover is not available + view = nil, -- when nil, use defaults from documentation + opts = {}, -- merged with defaults from documentation + }, + signature = { + enabled = false, + auto_open = { + enabled = true, + trigger = true, -- Automatically show signature help when typing a trigger character from the LSP + luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes + throttle = 50, -- Debounce lsp signature help request by 50ms + }, + view = nil, -- when nil, use defaults from documentation + opts = {}, -- merged with defaults from documentation + }, + message = { + -- Messages shown by lsp servers + enabled = true, + view = "notify", + opts = {}, + }, + -- defaults for hover and signature help + documentation = { + view = "hover", + opts = { + lang = "markdown", + replace = true, + render = "plain", + format = { "{message}" }, + win_options = { concealcursor = "n", conceallevel = 3 }, + }, + }, + }, + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = false, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = true, -- add a border to hover docs and signature help + }, + }, + }, + { + "stevearc/dressing.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local dressing = require("dressing") - { - 'utilyre/barbecue.nvim', - name = 'barbecue', - version = '*', - event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, - dependencies = { - 'SmiteshP/nvim-navic', - }, - opts = {}, - keys = { - { - 'bq', - function() - require('barbecue.ui').toggle() - end, - desc = 'toggle barbecue', - }, - }, - config = function() - require('barbecue').setup({ - create_autocmd = false, -- prevent barbecue from updating itself automatically - }) - - vim.api.nvim_create_autocmd({ - 'WinScrolled', -- or WinResized on NVIM-v0.9 and higher - 'BufWinEnter', - 'CursorHold', - 'InsertLeave', - }, { - group = vim.api.nvim_create_augroup('barbecue.updater', {}), - callback = function() - require('barbecue.ui').update() - end, - }) - end, - }, - { - 'goolord/alpha-nvim', - event = 'VimEnter', - config = function() - require('configs.alpha') - end, - }, + dressing.setup({ + win_options = { + winblend = 10, + winhighlight = "Normal:DressingInputNormalFloat,NormalFloat:DressingInputNormalFloat,FloatBorder:DressingInputFloatBorder", + }, + input = { + enabled = true, + default_prompt = "Input:", + prompt_align = "left", + insert_only = true, + start_in_insert = true, + border = "rounded", + relative = "cursor", + prefer_width = 40, + width = nil, + max_width = { 140, 0.9 }, + min_width = { 20, 0.2 }, + get_config = nil, + }, + select = { + enabled = true, + backend = { "telescope", "fzf_lua", "fzf", "nui", "builtin" }, + trim_prompt = true, + }, + }) + end, + }, + { + "nvim-lualine/lualine.nvim", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("configs.lualine") + end, + }, + -- { + -- "nvim-tree/nvim-web-devicons", + -- config = true, + -- }, + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + event = { "BufReadPost", "BufNewFile" }, + opts = { + exclude = { + filetypes = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy" }, + }, + }, + }, + { + "nvimdev/dashboard-nvim", + cmd = "Dashboard", + config = function() + require("configs.dashboard") + end, + event = function() + if vim.fn.argc() == 0 then + return "VimEnter" + end + end, + }, } diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 7e87321..219ed3e 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -1,13 +1,17 @@ +local icons = require("lib.icons") return { "folke/which-key.nvim", event = "UIEnter", opts = { preset = "helix", icons = { - breadcrumb = " ", - separator = " ", + breadcrumb = icons.ui.ArrowOpen, + separator = icons.ui.Arrow, group = "", - rules = false, + keys = { + Space = icons.ui.Rocket, + }, + rules = false, -- enable auto icon rules }, triggers = { { "", mode = "nixsotc" }, @@ -30,6 +34,7 @@ return { { "m", group = "󰠠 Misc" }, { "n", group = " Notes" }, { "q", group = " Quit" }, + { "r", group = " Run" }, { "s", group = " Split" }, { "t", group = " Terminal" }, { "u", group = " Test" }, @@ -51,7 +56,7 @@ return { { "cR", "ReloadConfig", desc = "Reload Configs" }, { "cd", "RootDir", desc = "Root Directory" }, { "cc", ":g/^\\s*$/d", desc = "Clean Empty Lines" }, - { "co", "Alpha", desc = "Alpha" }, + { "co", "Dashboard", desc = "Dashboard" }, { "cr", "Telescope reloader", desc = "Reload Module" }, --edit { "ea", "b#", desc = "Alternate File" }, diff --git a/mason-lock.json b/mason-lock.json index cb32add..dcc7023 100644 --- a/mason-lock.json +++ b/mason-lock.json @@ -1,4 +1,5 @@ { + "actionlint": "v1.7.1", "bash-language-server": "5.4.0", "biome": "1.8.3", "black": "24.8.0", @@ -8,21 +9,34 @@ "emmet-ls": "0.4.2", "eslint-lsp": "4.10.0", "eslint_d": "14.0.3", - "goimports-reviser": "v3.6.5", - "graphql-language-service-cli": "3.5.0", + "golangci-lint": "v1.60.2", + "google-java-format": "v1.23.0", + "hadolint": "v2.12.0", "html-lsp": "4.10.0", "isort": "5.13.2", "jdtls": "v1.38.0", "json-lsp": "4.10.0", - "lua-language-server": "3.10.3", + "lua-language-server": "3.10.5", + "markdownlint": "0.41.0", "prettier": "3.3.3", - "prisma-language-server": "5.18.0", + "prettierd": "0.25.3", + "proselint": "0.14.0", "pylint": "3.2.6", - "pyright": "1.1.376", + "pyright": "1.1.377", "python-lsp-server": "1.11.0", + "rubocop": "1.65.1", + "ruff-lsp": "0.0.55", + "rust-analyzer": "2024-08-19", + "selene": "0.27.1", + "shellcheck": "v0.10.0", + "shfmt": "v3.9.0", + "solargraph": "0.50.0", "stylua": "v0.20.0", - "svelte-language-server": "0.16.14", "tailwindcss-language-server": "0.0.22", + "trivy": "v0.54.1", "typescript-language-server": "4.3.3", - "vim-language-server": "2.3.1" + "typos-lsp": "v0.1.22", + "vim-language-server": "2.3.1", + "vint": "0.3.21", + "write-good": "1.0.8" } \ No newline at end of file diff --git a/plugin/after/highlights.lua b/plugin/after/highlights.lua new file mode 100644 index 0000000..24ac199 --- /dev/null +++ b/plugin/after/highlights.lua @@ -0,0 +1,28 @@ +-- transparent background +vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Terminal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'EndOfBuffer', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'FoldColumn', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Folded', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'SignColumn', { bg = 'none' }) + +-- transparent background for nvim-tree +vim.api.nvim_set_hl(0, 'NvimTreeNormal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NvimTreeVertSplit', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NvimTreeEndOfBuffer', { bg = 'none' }) + +-- set hlsearch color +vim.api.nvim_set_hl(0, 'Search', { bg = '#8BCD5B', fg = '#202020' }) +vim.api.nvim_set_hl(0, 'CurSearch', { bg = '#EFBD5D', fg = '#000000' }) +vim.api.nvim_set_hl(0, 'IncSearch', { bg = '#F15664', fg = '#000000' }) + +-- set cursorline color +vim.api.nvim_set_hl(0, 'CursorLine', { bg = '#1A1A1F' }) +vim.api.nvim_set_hl(0, 'CursorColumn', { bg = '#1A1A1F' }) + +-- set visual highlight +vim.api.nvim_set_hl(0, 'Visual', { bg = '#103070' }) +