commit 06871350cc5c495a983a0e08d8d7e7c57e20313d Author: mohamad24xx Date: Thu Sep 12 18:09:07 2024 +0330 inintal commet for saving diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..422e26f --- /dev/null +++ b/.luarc.json @@ -0,0 +1,44 @@ +{ + "workspace.library": [ + "/home/mohamad/.local/share/nvim/lazy/neodev.nvim/types/nightly", + "/usr/share/nvim/runtime/lua", + "/home/mohamad/.local/share/nvim/lazy/neodev.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/indent-blankline.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/substitute.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/tokyonight.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/telescope.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/kanagawa.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-autopairs/lua", + "/home/mohamad/.local/share/nvim/lazy/plenary.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/material.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-surround/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-treesitter/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-cmp/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-ts-autotag/lua", + "/home/mohamad/.local/share/nvim/lazy/telescope-fzf-native.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/mason-lspconfig.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/cmp-buffer/lua", + "/home/mohamad/.local/share/nvim/lazy/Comment.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-ts-context-commentstring/lua", + "/home/mohamad/.local/share/nvim/lazy/cmp_luasnip/lua", + "/home/mohamad/.local/share/nvim/lazy/which-key.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/lazy.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/mason.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/nui.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/neo-tree.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/todo-comments.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/bufferline.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/LuaSnip/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-web-devicons/lua", + "/home/mohamad/.local/share/nvim/lazy/auto-session/lua", + "/home/mohamad/.local/share/nvim/lazy/alpha-nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-lspconfig/lua", + "/home/mohamad/.local/share/nvim/lazy/cmp-path/lua", + "/home/mohamad/.local/share/nvim/lazy/cmp-nvim-lsp/lua", + "/home/mohamad/.local/share/nvim/lazy/lspkind.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/lualine.nvim/lua", + "/home/mohamad/.local/share/nvim/lazy/nvim-lsp-file-operations/lua", + "/home/mohamad/.config/nvim/lua", + "${3rd}/luv/library" + ] +} \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..6b8d974 --- /dev/null +++ b/init.lua @@ -0,0 +1,3 @@ +require("mpx.core") +require("mpx.lazy") + diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..0eacd67 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,54 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "alpha-nvim": { "branch": "main", "commit": "b6f4129302db197a7249e67a90de3f2b676de13e" }, + "auto-session": { "branch": "main", "commit": "a90aa7730efa60fdcc7e00497a8f36d94a6da709" }, + "better-escape.nvim": { "branch": "master", "commit": "bb197e51a91a635deb88630813c3bfc284413697" }, + "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "936f2413e6c57185cd873623a29a0685bce4b423" }, + "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, + "indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" }, + "kanagawa.nvim": { "branch": "master", "commit": "f491b0fe68fffbece7030181073dfe51f45cda81" }, + "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, + "lazygit.nvim": { "branch": "main", "commit": "2432b447483f42ff2e18b2d392cb2bb27e495c08" }, + "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "material.nvim": { "branch": "main", "commit": "ac8f02e97e359b7d258c0a00ec0949fe880790ad" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" }, + "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, + "nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-dap": { "branch": "master", "commit": "20a4859ebde1c9bc8e96f8cc11a20667e7fdd516" }, + "nvim-dap-go": { "branch": "main", "commit": "5511788255c92bdd845f8d9690f88e2e0f0ff9f2" }, + "nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" }, + "nvim-lint": { "branch": "master", "commit": "a7ce9c78a7c710c28bee56dfab10a5c0c80b7fb5" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, + "nvim-lspconfig": { "branch": "master", "commit": "d88ae6623fef09251e3aa20001bb761686eae730" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, + "nvim-treesitter": { "branch": "master", "commit": "c436d45eeeeb78e5482cb28b59de1d7a77c93d86" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "375c2d86cee6674afd75b4f727ce3a80065552f7" }, + "nvim-web-devicons": { "branch": "master", "commit": "9793801f974bba70e4ac5d7eae6c4f5659993d8e" }, + "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, + "ripgrep": { "branch": "master", "commit": "8bd595029656370927f846406ca4ce4ffe0b3e91" }, + "substitute.nvim": { "branch": "main", "commit": "97f49d16f8eea7967d41db4f657dd63af53eeba1" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "319c01b99b7a8c9ac2066bf0efd4d6ec68fef444" }, + "tokyonight.nvim": { "branch": "main", "commit": "4b386e66a9599057587c30538d5e6192e3d1c181" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" }, + "which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" } +} diff --git a/lua/mpx/core/init.lua b/lua/mpx/core/init.lua new file mode 100644 index 0000000..5bbe622 --- /dev/null +++ b/lua/mpx/core/init.lua @@ -0,0 +1,2 @@ +require("mpx.core.options") +require("mpx.core.keymaps") diff --git a/lua/mpx/core/keymaps.lua b/lua/mpx/core/keymaps.lua new file mode 100644 index 0000000..706ff64 --- /dev/null +++ b/lua/mpx/core/keymaps.lua @@ -0,0 +1,65 @@ +-- set leader key to space +vim.g.mapleader = " " + +local keymap = vim.keymap -- for conciseness + +-- clear search highlights +keymap.set("n", "nh", ":nohl", { desc = "Clear search highlights" }) + +-- delete single character without copying into register +keymap.set("n", "x", '"_x') + +-- increment/decrement numbers +keymap.set("n", "+", "", { desc = "Increment number" }) -- increment +keymap.set("n", "-", "", { desc = "Decrement number" }) -- decrement + +-- window management +keymap.set("n", "sv", "v", { desc = "Split window vertically" }) -- split window vertically +keymap.set("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally +keymap.set("n", "se", "=", { desc = "Make splits equal size" }) -- make split windows equal width & height +keymap.set("n", "sx", "close", { desc = "Close current split" }) -- close current split window + +keymap.set("n", "tn", "tabnew", { desc = "Open new tab" }) -- open new tab +keymap.set("n", "tq", "tabclose", { desc = "Close current tab" }) -- close current tab +keymap.set("n", "tl", "tabn", { desc = "Go to next tab" }) -- go to next tab +keymap.set("n", "th", "tabp", { desc = "Go to previous tab" }) -- go to previous tab +keymap.set("n", "L", "tabn", { desc = "Go to next tab" }) -- go to next tab +keymap.set("n", "H", "tabp", { desc = "Go to previous tab" }) -- go to previous tab +keymap.set("n", "tf", "tabnew %", { desc = "Open current buffer in new tab" }) -- move current buffer to new +-- make space unactionable +keymap.set({ "n", "v" }, "", "", { silent = true }) + +keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = "*", +}) + +--moving highlighted ( in v command ) with Capital K J +keymap.set("v", "J", ":m '>+1gv=gv") +keymap.set("v", "K", ":m '<-2gv=gv") + +-- pageup and down remain in center +keymap.set("n", "", "zz") +keymap.set("n", "", "zz") +keymap.set("n", "", "zz") +keymap.set("n", "", "zz") + +-- pacte and del without adding to vim regester +keymap.set("x", "d", [["_dP]], { desc = "delete without add to regester" }) +keymap.set({ "n", "v" }, "d", [["_d]], { desc = "delete without add to regester" }) + +-- use leader y for system clipborad +keymap.set({ "n", "v" }, "y", [["+y]], { desc = "yank to + regester " }) +keymap.set("n", "Y", [["+Y]], { desc = "Yank to + regester without " }) +-- for pacte +keymap.set({ "n", "v" }, "p", [["+p]], { desc = "pacte without add to regester" }) +keymap.set("n", "P", [["+P]], { desc = "pacte without add to regester" }) diff --git a/lua/mpx/core/options.lua b/lua/mpx/core/options.lua new file mode 100644 index 0000000..a8c6e20 --- /dev/null +++ b/lua/mpx/core/options.lua @@ -0,0 +1,69 @@ +vim.cmd("let g:netrw_liststyle = 3") + +local opt = vim.opt + +opt.relativenumber = true +opt.number = true + +opt.tabstop = 2 -- 2 spaces for tabs (prettier default) +opt.shiftwidth = 2 -- 2 spaces for indent width +opt.expandtab = true -- expand tab to spaces +opt.autoindent = true -- copy indent from current line when starting new one + +-- line wrapping +opt.wrap = false -- disable line wrapping + +-- search settings +opt.ignorecase = true -- ignore case when searching +opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive + +-- cursor line +opt.cursorline = true -- highlight the current cursor line + +-- appearance +-- turn on termguicolors for nightfly colorscheme to work +opt.termguicolors = true +opt.signcolumn = "yes" -- show sign column so that text doesn't shift + +-- backspace +opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position + +-- clipboard +opt.clipboard:append("unnamed") -- use system clipboard as default register + +-- split windows +opt.splitright = true -- split vertical window to the right +opt.splitbelow = true -- split horizontal window to the bottom + +-- turn off swapfile +opt.swapfile = false + +-- Enable mouse mode +opt.mouse = 'a' + +-- Enable break indent +opt.breakindent = true + +-- Save undo history +opt.undofile = true + +-- Decrease update time +opt.updatetime = 50 +opt.timeoutlen = 300 + +-- Set completeopt to have a better completion experience +opt.completeopt = 'menuone,noselect' + +-- transparent_window +vim.transparent_window = true + +-- set incremental search +opt.hlsearch = false +opt.incsearch = true + +--scroll off +opt.scrolloff = 10 + +--vim colour column +--opt.colorcolumn = "80" + diff --git a/lua/mpx/lazy.lua b/lua/mpx/lazy.lua new file mode 100644 index 0000000..790a406 --- /dev/null +++ b/lua/mpx/lazy.lua @@ -0,0 +1,19 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +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 +end +vim.opt.rtp:prepend(lazypath) +require("lazy").setup({ { import = "mpx.plugins" }, { import = "mpx.plugins.lsp" } }, { + change_detection = {}, +}) diff --git a/lua/mpx/plugins/alpha.lua b/lua/mpx/plugins/alpha.lua new file mode 100644 index 0000000..bbb8874 --- /dev/null +++ b/lua/mpx/plugins/alpha.lua @@ -0,0 +1,36 @@ +return { + "goolord/alpha-nvim", + event = "VimEnter", + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + + -- Set header + dashboard.section.header.val = { + " ", + " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", + " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", + " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", + " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", + " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", + " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", + " ", + } + + -- Set menu + dashboard.section.buttons.val = { + dashboard.button("e", " > New File", "ene"), + dashboard.button("SPC ee", " > Toggle file explorer", "Neotree toggle"), + dashboard.button("SPC ff", "󰱼 > Find File", "Telescope find_files"), + dashboard.button("SPC fs", " > Find Word", "Telescope live_grep"), + dashboard.button("SPC wr", "󰁯 > Restore Session For Current Directory", "SessionRestore"), + dashboard.button("q", " > Quit NVIM", "qa"), + } + + -- Send config to alpha + alpha.setup(dashboard.opts) + + -- Disable folding on alpha buffer + vim.cmd([[autocmd FileType alpha setlocal nofoldenable]]) + end, +} diff --git a/lua/mpx/plugins/auto-session.lua b/lua/mpx/plugins/auto-session.lua new file mode 100644 index 0000000..adeff79 --- /dev/null +++ b/lua/mpx/plugins/auto-session.lua @@ -0,0 +1,16 @@ +return { + "rmagatti/auto-session", + config = function() + local auto_session = require("auto-session") + + auto_session.setup({ + auto_restore_enabled = false, + auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" }, + }) + + local keymap = vim.keymap + + keymap.set("n", "wr", "SessionRestore", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory + keymap.set("n", "ws", "SessionSave", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory + end, +} diff --git a/lua/mpx/plugins/autopairs.lua b/lua/mpx/plugins/autopairs.lua new file mode 100644 index 0000000..8ee54b3 --- /dev/null +++ b/lua/mpx/plugins/autopairs.lua @@ -0,0 +1,30 @@ +return { + "windwp/nvim-autopairs", + event = { "InsertEnter" }, + dependencies = { + "hrsh7th/nvim-cmp", + }, + config = function() + -- import nvim-autopairs + local autopairs = require("nvim-autopairs") + + -- configure autopairs + autopairs.setup({ + check_ts = true, -- enable treesitter + ts_config = { + lua = { "string" }, -- don't add pairs in lua string treesitter nodes + javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes + java = false, -- don't check treesitter on java + }, + }) + + -- import nvim-autopairs completion functionality + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + + -- import nvim-cmp plugin (completions plugin) + local cmp = require("cmp") + + -- make autopairs and completion work together + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, +} diff --git a/lua/mpx/plugins/better-escape.lua b/lua/mpx/plugins/better-escape.lua new file mode 100644 index 0000000..79d0115 --- /dev/null +++ b/lua/mpx/plugins/better-escape.lua @@ -0,0 +1,47 @@ +return { + { + "max397574/better-escape.nvim", + config = function() + require("better_escape").setup({ + timeout = vim.o.timeoutlen, + default_mappings = true, + mappings = { + i = { + j = { + -- These can all also be functions + k = "", + j = "", + }, + i = { + i = "", + }, + }, + c = { + j = { + k = "", + j = "", + }, + i = { + i = "", + }, + }, + t = { + j = { + k = "", + }, + }, + v = { + j = { + k = "", + }, + }, + s = { + j = { + k = "", + }, + }, + }, + }) + end, + }, +} diff --git a/lua/mpx/plugins/bufferline.lua b/lua/mpx/plugins/bufferline.lua new file mode 100644 index 0000000..e1597f9 --- /dev/null +++ b/lua/mpx/plugins/bufferline.lua @@ -0,0 +1,31 @@ +--Note:use barbar insted and fix tabs to buffers insted +return { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + event = "VeryLazy", + opts = { + options = { + always_show_bufferline = false, + diagnostics = "nvim_lsp", + mode = "tabs", + separator_style = "thick", + hover = { + enabled = true, + delay = 200, + reveal = {'close'} + }, + offsets = { + { + filetype = "neo-tree", + text = "Neo-tree", + highlight = "Directory", + text_align = "left", + }, + }, + + indicator = { + style = 'underline', + }, + }, + }, +} diff --git a/lua/mpx/plugins/colorscheme.lua b/lua/mpx/plugins/colorscheme.lua new file mode 100644 index 0000000..ddac4f9 --- /dev/null +++ b/lua/mpx/plugins/colorscheme.lua @@ -0,0 +1,47 @@ +return{ +{ + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, +-- config = function() +-- vim.cmd([[colorscheme tokyonight-night]]) +-- require("tokyonight").setup({ +-- style = "night", +-- on_colors = function(colors) +-- colors.bg = "#0F111A" +-- colors.bg_dark = "#090B10" +-- colors.bg_float = "#090B10" +-- colors.bg_highlight = "#1F2233" +-- colors.bg_popup = "#090B10" +-- colors.bg_sidebar = "#090B10" +-- colors.bg_statusline = "#090B10" +-- colors.fg = "#A6ACCD" +-- colors.fg_dark = "#717CB4" +-- colors.fg_float = "#A6ACCD" +-- colors.fg_sidebar = "#717CB4" +-- end, +-- +-- }) +-- end, +}, + +{ + "rebelot/kanagawa.nvim", + lazy = false, + priority = 1000, +-- config = function() +-- vim.cmd([[colorscheme ayu]]) +-- end, +}, +{ + "marko-cerovac/material.nvim", + lazy = false, + priority = 1000, + opts = {}, + config = function() + vim.cmd([[colorscheme material-deep-ocean]]) + end, +}, +} + diff --git a/lua/mpx/plugins/comment.lua b/lua/mpx/plugins/comment.lua new file mode 100644 index 0000000..ecc93c4 --- /dev/null +++ b/lua/mpx/plugins/comment.lua @@ -0,0 +1,19 @@ +return { + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + -- import comment plugin safely + local comment = require("Comment") + + local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + + -- enable comment + comment.setup({ + -- for commenting tsx, jsx, svelte, html files + pre_hook = ts_context_commentstring.create_pre_hook(), + }) + end, +} diff --git a/lua/mpx/plugins/formatting.lua b/lua/mpx/plugins/formatting.lua new file mode 100644 index 0000000..45096c7 --- /dev/null +++ b/lua/mpx/plugins/formatting.lua @@ -0,0 +1,41 @@ +return { + "stevearc/conform.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local conform = require("conform") + + conform.setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + liquid = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + go = { "gofumpt" }, + bash = { "beautysh" }, + }, + format_on_save = { + lsp_fallback = true, + async = false, + timeout_ms = 1000, + }, + }) + + vim.keymap.set({ "n", "v" }, ".", function() + conform.format({ + lsp_fallback = true, + async = false, + timeout_ms = 1000, + }) + end, { desc = "Format file or range (in visual mode)" }) + end, +} diff --git a/lua/mpx/plugins/indent-blankline.lua b/lua/mpx/plugins/indent-blankline.lua new file mode 100644 index 0000000..c5550ec --- /dev/null +++ b/lua/mpx/plugins/indent-blankline.lua @@ -0,0 +1,23 @@ +return { + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPre", "BufNewFile" }, + main = "ibl", + opts = {}, + +config=function() +local scope = "focus" +local indent = "passive" +local hooks = require("ibl.hooks") + +hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "focus", { fg = "#329dbd" }) + vim.api.nvim_set_hl(0, "passive", { fg = "#474848" }) +end) + +require("ibl").setup({ + scope = { highlight = scope ,char = "│" }, + indent = { highlight = indent, char = "┊"} +}) + + end, +} diff --git a/lua/mpx/plugins/init.lua b/lua/mpx/plugins/init.lua new file mode 100644 index 0000000..a885d95 --- /dev/null +++ b/lua/mpx/plugins/init.lua @@ -0,0 +1,4 @@ +return { + "nvim-lua/plenary.nvim", -- lua functions that many plugins use + "christoomey/vim-tmux-navigator", -- tmux & split window navigation +} diff --git a/lua/mpx/plugins/lazygit.lua b/lua/mpx/plugins/lazygit.lua new file mode 100644 index 0000000..6055d12 --- /dev/null +++ b/lua/mpx/plugins/lazygit.lua @@ -0,0 +1,19 @@ +return { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "lg", "LazyGit", desc = "Open lazy git" }, + }, +} diff --git a/lua/mpx/plugins/linting.lua b/lua/mpx/plugins/linting.lua new file mode 100644 index 0000000..52b4f9e --- /dev/null +++ b/lua/mpx/plugins/linting.lua @@ -0,0 +1,30 @@ +return { + "mfussenegger/nvim-lint", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local lint = require("lint") + + lint.linters_by_ft = { + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + svelte = { "eslint_d" }, + python = { "pylint" }, + go = { "golangcilint" }, + } + + 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, + }) + + vim.keymap.set("n", "l", function() + lint.try_lint() + end, { desc = "Trigger linting for current file" }) + end, +} diff --git a/lua/mpx/plugins/lsp/lsp-config.lua b/lua/mpx/plugins/lsp/lsp-config.lua new file mode 100644 index 0000000..41eadc1 --- /dev/null +++ b/lua/mpx/plugins/lsp/lsp-config.lua @@ -0,0 +1,193 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "antosha417/nvim-lsp-file-operations", config = true }, + { "folke/neodev.nvim", opts = {} }, + }, + config = function() + -- import lspconfig plugin + local lspconfig = require("lspconfig") + + -- import mason_lspconfig plugin + local mason_lspconfig = require("mason-lspconfig") + + -- import cmp-nvim-lsp plugin + 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 } + + -- set keybinds + opts.desc = "Show LSP references" + keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show LSP definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show LSP implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show LSP type definitions" + keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Smart rename" + keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Show line diagnostics" + keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + 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", "rs", ":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() + + -- Change the Diagnostic symbols in the sign column (gutter) + -- (not in youtube nvim video) + local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + mason_lspconfig.setup_handlers({ + -- default handler for installed servers + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end, + ["svelte"] = function() + -- configure svelte server + lspconfig["svelte"].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "*.js", "*.ts" }, + callback = function(ctx) + -- Here use ctx.match instead of ctx.file + client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match }) + end, + }) + end, + }) + end, + ["graphql"] = function() + -- configure graphql language server + lspconfig["graphql"].setup({ + capabilities = capabilities, + filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, + }) + end, + ["harper_ls"] = function() + lspconfig.harper_ls.setup({ + capabilities = capabilities, + filetypes = { "markdown", "typescript", "typescriptreact", "javascript", "toml", "html" }, + settings = { + ["harper-ls"] = { + linters = { + spell_check = true, + spelled_numbers = false, + an_a = true, + sentence_capitalization = false, + unclosed_quotes = true, + wrong_quotes = false, + long_sentences = true, + repeated_words = true, + spaces = true, + matcher = true, + correct_number_suffix = true, + number_suffix_capitalization = true, + multiple_sequential_pronouns = true, + linking_verbs = false, + avoid_curses = true, + terminating_conjunctions = true, + }, + }, + }, + }) + end, + ["emmet_ls"] = function() + -- configure emmet language server + lspconfig["emmet_ls"].setup({ + capabilities = capabilities, + filetypes = { + "html", + "typescriptreact", + "javascriptreact", + "css", + "sass", + "scss", + "less", + "svelte", + }, + }) + end, + ["gopls"] = function() + -- configure emmet language server + lspconfig["gopls"].setup({ + cmd = { "gopls" }, + capabilities = capabilities, + settings = { + gopls = { + experimentalPostfixCompletions = true, + analyses = { + unusedparams = true, + shadow = true, + }, + staticcheck = true, + }, + }, + init_options = { + usePlaceholders = true, + }, + }) + end, + ["lua_ls"] = function() + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + settings = { + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + completion = { + callSnippet = "Replace", + }, + }, + }, + }) + end, + }) + end, +} diff --git a/lua/mpx/plugins/lsp/mason.lua b/lua/mpx/plugins/lsp/mason.lua new file mode 100644 index 0000000..ecf5473 --- /dev/null +++ b/lua/mpx/plugins/lsp/mason.lua @@ -0,0 +1,59 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + -- import mason + local mason = require("mason") + + -- import mason-lspconfig + local mason_lspconfig = require("mason-lspconfig") + local mason_tool_installer = require("mason-tool-installer") + -- enable mason and configure icons + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + mason_lspconfig.setup({ + -- list of servers for mason to install + ensure_installed = { + "ts_ls", + "html", + "cssls", + "tailwindcss", + "svelte", + "lua_ls", + "graphql", + "emmet_ls", + "templ", + "harper_ls", + "pyright", + "gopls", + "marksman", + "bashls", + }, + }) + mason_tool_installer.setup({ + ensure_installed = { + "prettier", -- prettier formatter + "stylua", -- lua formatter + "isort", -- python formatter + "black", -- python formatter + "gofumpt", -- go stricter formatter + "golangci_lint_ls", -- go linter + "pylint", -- python linter + "eslint_d", -- js linter + "delve", --godap + "beautysh", + }, + }) + end, +} diff --git a/lua/mpx/plugins/lualine.lua b/lua/mpx/plugins/lualine.lua new file mode 100644 index 0000000..4452654 --- /dev/null +++ b/lua/mpx/plugins/lualine.lua @@ -0,0 +1,9 @@ +return( +{ + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() +require('lualine').setup() + end, +} +) diff --git a/lua/mpx/plugins/neo-tree.lua b/lua/mpx/plugins/neo-tree.lua new file mode 100644 index 0000000..d46b50a --- /dev/null +++ b/lua/mpx/plugins/neo-tree.lua @@ -0,0 +1,61 @@ +return +{ + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + }, + + config = function() + require("neo-tree").setup({ + close_if_last_window = true, + window = { + mappings = { + ["l"] = "open", + ["h"] = "close_node", + [""] = "none", + ["Y"] = { + function(state) + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, + desc = "Copy Path to Clipboard", + }, + ["O"] = { + function(state) + require("lazy.util").open(state.tree:get_node().path, { system = true }) + end, + desc = "Open with System Application", + }, + ["P"] = { "toggle_preview", config = { use_float = false } }, + }, + }, + event_handlers = { + + { + event = "file_open_requested", + handler = function() + -- auto close + -- vim.cmd("Neotree close") + -- OR + require("neo-tree.command").execute({ action = "close" }) + end + }, + + }, + -- set keymaps + }) + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "ee", "Neotree toggle", { desc = "Toggle file explorer" }) -- toggle file explorer + keymap.set("n", "ef", "Neotree focus", { desc = "focus on file explorer" }) -- toggle file explorer on current file + end, +} + + + + diff --git a/lua/mpx/plugins/noice.lua b/lua/mpx/plugins/noice.lua new file mode 100644 index 0000000..bf43864 --- /dev/null +++ b/lua/mpx/plugins/noice.lua @@ -0,0 +1,40 @@ +return { + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + }, + config = function() + require("noice").setup({ + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- 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 = false, -- add a border to hover docs and signature help + }, + }) + require("notify").setup({ + timeout = 100, + }) + end, + }, +} diff --git a/lua/mpx/plugins/nvim-cmp.lua b/lua/mpx/plugins/nvim-cmp.lua new file mode 100644 index 0000000..0f99ef6 --- /dev/null +++ b/lua/mpx/plugins/nvim-cmp.lua @@ -0,0 +1,64 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + }, + config = function() + local cmp = require("cmp") + + local luasnip = require("luasnip") + + local lspkind = require("lspkind") + + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + completion = { + preselect = cmp.PreselectMode.None, + completeopt = "menu,menuone,preview,noselect", + }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = true }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), + + -- configure lspkind for vs-code like pictograms in completion menu + formatting = { + format = lspkind.cmp_format({ + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) + end, +} diff --git a/lua/mpx/plugins/nvim-dap.lua b/lua/mpx/plugins/nvim-dap.lua new file mode 100644 index 0000000..2e51dd4 --- /dev/null +++ b/lua/mpx/plugins/nvim-dap.lua @@ -0,0 +1,43 @@ +return { + { + "mfussenegger/nvim-dap", + dependencies = { + { + "rcarriga/nvim-dap-ui", + "nvim-neotest/nvim-nio", + config = function(_, opts) + local dap = require("dap") + local dapui = require("dapui") + dapui.setup(opts) + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open({}) + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close({}) + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close({}) + end + end, + }, + { + "leoluz/nvim-dap-go", + config = function() + require("dap-go").setup() + end, + }, + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = "mason.nvim", + cmd = { "DapInstall", "DapUninstall" }, + opts = { + automatic_installation = true, + handlers = {}, + ensure_installed = { + "delve", + }, + }, + }, + }, + }, +} diff --git a/lua/mpx/plugins/substitute.lua b/lua/mpx/plugins/substitute.lua new file mode 100644 index 0000000..e952b65 --- /dev/null +++ b/lua/mpx/plugins/substitute.lua @@ -0,0 +1,17 @@ +return { + "gbprod/substitute.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local substitute = require("substitute") + + substitute.setup() + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + vim.keymap.set("n", "s", substitute.operator, { desc = "Substitute with motion" }) + vim.keymap.set("n", "ss", substitute.line, { desc = "Substitute line" }) + vim.keymap.set("n", "S", substitute.eol, { desc = "Substitute to end of line" }) + vim.keymap.set("x", "s", substitute.visual, { desc = "Substitute in visual mode" }) + end, +} diff --git a/lua/mpx/plugins/surround.lua b/lua/mpx/plugins/surround.lua new file mode 100644 index 0000000..77f5073 --- /dev/null +++ b/lua/mpx/plugins/surround.lua @@ -0,0 +1,6 @@ +return { + "kylechui/nvim-surround", + event = { "BufReadPre", "BufNewFile" }, + version = "*", -- Use for stability; omit to use `main` branch for the latest features + config = true, +} diff --git a/lua/mpx/plugins/telescope.lua b/lua/mpx/plugins/telescope.lua new file mode 100644 index 0000000..d0d82cd --- /dev/null +++ b/lua/mpx/plugins/telescope.lua @@ -0,0 +1,83 @@ +return { + "nvim-telescope/telescope.nvim", + tag = '0.1.8', + version = false, + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + "BurntSushi/ripgrep", + "folke/todo-comments.nvim", + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + + telescope.setup({ +defaults = { + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + actions.open_qflist, + }, + }, + file_ignore_patterns = { "node_modules", "dist", ".git", ".next" }, + path_display = { "filename_first" }, + sorting_strategy = "ascending", + layout_strategy = "flex", + layout_config = { + horizontal = { + prompt_position = "top", + width = 0.9, + height = 0.9, + preview_width = 0.5, + }, + vertical = { + width = 0.9, + height = 0.9, + }, + }, + }, + pickers = { + find_files = { + hidden = true, + no_ignore = true, + }, + }, + extensions = { + themes = { + layout_strategy = "vertical", + layout_config = { + vertical = { + height = 0.4, + width = 0.4, + prompt_position = "top", + }, + horizontal = { + width = 0.8, + height = 0.7, + }, + }, + light_themes = { + ignore = true, + keywords = { "light", "day", "frappe", "latte", "dawn" }, + }, + enable_previewer = false, + enable_live_preview = true, + }, + }, + }) + + telescope.load_extension("fzf") + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) + keymap.set("n", "fr", "Telescope oldfiles", { desc = "Fuzzy find recent files" }) + keymap.set("n", "fs", "Telescope live_grep", { desc = "Find string in cwd" }) + keymap.set("n", "fc", "Telescope grep_string", { desc = "Find string under cursor in cwd" }) + keymap.set("n", "ft", "TodoTelescope", { desc = "Find todos" }) + end, +} diff --git a/lua/mpx/plugins/todo-comments.lua b/lua/mpx/plugins/todo-comments.lua new file mode 100644 index 0000000..f74baa9 --- /dev/null +++ b/lua/mpx/plugins/todo-comments.lua @@ -0,0 +1,21 @@ +return { + "folke/todo-comments.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local todo_comments = require("todo-comments") + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "]t", function() + todo_comments.jump_next() + end, { desc = "Next todo comment" }) + + keymap.set("n", "[t", function() + todo_comments.jump_prev() + end, { desc = "Previous todo comment" }) + + todo_comments.setup() + end, +} diff --git a/lua/mpx/plugins/treesitter.lua b/lua/mpx/plugins/treesitter.lua new file mode 100644 index 0000000..5fcb7c0 --- /dev/null +++ b/lua/mpx/plugins/treesitter.lua @@ -0,0 +1,60 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + }, + config = function() + -- import nvim-treesitter plugin + local treesitter = require("nvim-treesitter.configs") + + -- configure treesitter + treesitter.setup({ + -- enable syntax highlighting + highlight = { + enable = true, + }, + -- enable indentation + indent = { enable = true }, + -- enable autotagging (w/ nvim-ts-autotag plugin) + autotag = { + enable = true, + }, + -- ensure these language parsers are installed + ensure_installed = { + "json", + "javascript", + "typescript", + "tsx", + "yaml", + "html", + "css", + "markdown", + "markdown_inline", + "svelte", + "graphql", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "query", + "vimdoc", + "c", + "go", + "gomod", + "gotmpl", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) + end, +} diff --git a/lua/mpx/plugins/trouble.lua b/lua/mpx/plugins/trouble.lua new file mode 100644 index 0000000..6de76ac --- /dev/null +++ b/lua/mpx/plugins/trouble.lua @@ -0,0 +1,15 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" }, + opts = { + focus = true, + }, + cmd = "Trouble", + keys = { + { "xw", "Trouble diagnostics toggle", desc = "Open trouble workspace diagnostics" }, + { "xd", "Trouble diagnostics toggle filter.buf=0", desc = "Open trouble document diagnostics" }, + { "xq", "Trouble quickfix toggle", desc = "Open trouble quickfix list" }, + { "xl", "Trouble loclist toggle", desc = "Open trouble location list" }, + { "xt", "Trouble todo toggle", desc = "Open todos in trouble" }, + }, +} diff --git a/lua/mpx/plugins/which-key.lua b/lua/mpx/plugins/which-key.lua new file mode 100644 index 0000000..d004051 --- /dev/null +++ b/lua/mpx/plugins/which-key.lua @@ -0,0 +1,13 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, +}