diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore deleted file mode 100644 index cc5457a..0000000 --- a/.config/nvim/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -tt.* -.tests -doc/tags -debug -.repro -foo.* -*.log -data diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 2514f9e..9197cdb 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,2 +1,4 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") +require("config.settings") +require("config.keys") +require("boot") +require("config.autocmds") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 19cf336..2e1d2a1 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,48 +1,16 @@ { - "LazyVim": { "branch": "main", "commit": "aa1cccf230a01bd85d5173f7d87f782fd83caa88" }, - "LuaSnip": { "branch": "master", "commit": "c4d6298347f7707e9757351b2ee03d0c00da5c20" }, - "alpha-nvim": { "branch": "main", "commit": "7a6b9487dba044a43fde534bf5036f0fda5b6b23" }, - "catppuccin": { "branch": "main", "commit": "490078b1593c6609e6a50ad5001e7902ea601824" }, + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" }, - "flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" }, - "friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" }, - "gitsigns.nvim": { "branch": "main", "commit": "5a2b1205841bc06ffb15719b14d54987e17b22ae" }, - "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, - "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, - "mason.nvim": { "branch": "main", "commit": "b5bb138312dbd3f7729197ca659cbe5221d36a03" }, - "mini.ai": { "branch": "main", "commit": "7ae226f331885e6f30e9a8229e113debc59308ae" }, - "mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" }, - "mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" }, - "mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" }, - "mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" }, - "mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "cac2e1bfa1ecd5bd0ce7ae29e12efb3ba5a7347d" }, - "neodev.nvim": { "branch": "main", "commit": "47dacc6d8f74936f7719351b025421df740c789b" }, - "noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" }, - "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" }, - "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, + "gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" }, + "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, "nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" }, - "nvim-lspconfig": { "branch": "master", "commit": "0d29cad8de3b2c654315203fc1fe12fde722a18a" }, - "nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" }, - "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, - "nvim-spectre": { "branch": "master", "commit": "5b39919a2947b1266b3aa34d0b0b14c35523bc69" }, - "nvim-treesitter": { "branch": "master", "commit": "add1864bbf2d3b8e789ec6b4715bb5a4073e3b60" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "56272167a6dead91c47c02dbdbfe1ae5643c59f5" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "9bff161dfece6ecf3459e6e46ca42e49f9ed939f" }, + "nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" }, + "nvim-tree.lua": { "branch": "master", "commit": "dea82ae2071a8d6412ca31e8fc48da5accad1a1d" }, + "nvim-treesitter": { "branch": "master", "commit": "8fa7ce35afe88b8294e6ced757aa14ec98414568" }, "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" }, "onedark.nvim": { "branch": "master", "commit": "09b71d84bd2524438e48c0aa5b54d855cc72af32" }, - "persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, - "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }, - "tokyonight.nvim": { "branch": "main", "commit": "1ee11019f8a81dac989ae1db1a013e3d582e2033" }, - "trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" }, - "vim-illuminate": { "branch": "master", "commit": "76f28e858f1caae87bfa45fb4fd09e4b053fc45b" }, - "vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" }, - "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } + "telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" } } \ No newline at end of file diff --git a/.config/nvim/lua/boot.lua b/.config/nvim/lua/boot.lua new file mode 100644 index 0000000..aa60252 --- /dev/null +++ b/.config/nvim/lua/boot.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +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", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Setup package manager +require("lazy").setup("plugins", { + defaults = { + lazy = true, + }, + change_detection = { + notify = false, + }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index e122466..56617eb 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,16 +1,7 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- Add any additional autocmds here +local on = vim.api.nvim_create_autocmd --- Disable spell checking -vim.api.nvim_clear_autocmds({ - group = "lazyvim_wrap_spell", -}) - --- Enable wrapping -vim.api.nvim_create_autocmd("FileType", { - pattern = { "gitcommit", "markdown" }, +on("VimEnter", { callback = function() - vim.opt_local.wrap = true + require("nvim-tree.api").tree.toggle({ focus = false }) end, }) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua deleted file mode 100644 index c06783c..0000000 --- a/.config/nvim/lua/config/keymaps.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here - -vim.keymap.set("n", "U", "redo", { desc = "Redo" }) -vim.keymap.set("n", "", ":%s///g", { desc = "Replace word under cursor" }) diff --git a/.config/nvim/lua/config/keys.lua b/.config/nvim/lua/config/keys.lua new file mode 100644 index 0000000..ab26c92 --- /dev/null +++ b/.config/nvim/lua/config/keys.lua @@ -0,0 +1,25 @@ +local map = vim.keymap.set + +-- Normal mode +map("n", "", "enew", { desc = "New File" }) +map("n", "", "NvimTreeToggle", { desc = "Toggle file explorer" }) +map("n", "", "qa", { desc = "Quit all" }) +map("n", "l", "Lazy", { desc = "Lazy" }) +map("n", "f", "Telescope find_files", { desc = "Find files" }) +map("n", "r", "Telescope oldfiles", { desc = "Recent files" }) +map("n", "s", "Telescope symbols", { desc = "Symbols" }) +map("n", "cf", vim.lsp.buf.format, { desc = "Format" }) +map("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) +map("n", "gr", vim.lsp.buf.references, { desc = "Go to references" }) + +-- Visual mode +map("v", "<", "", ">gv") + +-- Mixed modes +map({ "i", "n" }, "", "noh", { desc = "Clear search" }) +map({ "i", "v", "n", "s" }, "", "w", { desc = "Save file" }) + +-- Toggle comment +map("n", "/", "lua require('Comment.api').toggle.linewise.current()", { desc = "Toggle comment" }) +map("v", "/", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", { desc = "Toggle comment" }) diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua deleted file mode 100644 index d2cf8f3..0000000 --- a/.config/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,31 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) -end -vim.opt.rtp:prepend(vim.env.LAZY or lazypath) - -require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.util.project" }, - { import = "plugins" }, - }, - defaults = { - lazy = false, - version = false, - }, - install = { colorscheme = { "onedark" } }, - checker = { enabled = true }, - performance = { - rtp = { - disabled_plugins = { - "gzip", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - }, - }, - }, -}) diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/settings.lua similarity index 50% rename from .config/nvim/lua/config/options.lua rename to .config/nvim/lua/config/settings.lua index e159f3b..8f8c0bf 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/settings.lua @@ -1,8 +1,9 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here -local opt = vim.opt +local g = vim.g +g.mapleader = " " +g.loaded_netrw = 1 +g.loaded_netrwPlugin = 1 +local opt = vim.opt opt.autowrite = false opt.expandtab = false opt.shiftwidth = 4 @@ -13,5 +14,12 @@ opt.smartindent = true opt.spell = false opt.conceallevel = 0 opt.ignorecase = false +opt.number = true opt.relativenumber = false ---opt.cursorlineopt = "number" +opt.cursorline = true +opt.cursorlineopt = "both" +opt.termguicolors = true +opt.signcolumn = "yes" +opt.laststatus = 0 +opt.showmode = false +opt.ruler = false diff --git a/.config/nvim/lua/plugins/autocomplete.lua b/.config/nvim/lua/plugins/autocomplete.lua new file mode 100644 index 0000000..d255522 --- /dev/null +++ b/.config/nvim/lua/plugins/autocomplete.lua @@ -0,0 +1,9 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, +} diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..fdeba7c --- /dev/null +++ b/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,13 @@ +return { + "numToStr/Comment.nvim", + event = "VeryLazy", + opts = { + mappings = { + basic = false, + extra = false, + }, + }, + config = function(_, opts) + require("Comment").setup(opts) + end, +} diff --git a/.config/nvim/lua/plugins/disabled.lua b/.config/nvim/lua/plugins/disabled.lua deleted file mode 100644 index 7638708..0000000 --- a/.config/nvim/lua/plugins/disabled.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - { "akinsho/bufferline.nvim", enabled = false }, - { "nvim-lualine/lualine.nvim", enabled = false }, - { "folke/todo-comments.nvim", enabled = false }, - { "folke/neoconf.nvim", enabled = false }, -} diff --git a/.config/nvim/lua/plugins/explorer.lua b/.config/nvim/lua/plugins/explorer.lua deleted file mode 100644 index d52543f..0000000 --- a/.config/nvim/lua/plugins/explorer.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - opts = { - filesystem = { - filtered_items = { - hide_dotfiles = false, - }, - }, - follow_current_file = { - enabled = true, - }, - }, -} diff --git a/.config/nvim/lua/plugins/formatters.lua b/.config/nvim/lua/plugins/formatters.lua deleted file mode 100644 index fc869d6..0000000 --- a/.config/nvim/lua/plugins/formatters.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - "jose-elias-alvarez/null-ls.nvim", - opts = function() - local nls = require("null-ls") - return { - sources = { - nls.builtins.formatting.prettierd, - nls.builtins.formatting.shfmt, - nls.builtins.formatting.stylua, - }, - } - end, -} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..ffafecd --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,7 @@ +return { + "lewis6991/gitsigns.nvim", + event = "BufReadPre", + config = function() + require("gitsigns").setup() + end, +} diff --git a/.config/nvim/lua/plugins/languages.lua b/.config/nvim/lua/plugins/languages.lua deleted file mode 100644 index 89cb875..0000000 --- a/.config/nvim/lua/plugins/languages.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - "neovim/nvim-lspconfig", - opts = { - servers = { - lua_ls = {}, - - -- web dev - cssls = {}, - html = {}, - jsonls = {}, - tsserver = {}, - svelte = {}, - - -- go - gopls = { - settings = { - gopls = { - gofumpt = false, - }, - }, - }, - }, - }, -} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..d099721 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,24 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + opts = { + servers = { + lua_ls = {}, + gopls = {}, + + -- web dev + --cssls = {}, + --html = {}, + --jsonls = {}, + --tsserver = {}, + --svelte = {}, + }, + }, + config = function(_, opts) + local servers = opts.servers + + for server, server_opts in pairs(servers) do + require("lspconfig")[server].setup(server_opts) + end + end, + } diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua deleted file mode 100644 index d09139b..0000000 --- a/.config/nvim/lua/plugins/mason.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - -- Go - "gofumpt", - -- HTML, CSS, JS, TS, JSON, Markdown, YAML - "prettierd", - -- Bash - "shfmt", - -- Lua - "stylua", - }, - }, -} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..c331a43 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,7 @@ +return { + "nvim-telescope/telescope.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim" + }, +} diff --git a/.config/nvim/lua/plugins/theme.lua b/.config/nvim/lua/plugins/theme.lua index 22fa76b..fff9fab 100644 --- a/.config/nvim/lua/plugins/theme.lua +++ b/.config/nvim/lua/plugins/theme.lua @@ -1,21 +1,7 @@ return { - { - "navarasu/onedark.nvim", - opts = { - style = "dark", - --transparent = true, - }, - }, - { - "rcarriga/nvim-notify", - opts = { - --background_colour = "#000000", - }, - }, - { - "LazyVim/LazyVim", - opts = { - colorscheme = "onedark", - }, - }, + "navarasu/onedark.nvim", + event = "VeryLazy", + config = function() + require('onedark').load() + end, } diff --git a/.config/nvim/lua/plugins/tree.lua b/.config/nvim/lua/plugins/tree.lua new file mode 100644 index 0000000..805dbac --- /dev/null +++ b/.config/nvim/lua/plugins/tree.lua @@ -0,0 +1,18 @@ +return { + "nvim-tree/nvim-tree.lua", + event = "VeryLazy", + dependencies = { + "nvim-tree/nvim-web-devicons", + "navarasu/onedark.nvim", + }, + config = function() + require("nvim-tree").setup({ + view = { + width = 35, + }, + renderer = { + root_folder_label = false + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/highlight.lua b/.config/nvim/lua/plugins/treesitter.lua similarity index 61% rename from .config/nvim/lua/plugins/highlight.lua rename to .config/nvim/lua/plugins/treesitter.lua index 6bc769f..de48028 100644 --- a/.config/nvim/lua/plugins/highlight.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,5 +1,7 @@ return { "nvim-treesitter/nvim-treesitter", + event = { "BufReadPost", "BufNewFile" }, + build = ":TSUpdate", opts = { ensure_installed = { -- basics @@ -24,5 +26,10 @@ return { "gowork", "gosum", }, + highlight = { enable = true }, + indent = { enable = true }, }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, } diff --git a/.config/nvim/stylua.toml b/.config/nvim/stylua.toml deleted file mode 100644 index 7eff7b5..0000000 --- a/.config/nvim/stylua.toml +++ /dev/null @@ -1,3 +0,0 @@ -indent_type = "Tabs" -indent_width = 4 -column_width = 120