diff --git a/lazy-lock.json b/lazy-lock.json index 06761ad..83c8054 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,33 +1,44 @@ { - "LuaSnip": { "branch": "master", "commit": "79cc25c39878401d4e8b6ec42fcf14639426bafc" }, + "LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, + "bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" }, + "bufferline.nvim": { "branch": "main", "commit": "73540cb95f8d95aa1af3ed57713c6720c78af915" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, - "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, - "hardtime.nvim": { "branch": "main", "commit": "21b0f9146198bb43fbc9f5ec66c8af3234f278ed" }, + "conform.nvim": { "branch": "master", "commit": "12b3995537f52ba2810a9857e8ca256881febbda" }, + "dressing.nvim": { "branch": "master", "commit": "5162edb1442a729a885c45455a07e9a89058be2f" }, + "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, + "friendly-snippets": { "branch": "main", "commit": "d5f74ce4dfdd82848f3f4eac65fe6e29ac5df4c2" }, + "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, - "lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" }, + "lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" }, + "lazygit.nvim": { "branch": "main", "commit": "0ada6c6e7e138df92f5009b6952f4ac41248305a" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "b129892f783740e6cf741f2ea09fa5dd512aa584" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "16d1b194376bf1fc2acd89ccb3c29ba8315bfcea" }, + "mini.comment": { "branch": "main", "commit": "f9f1a646fd3d9df7397aa1b9550a875fe8189eb0" }, + "mini.indentscope": { "branch": "main", "commit": "a8274b6ea2d868198d27bd91a31ed5ea3a6a5744" }, + "mini.pairs": { "branch": "main", "commit": "5c975d8f68dc1e11bf4b20ced71e7987ed782513" }, + "mini.surround": { "branch": "main", "commit": "0f528eb2e1bab420c0569d9e52615144c51db920" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "7aad1bf3f6b849cbf108e02c55ad4d701cb4d33a" }, + "noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" }, "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" }, - "nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" }, - "nvim-cmp": { "branch": "main", "commit": "2fb2a3cf78bbc1b0bea030e8c8728985af1cf302" }, - "nvim-lint": { "branch": "master", "commit": "6670b3ac73fa4caf720f017b91c619e9424d955e" }, - "nvim-lspconfig": { "branch": "master", "commit": "f4619ab31fc4676001ea05ae8200846e6e7700c7" }, - "nvim-treesitter": { "branch": "master", "commit": "30492e7e1c9e5af3642e8a74c2f88dc1f50ec305" }, - "nvim-treesitter-context": { "branch": "master", "commit": "f19766163c18515fb4d3c12d572bf9cba6cdb990" }, - "nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" }, - "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, + "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, + "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, + "nvim-lint": { "branch": "master", "commit": "861a04313501563bb1b11f125ae9b7237a517b9b" }, + "nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" }, + "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, + "nvim-spectre": { "branch": "master", "commit": "4651801ba37a9407b7257287aec45b6653ffc5e9" }, + "nvim-treesitter": { "branch": "master", "commit": "b1f3f02027f1fd21956c1e219878764014498a59" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2650e6431f7daba5d9c2c64134fa5eb2312eb3d7" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" }, + "nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" }, + "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "tokyonight.nvim": { "branch": "main", "commit": "9bf9ec53d5e87b025e2404069b71e7ebdc3a13e5" }, + "tokyonight.nvim": { "branch": "main", "commit": "67afeaf7fd6ebba000633e89f63c31694057edde" }, "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, - "vim-commentary": { "branch": "master", "commit": "f67e3e67ea516755005e6cccb178bc8439c6d402" }, - "vim-fugitive": { "branch": "master", "commit": "c0b03f1cac242d96837326d300f42a660306fc1a" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 39927ae..1f6502d 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -1,21 +1,12 @@ local function augroup(name) - return vim.api.nvim_create_augroup("wf_" .. name, { clear = true }) + return vim.api.nvim_create_augroup("wf_" .. name, { clear = true }) end vim.api.nvim_create_autocmd({ "FileType" }, { - group = augroup("spellcheck"), - pattern = { "gitcommit", "markdown", "md", "mdx" }, - callback = function() - vim.opt_local.spell = true - vim.opt_local.wrap = true - end, + group = augroup("spellcheck"), + pattern = { "gitcommit", "markdown", "md", "mdx" }, + callback = function() + vim.opt_local.spell = true + vim.opt_local.wrap = true + end, }) - --- vim.api.nvim_create_autocmd({ "FileType" }, { --- group = augroup("close_with_q"), --- pattern = { "fugitive", "git", "gitcommit" }, --- callback = function(event) --- vim.bo[event.buf].buflisted = false --- vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) --- end, --- }) diff --git a/lua/keybinds.lua b/lua/keybinds.lua index c875b40..5f4a455 100644 --- a/lua/keybinds.lua +++ b/lua/keybinds.lua @@ -3,6 +3,10 @@ vim.keymap.set("n", "", "", { desc = "Go to split above" }) vim.keymap.set("n", "", "", { desc = "Go to split below" }) vim.keymap.set("n", "", "", { desc = "Go to split on right" }) +vim.keymap.set("n", "|", "v", { desc = "Split window right" }) +vim.keymap.set("n", "-", "s", { desc = "Split window below" }) +vim.keymap.set("n", "wd", "c", { desc = "Delete window" }) + vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = "Move lines under cursor up" }) vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = "Move lines under cursor down" }) @@ -14,7 +18,4 @@ vim.keymap.set("x", "p", "\"_dP", { desc = "Paste without replacing clip vim.keymap.set("n", "y", "\"*y", { desc = "Yank into system clipboard" }) vim.keymap.set("v", "y", "\"*y", { desc = "Yank into system clipboard" }) -vim.keymap.set("n", "s", [[:%s/\<\>//gI]], - { desc = "Like `ciw` for any highlighted text (doesn't have to be word)" }) - vim.keymap.set("i", "jk", "", { desc = "Exit insert mode" }) diff --git a/lua/options.lua b/lua/options.lua index 68e05f4..e08d218 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -42,3 +42,5 @@ vim.opt.fillchars = { vim.opt.foldlevel = 99 vim.opt.foldmethod = "indent" + +vim.opt.termguicolors = true diff --git a/lua/plugins/alpha-nvim.lua b/lua/plugins/alpha-nvim.lua deleted file mode 100644 index b4ee958..0000000 --- a/lua/plugins/alpha-nvim.lua +++ /dev/null @@ -1,43 +0,0 @@ -return { - 'goolord/alpha-nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - local alpha = require("alpha") - local dashboard = require("alpha.themes.dashboard") - - -- https://github.com/MaximilianLloyd/ascii.nvim - dashboard.section.header.val = { - " ", - " ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ", - " ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ", - " ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ", - " ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ", - " ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ", - " ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ", - " ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ", - " ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ", - " ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ", - " ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ", - " ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ", - " ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ", - " ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ", - " ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ", - " ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ", - " ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ", - " ▄█████████▄▄ ", - " ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ", - " ▄▄█████▀▀▀▀ ▀■ ", - " ▄███▀▀▀▀ ", - " ■▀▀ ", - " ", - } - - dashboard.section.buttons.val = { - dashboard.button("e", " > New File", "ene"), - dashboard.button("SPC ee", " > File explorer", "Neotree"), - dashboard.button("q", " > Quit", "qa"), - } - - alpha.setup(dashboard.opts) - end -}; diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua new file mode 100644 index 0000000..5ec6181 --- /dev/null +++ b/lua/plugins/coding.lua @@ -0,0 +1,100 @@ +return { + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + }, + config = function() + local cmp = require("cmp") + + cmp.setup({ + -- Highlights the first result always + completion = { + completeopt = "menu,menuone,noinsert", + }, + + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i" }), + [""] = cmp.mapping.confirm({ select = true }), + }), + + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end + }, + + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, + { + "L3MON4D3/LuaSnip", + dependencies = { "rafamadriz/friendly-snippets" }, + }, + { + "echasnovski/mini.pairs", + version = false, + opts = { + mappings = { + ["`"] = { action = "closeopen", pair = "``", neigh_pattern = "[^\\`].", register = { cr = false } }, + }, + }, + }, + { + "echasnovski/mini.surround", + version = false, + opts = { + mappings = { + add = "gsa", -- Add surrounding in Normal and Visual modes + delete = "gsd", -- Delete surrounding + find = "gsf", -- Find surrounding (to the right) + find_left = "gsF", -- Find surrounding (to the left) + highlight = "gsh", -- Highlight surrounding + replace = "gsr", -- Replace surrounding + update_n_lines = "gsn", -- Update `n_lines` + }, + }, + }, + { + "JoosepAlviste/nvim-ts-context-commentstring", + opts = { + enable_autocmd = false, + }, + }, + { + "echasnovski/mini.comment", + version = false, + opts = { + options = { + custom_commentstring = function() + return require("ts_context_commentstring.internal").calculate_commentstring() + or vim.bo.commentstring + end, + }, + }, + }, +} diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 890c312..cde1558 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -2,7 +2,8 @@ return { "folke/tokyonight.nvim", lazy = true, opts = { + style = "storm", transparent = true, dim_inactive = true, - } + }, } diff --git a/lua/plugins/commentary.lua b/lua/plugins/commentary.lua deleted file mode 100644 index 4e85c75..0000000 --- a/lua/plugins/commentary.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "tpope/vim-commentary" -} diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua deleted file mode 100644 index 6696501..0000000 --- a/lua/plugins/completion.lua +++ /dev/null @@ -1,59 +0,0 @@ -return { - { - "hrsh7th/nvim-cmp", - config = function() - local cmp = require("cmp") - - cmp.setup({ - -- Highlights the first result always - completion = { - completeopt = "menu,menuone,noinsert" - }, - - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { "i" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i" }), - [""] = cmp.mapping.confirm({ - behaviour = cmp.ConfirmBehavior.Insert, - select = true - }) - }), - - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end - }, - - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" } - }, { - { name = "buffer" } - }) - }) - end - }, - { - "hrsh7th/cmp-nvim-lsp" - }, - { - "L3MON4D3/LuaSnip" - } -} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua new file mode 100644 index 0000000..cb91684 --- /dev/null +++ b/lua/plugins/editor.lua @@ -0,0 +1,171 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + event = "VeryLazy", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set("n", "ee", ":Neotree toggle", { desc = "Toggle Neotree" }) + vim.keymap.set("n", "er", ":Neotree reveal", { desc = "Reveal file" }) + + local nt = require("neo-tree") + + nt.setup({ + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, + filesystem = { + filtered_items = { + show_hidden_count = false, + hide_dotfiles = false, + hide_gitignored = true, + always_show = { + ".env", + ".env.local", + }, + never_show = { + ".git", + "thumbs.db", + ".DS_Store", + }, + }, + }, + window = { + mappings = { + ["m"] = { + "move", + config = { + show_path = "relative", + }, + }, + }, + }, + event_handlers = { + { + event = "neo_tree_popup_input_ready", + handler = function() + -- Switch to normal inside popups by default. + vim.cmd.stopinsert() + end, + }, + }, + }) + end, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = {}, + }, + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + vim.keymap.set("n", "tt", ":TroubleToggle", { desc = "Toggle Trouble" }) + end, + }, + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + }, + { + "nvim-pack/nvim-spectre", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { open_cmd = "noswapfile vnew" }, + keys = { + { + "sr", + function() + require("spectre").open() + end, + desc = "Replace in Files (Spectre)", + }, + }, + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local builtin = require("telescope.builtin") + + vim.keymap.set("n", "ff", builtin.git_files, { desc = "Search git_files" }) + vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Grep git_files" }) + vim.keymap.set("n", "fh", builtin.help_tags, { desc = "View help tags" }) + vim.keymap.set("n", "fb", builtin.buffers, { desc = "Search buffers" }) + vim.keymap.set("n", "sk", builtin.keymaps, { desc = "View keymaps" }) + vim.keymap.set("n", "sR", builtin.resume, { desc = "Resume" }) + vim.keymap.set("n", "st", "TodoTelescope", { desc = "Search TODOs" }) + end, + }, + { + "nvim-telescope/telescope-ui-select.nvim", + config = function() + require("telescope").setup({ + defaults = { + initial_mode = "normal", + }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }) + + require("telescope").load_extension("ui-select") + end, + }, + { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, + }, + { + "kdheepak/lazygit.nvim", + event = "VeryLazy", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { "gg", "LazyGit", desc = "LazyGit" } + } + }, + { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + } + } +} diff --git a/lua/plugins/formatting.lua b/lua/plugins/formatting.lua new file mode 100644 index 0000000..ef27e71 --- /dev/null +++ b/lua/plugins/formatting.lua @@ -0,0 +1,20 @@ +return { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + css = { "prettierd" }, + scss = { "prettierd" }, + html = { "djlint" }, + lua = { "stylelua" }, + javascript = { "eslint_d", "prettierd" }, + javascriptreact = { "eslint_d", "prettierd" }, + json = { "prettierd" }, + jsonc = { "prettierd" }, + typescript = { "eslint_d", "prettierd" }, + typescriptreact = { "eslint_d", "prettierd" }, + }, + format_on_save = { + lsp_fallback = true, + }, + }, +} diff --git a/lua/plugins/fugitive.lua b/lua/plugins/fugitive.lua deleted file mode 100644 index 1a989fb..0000000 --- a/lua/plugins/fugitive.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "tpope/vim-fugitive", - config = function() - vim.keymap.set("n", "gs", vim.cmd.Git, { desc = "View `git status`" }) - vim.keymap.set("n", "gh", "diffget //2", { desc = "Pick gitdiff on left" }) - vim.keymap.set("n", "gl", "diffget //3", { desc = "Pick gitdiff on right" }) - vim.keymap.set("n", "gp", ":Git push", { desc = "Run `git push`" }) - vim.keymap.set("n", "gc", ":Git checkout ", { desc = "Git checkout" }) - end -} diff --git a/lua/plugins/hardtime.lua b/lua/plugins/hardtime.lua deleted file mode 100644 index 47b18eb..0000000 --- a/lua/plugins/hardtime.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - "m4xshen/hardtime.nvim", - dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, - opts = { - disable_mouse = true, - disabled_keys = { - -- Drill Sergeant Demchuk! - [""] = { "", "i" }, - [""] = { "", "i" }, - [""] = { "", "i" }, - [""] = { "", "i" }, - }, - disabled_filetypes = { - "checkhealth", - "fugitive", - "help", - "lazy", - "mason", - "markdown", - "neo-tree", - "neo-tree-popup", - "netrw", - "noice", - "notify", - "qf", - }, - }, -} diff --git a/lua/plugins/lint.lua b/lua/plugins/lint.lua deleted file mode 100644 index 42fae39..0000000 --- a/lua/plugins/lint.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - "mfussenegger/nvim-lint", - event = { - "BufReadPre", - "BufNewFile", - }, - config = function() - local lint = require("lint") - - local djlint = lint.linters.djlint - djlint.args = { - "--reformat", - } - - lint.linters_by_ft = { - html = { "djlint" }, - javascript = { "eslint_d" }, - typescript = { "eslint_d" }, - javascriptreact = { "eslint_d" }, - typescriptreact = { "eslint_d" }, - } - - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - - vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { - group = lint_augroup, - callback = function() - lint.try_lint() - end, - }) - end, -} diff --git a/lua/plugins/linting.lua b/lua/plugins/linting.lua new file mode 100644 index 0000000..995389c --- /dev/null +++ b/lua/plugins/linting.lua @@ -0,0 +1,26 @@ +return { + "mfussenegger/nvim-lint", + opts = { + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + html = { "djlint" }, + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + }, + }, + config = function(_, opts) + local lint = require("lint") + lint.linters_by_ft = opts.linters_by_ft + + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + + vim.api.nvim_create_autocmd(opts.events, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, +} diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua deleted file mode 100644 index 6a45483..0000000 --- a/lua/plugins/lsp-config.lua +++ /dev/null @@ -1,76 +0,0 @@ -return { - { - "williamboman/mason.nvim", - config = function() - require("mason").setup() - end - }, - { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup({ - ensure_installed = { "lua_ls", "tsserver", "html" } - }) - end - }, - { - "neovim/nvim-lspconfig", - config = function() - local lspconfig = require("lspconfig") - local capabilities = require("cmp_nvim_lsp").default_capabilities() - - lspconfig.lua_ls.setup({ - capabilities = capabilities - }) - - lspconfig.tsserver.setup({ - capabilities = capabilities, - }) - - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = "Go to definition" }) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = "Go to implementation" }) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = "Show signature" }) - vim.keymap.set('n', 'f', vim.lsp.buf.format, { desc = "Format buffer" }) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, { desc = "View code actions" }) - end - }, - { - "WhoIsSethDaniel/mason-tool-installer.nvim", - config = function() - local mason_tool_installer = require("mason-tool-installer") - - mason_tool_installer.setup({ - ensure_installed = { - "djlint", - "prettierd", - "eslint_d", - }, - automatic_installation = true - }) - end - }, - { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - lua = { "stylua" }, - javascript = { "eslint_d" }, - javascriptreact = { "eslint_d" }, - json = { "prettierd" }, - jsonc = { "prettierd" }, - yaml = { "prettierd" }, - typescript = { "eslint_d" }, - typescriptreact = { "eslint_d" }, - html = { "djlint" }, - ejs = { "prettierd" }, - css = { "prettierd" }, - scss = { "prettierd" }, - graphql = { "prettierd" }, - ["_"] = { "trim_whitespace" }, - }, - format_on_save = { - lsp_fallback = true, - }, - }, - } -} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..860226c --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,60 @@ +return { + { + "williamboman/mason.nvim", + opts = {}, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = { + ensure_installed = { + "lua_ls", + "tsserver", + "html", + } + } + }, + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + opts = { + ensure_installed = { + "djlint", + "eslint", + "eslint_d", + "prettierd", + "stylua", + }, + automatic_installation = true, + } + }, + -- lspconfig should be the last step. + { + "neovim/nvim-lspconfig", + event = "VeryLazy", + dependencies = { + "mason.nvim", + "williamboman/mason-lspconfig.nvim", + }, + opts = { + servers = { + tsserver = {}, + lua_ls = {}, + } + }, + config = function(_, opts) + local lspconfig = require("lspconfig") + + local servers = opts.servers + + for server, server_opts in pairs(servers) do + lspconfig[server].setup(server_opts) + end + + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) + vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show signature" }) + vim.keymap.set("n", "f", vim.lsp.buf.format, { desc = "Format buffer" }) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "View code actions" }) + vim.keymap.set("n", "cr", vim.lsp.buf.rename, { desc = "Rename" }) + end, + }, +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua deleted file mode 100644 index b368357..0000000 --- a/lua/plugins/lualine.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - require('lualine').setup({ - options = { - icons_enabled = true, - theme = 'tokyonight' - } - }) - end -} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua deleted file mode 100644 index 08755e1..0000000 --- a/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,52 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - config = function() - vim.keymap.set("n", "nn", ":Neotree toggle", { desc = "Toggle Neotree" }) - - local nt = require("neo-tree") - - nt.setup({ - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, - filesystem = { - filtered_items = { - show_hidden_count = false, - hide_dotfiles = false, - hide_gitignored = true, - always_show = { - ".env", - }, - never_show = { - ".git", - "thumbs.db", - ".DS_Store", - }, - }, - }, - window = { - mappings = { - ["m"] = { - "move", - config = { - show_path = "relative", - }, - }, - }, - }, - event_handlers = { - { - event = "neo_tree_popup_input_ready", - handler = function() - -- Switch to normal inside popups by default. - vim.cmd.stopinsert() - end, - }, - }, - }) - end, -} diff --git a/lua/plugins/surround.lua b/lua/plugins/surround.lua deleted file mode 100644 index b5dd6ff..0000000 --- a/lua/plugins/surround.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "tpope/vim-surround" -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua deleted file mode 100644 index 51e53fb..0000000 --- a/lua/plugins/telescope.lua +++ /dev/null @@ -1,36 +0,0 @@ -return { - { - 'nvim-telescope/telescope.nvim', - tag = '0.1.5', - dependencies = { 'nvim-lua/plenary.nvim' }, - config = function() - local builtin = require('telescope.builtin') - - vim.keymap.set('n', 'pp', builtin.git_files, { desc = "Search git_files" }) - vim.keymap.set('n', 'pf', builtin.find_files, { desc = "Search all files " }) - vim.keymap.set('n', 'fh', builtin.help_tags, { desc = "View help tags" }) - vim.keymap.set('n', 'gc', builtin.git_branches, { desc = "Checkout git branches" }) - vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) - end, { desc = "Grep entire project for string" }) - vim.keymap.set('n', 'b', builtin.buffers, { desc = "Search buffers" }) - end - }, - { - "nvim-telescope/telescope-ui-select.nvim", - config = function() - require("telescope").setup { - defaults = { - initial_mode = "normal" - }, - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown {} - } - } - } - - require("telescope").load_extension("ui-select") - end - } -} diff --git a/lua/plugins/todo-comments.lua b/lua/plugins/todo-comments.lua deleted file mode 100644 index 2ca05d6..0000000 --- a/lua/plugins/todo-comments.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = {}, -} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index b632f9d..85cf8f5 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,26 +1,41 @@ return { { "nvim-treesitter/nvim-treesitter", + version = false, build = ":TSUpdate", - config = function() - local config = require("nvim-treesitter.configs") - config.setup({ - ensure_installed = { "lua", "javascript", "typescript", "tsx", "htmldjango", "html", "jsonc", "json", "jsdoc", "markdown", "markdown_inline", "vim", "vimdoc" }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true } - }) - end + opts = { + ensure_installed = { + "lua", + "javascript", + "typescript", + "tsx", + "htmldjango", + "html", + "jsonc", + "json", + "jsdoc", + "markdown", + "markdown_inline", + "vim", + "vimdoc", + }, + highlight = { enable = true }, + indent = { enable = true }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, }, { "nvim-treesitter/nvim-treesitter-context", opts = { max_lines = 2, - } + }, }, { - 'windwp/nvim-autopairs', - event = "InsertEnter", - opts = {} - } + -- TODO: Figure out why this plugin is not working. + "windwp/nvim-autopairs", + event = "VeryLazy", + opts = {}, + }, } diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua deleted file mode 100644 index 4745503..0000000 --- a/lua/plugins/trouble.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - vim.keymap.set("n", "tt", ":TroubleToggle", { desc = "Toggle Trouble" }) - end -} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 9aa07d6..467aeb7 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,4 +1,48 @@ return { + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + options = { + icons_enabled = true, + theme = "tokyonight", + disabled_filetypes = { + statusline = { + "alpha", + "neo-tree", + } + } + } + }, + }, + { + "famiu/bufdelete.nvim", + keys = { + { "bd", "Bdelete", desc = "Close Buffer" }, + }, + }, + { + "akinsho/bufferline.nvim", + event = "VeryLazy", + keys = { + { "bp", "BufferLineTogglePin", desc = "Toggle Pin" }, + { "[b", "BufferLineCyclePrev", desc = "Prev Buffer" }, + { "]b", "BufferLineCycleNext", desc = "Next Buffer" }, + }, + opts = { + options = { + diagnostics = "nvim_lsp", + offsets = { + { + filetype = "neo-tree", + text = "Neo-tree", + highlight = "Directory", + text_align = "left", + }, + }, + } + } + }, { "lukas-reineke/indent-blankline.nvim", opts = { @@ -52,4 +96,71 @@ return { }) end, }, + { + "stevearc/dressing.nvim", + event = "VeryLazy", + opts = {} + }, + { + "rcarriga/nvim-notify", + opts = { + timeout = 2000, + stages = "static", + } + }, + { + "MunifTanjim/nui.nvim" + }, + { + "folke/noice.nvim", + event = "VeryLazy", + opts = {}, + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + } + }, + { + "goolord/alpha-nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + + -- https://github.com/MaximilianLloyd/ascii.nvim + dashboard.section.header.val = { + " ", + " ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ", + " ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ", + " ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ", + " ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ", + " ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ", + " ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ", + " ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ", + " ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ", + " ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ", + " ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ", + " ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ", + " ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ", + " ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ", + " ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ", + " ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ", + " ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ", + " ▄█████████▄▄ ", + " ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ", + " ▄▄█████▀▀▀▀ ▀■ ", + " ▄███▀▀▀▀ ", + " ■▀▀ ", + " ", + } + + dashboard.section.buttons.val = { + dashboard.button("e", " > New File", "ene"), + dashboard.button("SPC ee", " > File explorer", "Neotree"), + dashboard.button("q", " > Quit", "qa"), + } + + alpha.setup(dashboard.opts) + end, + } } diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua deleted file mode 100644 index 410f8db..0000000 --- a/lua/plugins/which-key.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end, - opts = {} -}