commit 2ca4271309090b770ea142a068064b22fd12b78d Author: xsghetti Date: Mon May 6 20:27:39 2024 -0400 nvim diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e453abc --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 xSghetti + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9fc3dac --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +![240407_13h38m15s_screenshot](https://github.com/xsghetti/NeoCrux/assets/150515748/1f4bb651-d44a-4be6-aa49-011ea15b1676) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..1ab5768 --- /dev/null +++ b/init.lua @@ -0,0 +1,9 @@ +require("crux.core") +require("crux.lazy") +require('mini.animate').setup() +-- Set Color Scheme +vim.cmd([[:colorscheme pywal]]) +require('staline').setup() +require('ibl').setup() + + diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..8240e6e --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,43 @@ +{ + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "activate.nvim": { "branch": "main", "commit": "b82192817486ca8625e486c09a95436b3e4b7fe3" }, + "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, + "auto-session": { "branch": "main", "commit": "9e0a169b6fce8791278abbd110717b921afe634d" }, + "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, + "bufferline.nvim": { "branch": "main", "commit": "f4b4b980ce88d546aeb69d11463187c8f716a1a1" }, + "catppuccin": { "branch": "main", "commit": "6af91673ceccbd6e073b66c439e7fce239f72d24" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "b7d056dab963b5d3f2c560d92937cb51db61cb5b" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "dressing.nvim": { "branch": "master", "commit": "5162edb1442a729a885c45455a07e9a89058be2f" }, + "friendly-snippets": { "branch": "main", "commit": "fa36367422da5a38560892e3db6d090a635d9d41" }, + "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, + "lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" }, + "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "05744f0f1967b5757bd05c08df4271ab8ec990aa" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "b129892f783740e6cf741f2ea09fa5dd512aa584" }, + "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, + "mini.animate": { "branch": "main", "commit": "82519630b2760ffc516ebc387bef632f9c07b9f5" }, + "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, + "noice.nvim": { "branch": "main", "commit": "f4decbc7a80229ccc9f86026b74bdcf0c39e38a7" }, + "nui.nvim": { "branch": "main", "commit": "a3597dc88b53489d3fddbddbbd13787355253bb0" }, + "nvim-autopairs": { "branch": "master", "commit": "14e97371b2aab6ee70054c1070a123dfaa3e217e" }, + "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" }, + "nvim-lspconfig": { "branch": "master", "commit": "97762065bf7e1ac617d0a8710eb7ec2d656287a9" }, + "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, + "nvim-tree.lua": { "branch": "master", "commit": "64f61e4c913047a045ff90bd188dd3b54ee443cf" }, + "nvim-treesitter": { "branch": "master", "commit": "268611e3ece8463bfb5b09044dcd1b76a28ffbb6" }, + "nvim-web-devicons": { "branch": "master", "commit": "475fbcfcb6ee7c35aa33a6b6207ebd4032791d87" }, + "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, + "pywal.nvim": { "branch": "main", "commit": "d11b673c0e3d6eb8cbee7ea8cf4a8911f6ee24b9" }, + "staline.nvim": { "branch": "main", "commit": "c49f2deaba3d3c669e7243b57619e0078e7a351b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, + "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" }, + "vim-wintabs": { "branch": "master", "commit": "6d18d62ae0f293a108afee8c514706027faefcf3" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lua/crux/core/init.lua b/lua/crux/core/init.lua new file mode 100644 index 0000000..4764b39 --- /dev/null +++ b/lua/crux/core/init.lua @@ -0,0 +1,3 @@ +require("crux.core.options") +require("crux.core.options") +require("crux.core.keymaps") diff --git a/lua/crux/core/keymaps.lua b/lua/crux/core/keymaps.lua new file mode 100644 index 0000000..e96c8a9 --- /dev/null +++ b/lua/crux/core/keymaps.lua @@ -0,0 +1,32 @@ +-- set leader key to space +vim.g.mapleader = " " + +local keymap = vim.keymap -- for conciseness + +--------------------- +-- General Keymaps ------------------- + +-- use jk to exit insert mode +keymap.set("i", "jk", "", { desc = "Exit insert mode with jk" }) + +-- 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", "to", "tabnew", { desc = "Open new tab" }) -- open new tab +keymap.set("n", "tx", "tabclose", { desc = "Close current tab" }) -- close current tab +keymap.set("n", "tn", "tabn", { desc = "Go to next tab" }) -- go to next tab +keymap.set("n", "tp", "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 tab \ No newline at end of file diff --git a/lua/crux/core/options.lua b/lua/crux/core/options.lua new file mode 100644 index 0000000..50f1b29 --- /dev/null +++ b/lua/crux/core/options.lua @@ -0,0 +1,44 @@ +vim.cmd("let g:netrw_liststyle = 3") + +local opt = vim.opt -- for conciseness + +-- line numbers +opt.relativenumber = false -- show relative line numbers +opt.number = true -- shows absolute line number on cursor line (when relative number is on) + +-- tabs & indentation +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 +-- (have to use iterm2 or any other true color terminal) +opt.termguicolors = true +opt.background = "dark" -- colorschemes that can be light or dark will be made dark +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("unnamedplus") -- 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 diff --git a/lua/crux/lazy.lua b/lua/crux/lazy.lua new file mode 100644 index 0000000..27fd0d8 --- /dev/null +++ b/lua/crux/lazy.lua @@ -0,0 +1,20 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ { import = "crux.plugins" }, { import = "crux.plugins.lsp" } }, { + checker = { + enabled = true, + notify = false, + }, +}) + diff --git a/lua/crux/plugins/activate.lua b/lua/crux/plugins/activate.lua new file mode 100644 index 0000000..ce335d9 --- /dev/null +++ b/lua/crux/plugins/activate.lua @@ -0,0 +1,13 @@ +return { + "roobert/activate.nvim", + keys = { + { + "P", + 'lua require("activate").list_plugins()', + desc = "Plugins", + }, + }, + dependencies = { + { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } } + } +} diff --git a/lua/crux/plugins/alpha.lua b/lua/crux/plugins/alpha.lua new file mode 100644 index 0000000..c49a09c --- /dev/null +++ b/lua/crux/plugins/alpha.lua @@ -0,0 +1,39 @@ +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( "L", " Lazy ", "Lazy"), + dashboard.button( "N", "󰱽 New File ", "ene"), + dashboard.button( "Y", " Hyprland ", ":e ~/.config/hypr/"), + dashboard.button( "P", " Plugins ", ":e ~/.config/nvim/lua/crux/plugins"), + dashboard.button( "H", "󰋖 Command Help ", ":Telescope help_tags"), + dashboard.button( "C", " Colors ", ":Telescope colorscheme"), + dashboard.button( "Q", "󰩈 Quit ", ":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/crux/plugins/auto-session.lua b/lua/crux/plugins/auto-session.lua new file mode 100644 index 0000000..adeff79 --- /dev/null +++ b/lua/crux/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/crux/plugins/autopairs.lua b/lua/crux/plugins/autopairs.lua new file mode 100644 index 0000000..8ee54b3 --- /dev/null +++ b/lua/crux/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/crux/plugins/bufferline.lua b/lua/crux/plugins/bufferline.lua new file mode 100644 index 0000000..ec340e9 --- /dev/null +++ b/lua/crux/plugins/bufferline.lua @@ -0,0 +1,11 @@ +return { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + version = "*", + opts = { + options = { + mode = "tabs", + separator_style = "slant", + }, + }, +} diff --git a/lua/crux/plugins/catppuccin.lua b/lua/crux/plugins/catppuccin.lua new file mode 100644 index 0000000..b6f2f3e --- /dev/null +++ b/lua/crux/plugins/catppuccin.lua @@ -0,0 +1,2 @@ +return{ + "catppuccin/nvim", name = "catppuccin", priority = 1000 } diff --git a/lua/crux/plugins/cellular-automation.lua b/lua/crux/plugins/cellular-automation.lua new file mode 100644 index 0000000..d455cd3 --- /dev/null +++ b/lua/crux/plugins/cellular-automation.lua @@ -0,0 +1,3 @@ +return { + "eandrju/cellular-automaton.nvim" +} diff --git a/lua/crux/plugins/dressing.lua b/lua/crux/plugins/dressing.lua new file mode 100644 index 0000000..105f7e5 --- /dev/null +++ b/lua/crux/plugins/dressing.lua @@ -0,0 +1,4 @@ +return { + "stevearc/dressing.nvim", + event = "VeryLazy", +} diff --git a/lua/crux/plugins/floaterm.lua b/lua/crux/plugins/floaterm.lua new file mode 100644 index 0000000..0062152 --- /dev/null +++ b/lua/crux/plugins/floaterm.lua @@ -0,0 +1,3 @@ +return { + "voldikss/vim-floaterm" +} diff --git a/lua/crux/plugins/indent-blankline.lua b/lua/crux/plugins/indent-blankline.lua new file mode 100644 index 0000000..3ff0da6 --- /dev/null +++ b/lua/crux/plugins/indent-blankline.lua @@ -0,0 +1,3 @@ +return{ + "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} +} diff --git a/lua/crux/plugins/init.lua b/lua/crux/plugins/init.lua new file mode 100644 index 0000000..9907d80 --- /dev/null +++ b/lua/crux/plugins/init.lua @@ -0,0 +1,17 @@ +return{ +{ + "utilyre/barbecue.nvim", + name = "barbecue", + version = "*", + dependencies = { + "SmiteshP/nvim-navic", + "nvim-tree/nvim-web-devicons", -- optional dependency + }, + opts = { + -- configurations go here + }, +} + +} + + diff --git a/lua/crux/plugins/lsp/lspconfig.lua b/lua/crux/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..00da4bf --- /dev/null +++ b/lua/crux/plugins/lsp/lspconfig.lua @@ -0,0 +1,137 @@ +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, + ["emmet_ls"] = function() + -- configure emmet language server + lspconfig["emmet_ls"].setup({ + capabilities = capabilities, + filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, + }) + 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/crux/plugins/lsp/mason.lua b/lua/crux/plugins/lsp/mason.lua new file mode 100644 index 0000000..748229c --- /dev/null +++ b/lua/crux/plugins/lsp/mason.lua @@ -0,0 +1,54 @@ +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 = { + "tsserver", + "html", + "cssls", + "tailwindcss", + "svelte", + "lua_ls", + "graphql", + "emmet_ls", + "prismals", + "pyright", + }, + }) + + mason_tool_installer.setup({ + ensure_installed = { + "prettier", -- prettier formatter + "stylua", -- lua formatter + "isort", -- python formatter + "black", -- python formatter + "pylint", + "eslint_d", + }, + }) + end, +} diff --git a/lua/crux/plugins/mini-animate.lua b/lua/crux/plugins/mini-animate.lua new file mode 100644 index 0000000..c17a380 --- /dev/null +++ b/lua/crux/plugins/mini-animate.lua @@ -0,0 +1,3 @@ +return { + "echasnovski/mini.animate" +} diff --git a/lua/crux/plugins/noice.lua b/lua/crux/plugins/noice.lua new file mode 100644 index 0000000..3f76046 --- /dev/null +++ b/lua/crux/plugins/noice.lua @@ -0,0 +1,15 @@ +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", + } +} diff --git a/lua/crux/plugins/nvim-cmp.lua b/lua/crux/plugins/nvim-cmp.lua new file mode 100644 index 0000000..0947011 --- /dev/null +++ b/lua/crux/plugins/nvim-cmp.lua @@ -0,0 +1,63 @@ +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 = { + 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 = false }), + }), + -- 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/crux/plugins/nvim-tree.lua b/lua/crux/plugins/nvim-tree.lua new file mode 100644 index 0000000..9bc7864 --- /dev/null +++ b/lua/crux/plugins/nvim-tree.lua @@ -0,0 +1,56 @@ +return { + "nvim-tree/nvim-tree.lua", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + local nvimtree = require("nvim-tree") + + -- recommended settings from nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + nvimtree.setup({ + view = { + width = 35, + relativenumber = true, + }, + -- change folder arrow icons + renderer = { + indent_markers = { + enable = true, + }, + icons = { + glyphs = { + folder = { + arrow_closed = "", -- arrow when folder is closed + arrow_open = "", -- arrow when folder is open + }, + }, + }, + }, + -- disable window_picker for + -- explorer to work well with + -- window splits + actions = { + open_file = { + window_picker = { + enable = false, + }, + }, + }, + filters = { + custom = { ".DS_Store" }, + }, + git = { + ignore = false, + }, + }) + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "ee", "NvimTreeToggle", { desc = "Toggle file explorer" }) -- toggle file explorer + keymap.set("n", "ef", "NvimTreeFindFileToggle", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file + keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) -- collapse file explorer + keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) -- refresh file explorer + end +} diff --git a/lua/crux/plugins/nvim-treesitter.lua b/lua/crux/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..171a0da --- /dev/null +++ b/lua/crux/plugins/nvim-treesitter.lua @@ -0,0 +1,5 @@ +return{ + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", +} + diff --git a/lua/crux/plugins/pywal.lua b/lua/crux/plugins/pywal.lua new file mode 100644 index 0000000..257ebe0 --- /dev/null +++ b/lua/crux/plugins/pywal.lua @@ -0,0 +1,3 @@ +return { + "alphatechnolog/pywal.nvim" +} diff --git a/lua/crux/plugins/staline.lua b/lua/crux/plugins/staline.lua new file mode 100644 index 0000000..9881a37 --- /dev/null +++ b/lua/crux/plugins/staline.lua @@ -0,0 +1,3 @@ +return { + "tamton-aquib/staline.nvim" +} diff --git a/lua/crux/plugins/telescope.lua b/lua/crux/plugins/telescope.lua new file mode 100644 index 0000000..33d9d2e --- /dev/null +++ b/lua/crux/plugins/telescope.lua @@ -0,0 +1,36 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + + telescope.setup({ + defaults = { + path_display = { "smart" }, + 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, + }, + }, + }, + }) + + 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" }) + end, +} diff --git a/lua/crux/plugins/which-key.lua b/lua/crux/plugins/which-key.lua new file mode 100644 index 0000000..d004051 --- /dev/null +++ b/lua/crux/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 + }, +} diff --git a/lua/crux/plugins/wintabs.lua b/lua/crux/plugins/wintabs.lua new file mode 100644 index 0000000..eb434c4 --- /dev/null +++ b/lua/crux/plugins/wintabs.lua @@ -0,0 +1,3 @@ +return{ + "zefei/vim-wintabs" +}