From 7ce708971dda37e3a1fd192eb612c666afd9605b Mon Sep 17 00:00:00 2001 From: Warwick New Date: Tue, 3 Mar 2026 00:56:57 +0000 Subject: [PATCH] Slowly reimplementing in a cleaner way using this tutorial: https://www.youtube.com/watch?v=SxuwQJ0JHMU --- init.lua | 5 +- lazy-lock.json | 46 ++---- lua/core/plugin_config/completions.lua | 55 ------- lua/core/plugin_config/dap-debug.lua | 57 ------- lua/core/plugin_config/darklight.lua | 9 -- lua/core/plugin_config/gruvbox.lua | 24 --- lua/core/plugin_config/indent-blankline.lua | 6 - lua/core/plugin_config/init.lua | 14 -- lua/core/plugin_config/lsp_config.lua | 72 --------- lua/core/plugin_config/lualine.lua | 15 -- lua/core/plugin_config/nvim-tree.lua | 12 -- lua/core/plugin_config/obsidian.lua | 47 ------ lua/core/plugin_config/org.lua | 73 --------- lua/core/plugin_config/telescope.lua | 6 - lua/core/plugin_config/terminal.lua | 16 -- lua/core/plugin_config/treesitter.lua | 18 --- lua/core/plugin_config/whichkey.lua | 91 ----------- lua/core/plugins.lua | 158 -------------------- lua/{core => }/defaults.lua | 0 lua/lazy-bootstrap.lua | 35 +++++ lua/plugins/gruvbox.lua | 29 ++++ lua/plugins/lsp-config.lua | 45 ++++++ lua/plugins/lualine.lua | 9 ++ lua/plugins/neo-tree.lua | 41 +++++ lua/plugins/telescope.lua | 29 ++++ lua/plugins/treesitter.lua | 22 +++ 26 files changed, 225 insertions(+), 709 deletions(-) delete mode 100644 lua/core/plugin_config/completions.lua delete mode 100644 lua/core/plugin_config/dap-debug.lua delete mode 100644 lua/core/plugin_config/darklight.lua delete mode 100644 lua/core/plugin_config/gruvbox.lua delete mode 100644 lua/core/plugin_config/indent-blankline.lua delete mode 100644 lua/core/plugin_config/init.lua delete mode 100644 lua/core/plugin_config/lsp_config.lua delete mode 100644 lua/core/plugin_config/lualine.lua delete mode 100644 lua/core/plugin_config/nvim-tree.lua delete mode 100644 lua/core/plugin_config/obsidian.lua delete mode 100644 lua/core/plugin_config/org.lua delete mode 100644 lua/core/plugin_config/telescope.lua delete mode 100644 lua/core/plugin_config/terminal.lua delete mode 100644 lua/core/plugin_config/treesitter.lua delete mode 100644 lua/core/plugin_config/whichkey.lua delete mode 100644 lua/core/plugins.lua rename lua/{core => }/defaults.lua (100%) create mode 100644 lua/lazy-bootstrap.lua create mode 100644 lua/plugins/gruvbox.lua create mode 100644 lua/plugins/lsp-config.lua create mode 100644 lua/plugins/lualine.lua create mode 100644 lua/plugins/neo-tree.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/treesitter.lua diff --git a/init.lua b/init.lua index aed66cf..c715106 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,2 @@ -require("core.defaults") -require("core.plugins") -require("core.plugin_config") +require("defaults") +require("lazy-bootstrap") diff --git a/lazy-lock.json b/lazy-lock.json index 39b0405..9424d2b 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,37 +1,17 @@ { - "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "darklight.nvim": { "branch": "main", "commit": "5db97e2d132ebdf32c7e5edb5b0c68be9ae43038" }, - "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" }, + "gruvbox.nvim": { "branch": "main", "commit": "561126520034a1dac2f78ab063db025d12555998" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "4cfe411526a7a99c18281135e8b4765ae6330d15" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" }, - "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, - "mini.animate": { "branch": "main", "commit": "0365de8b69331c25d0d0d7573407a7dc7719e578" }, - "mini.starter": { "branch": "main", "commit": "8ee6ce6a4c9be47682516908557cc062c4d595a2" }, - "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, - "nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" }, - "nvim-dap": { "branch": "master", "commit": "7bb46cc612bb127d7b0e3e9ed695267d830824ec" }, - "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lspconfig": { "branch": "master", "commit": "ac04ec3c2af08e9821b4eb64ede86072b9b213bf" }, - "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-tree.lua": { "branch": "master", "commit": "b8b44b6a2494d086a9177251a119f9daec6cace8" }, - "nvim-treesitter": { "branch": "main", "commit": "433779916223596dce3ea64f4b77300c3aa2bfdc" }, - "nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" }, - "obsidian-todo.nvim": { "branch": "main", "commit": "33466086a82fc24e43df81b38a1593a49ee990c1" }, - "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, - "org-bullets.nvim": { "branch": "main", "commit": "21437cfa99c70f2c18977bffd423f912a7b832ea" }, - "org-roam.nvim": { "branch": "main", "commit": "cf00a0b3797ee3370c2ca2bdedbc04b2f5309a1e" }, - "orgmode": { "branch": "master", "commit": "cf75da1a91071c6c041075eae4ca2326f9d1f52a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "9d6826582a3e8c84787bd7355df22a2812a1ad59" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "b9c795d3973e8eec22706af14959bc60c579e771" }, + "nvim-lspconfig": { "branch": "master", "commit": "ead0f5f342d8d323441e7d4b88f0fc436a81ad5f" }, + "nvim-treesitter": { "branch": "main", "commit": "cb2cb74f3c3cbbcc17e79cada2060165d616d849" }, + "nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" }, + "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, - "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, - "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, - "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" } } diff --git a/lua/core/plugin_config/completions.lua b/lua/core/plugin_config/completions.lua deleted file mode 100644 index 4ee70ef..0000000 --- a/lua/core/plugin_config/completions.lua +++ /dev/null @@ -1,55 +0,0 @@ -local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - -local cmp = require("cmp") -local luasnip = require("luasnip") - --- friendly snippets -require('luasnip.loaders.from_vscode').lazy_load() - -cmp.setup({ - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- they way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, { - { name = 'buffer' }, - }), -}) diff --git a/lua/core/plugin_config/dap-debug.lua b/lua/core/plugin_config/dap-debug.lua deleted file mode 100644 index 9295326..0000000 --- a/lua/core/plugin_config/dap-debug.lua +++ /dev/null @@ -1,57 +0,0 @@ -local dap, dapui = require("dap"), require("dapui") -dapui.setup(); -dap.listeners.before.attach.dapui_config = function() - dapui.open() -end -dap.listeners.before.launch.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 - --- C/C++/Rust (via gdb) -dap.adapters.gdb = { - type = "executable", - command = "gdb", - args = { "--interpreter=dap", "--eval-command", "set print pretty on" } -} - -dap.configurations.c = { - { - name = "Launch", - type = "gdb", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = "${workspaceFolder}", - stopAtBeginningOfMainSubprogram = false, - }, - { - name = "Select and attach to process", - type = "gdb", - request = "attach", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - pid = function() - local name = vim.fn.input('Executable name (filter): ') - return require("dap.utils").pick_process({ filter = name }) - end, - cwd = '${workspaceFolder}' - }, - { - name = 'Attach to gdbserver :1234', - type = 'gdb', - request = 'attach', - target = 'localhost:1234', - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = '${workspaceFolder}' - }, -} diff --git a/lua/core/plugin_config/darklight.lua b/lua/core/plugin_config/darklight.lua deleted file mode 100644 index e9c3337..0000000 --- a/lua/core/plugin_config/darklight.lua +++ /dev/null @@ -1,9 +0,0 @@ -require('darklight').setup({ - mode = 'custom', -- Sets darklight to custom mode - light_mode_callback = function() -- Function to call to set light mode - vim.opt.background="light" - end, - dark_mode_callback = function() -- Function to call to set dark mode - vim.opt.background="dark" - end, -}) diff --git a/lua/core/plugin_config/gruvbox.lua b/lua/core/plugin_config/gruvbox.lua deleted file mode 100644 index f1250c6..0000000 --- a/lua/core/plugin_config/gruvbox.lua +++ /dev/null @@ -1,24 +0,0 @@ -require("gruvbox").setup({ - terminal_colors = true, -- add neovim terminal colors - undercurl = true, - underline = true, - bold = true, - italic = { - strings = true, - emphasis = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "hard", -- can be "hard", "soft" or empty string - overrides = {}, - dim_inactive = false, - transparent_mode = false, -}) -vim.cmd("colorscheme gruvbox") diff --git a/lua/core/plugin_config/indent-blankline.lua b/lua/core/plugin_config/indent-blankline.lua deleted file mode 100644 index 64f2297..0000000 --- a/lua/core/plugin_config/indent-blankline.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("ibl").setup { - -- for example, context is off by default, use this to turn it on - --show_current_context = false, - --show_current_context_start = false, -} -vim.cmd [[colorscheme gruvbox]] diff --git a/lua/core/plugin_config/init.lua b/lua/core/plugin_config/init.lua deleted file mode 100644 index 2efbf16..0000000 --- a/lua/core/plugin_config/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -require("core.plugin_config.gruvbox") -require("core.plugin_config.lualine") -require("core.plugin_config.nvim-tree") -require("core.plugin_config.telescope") -require("core.plugin_config.terminal") -require("core.plugin_config.indent-blankline") -require("core.plugin_config.org") -require("core.plugin_config.darklight") -require("core.plugin_config.obsidian") -require("core.plugin_config.treesitter") -require("core.plugin_config.lsp_config") -require("core.plugin_config.completions") -require("core.plugin_config.whichkey") -require("core.plugin_config.dap-debug") diff --git a/lua/core/plugin_config/lsp_config.lua b/lua/core/plugin_config/lsp_config.lua deleted file mode 100644 index c449205..0000000 --- a/lua/core/plugin_config/lsp_config.lua +++ /dev/null @@ -1,72 +0,0 @@ -require("mason").setup() -require("mason-lspconfig").setup({ - automatic_enable = true, -}) --- gloabal mappings -vim.keymap.set('n', 'le', vim.diagnostic.open_float) -vim.keymap.set('n', 'ln', vim.diagnostic.goto_next) -vim.keymap.set('n', 'lN', vim.diagnostic.goto_prev) -vim.keymap.set('n', 'lj', vim.diagnostic.setloclist) - -vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) - -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' - - -- Buffer local mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local opts = { buffer = ev.buf } - vim.keymap.set('n', 'lD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'ld', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'lk', vim.lsp.buf.hover, opts) - vim.keymap.set('n', 'li', vim.lsp.buf.implementation, opts) - --vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) - --vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - --vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - --vim.keymap.set('n', 'wl', function() - -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - --end, opts) - vim.keymap.set('n', 'lt', vim.lsp.buf.type_definition, opts) - vim.keymap.set('n', 'lR', vim.lsp.buf.rename, opts) - vim.keymap.set({ 'n', 'v' }, 'la', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'lr', vim.lsp.buf.references, opts) - vim.keymap.set('n', 'lf', function() - vim.lsp.buf.format { async = true } - end, opts) - end, -}) - --- Attach lsp to completion engine -local capabilities = require("cmp_nvim_lsp").default_capabilities() - -vim.lsp.config.lua_ls.settings = { - Lua = { - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { - 'vim', - 'require' - }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - checkThirdParty = false, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - } -vim.lsp.config.lua_ls.capabilities = capabilities -vim.lsp.config.clangd.capabilities = capabilities -vim.lsp.config.cmake.capabilities = capabilities -vim.lsp.config.ltex.capabilities = capabilities -vim.lsp.config.ltex.settings = { ltex = { language = "en-GB" } } -vim.lsp.config.ts_ls.capabilities = capabilities -vim.lsp.config.jsonls.capabilities = capabilities -vim.lsp.config.rust_analyzer.capabilities = capabilities -vim.lsp.config.taplo.capabilities = capabilities -vim.lsp.config.zls.capabilities = capabilities diff --git a/lua/core/plugin_config/lualine.lua b/lua/core/plugin_config/lualine.lua deleted file mode 100644 index 1ef1a81..0000000 --- a/lua/core/plugin_config/lualine.lua +++ /dev/null @@ -1,15 +0,0 @@ -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'gruvbox', - }, - sections = { - lualine_a = { - { - 'filename', - file_status = true, -- displays file status (readonly status, modified status) - path = 1 -- 0 = just filename, 1 = relative path, 2 = absolute path - } - } - } -} diff --git a/lua/core/plugin_config/nvim-tree.lua b/lua/core/plugin_config/nvim-tree.lua deleted file mode 100644 index 9739576..0000000 --- a/lua/core/plugin_config/nvim-tree.lua +++ /dev/null @@ -1,12 +0,0 @@ --- disable netrw at the very start of your init.lua -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - --- set termguicolors to enable highlight groups -vim.opt.termguicolors = true - --- empty setup using defaults -require("nvim-tree").setup() - --- keymap -vim.keymap.set("n", "s", ':NvimTreeFindFileToggle') diff --git a/lua/core/plugin_config/obsidian.lua b/lua/core/plugin_config/obsidian.lua deleted file mode 100644 index 0011f88..0000000 --- a/lua/core/plugin_config/obsidian.lua +++ /dev/null @@ -1,47 +0,0 @@ -local vaultLocation = "$HOME/Sync/wiki" -require("obsidian").setup({ - workspaces = { - { - name = "vault", - path = vaultLocation, - }, - }, - completion = { - -- Set to false to disable completion. - nvim_cmp = true, - }, - templates = { - subdir = "Templates", - -- A map for custom variables, the key should be the variable and the value a function - substitutions = {}, - }, - daily_notes = { - -- Optional, if you keep daily notes in a separate directory. - folder = "diary", - -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' - template = "daily_note.md" - }, - note_id_func = function(title) - local suffix = "" - if title ~= nil then - -- If title is given, transform it into valid file name. - suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() - else - -- If title is nil, just add 4 random uppercase letters to the suffix. - for _ = 1, 4 do - suffix = suffix .. string.char(math.random(65, 90)) - end - end - return suffix - end, -}) - --- for obsidian-todo.nvim -require("telescope").setup({ - extensions = { - obsidian_todo = { - search_path = vaultLocation, - search_pattern = "- [ ] #todo", - }, - }, -}) diff --git a/lua/core/plugin_config/org.lua b/lua/core/plugin_config/org.lua deleted file mode 100644 index cf160f5..0000000 --- a/lua/core/plugin_config/org.lua +++ /dev/null @@ -1,73 +0,0 @@ --- Treesitter configuration ---require('nvim-treesitter.configs').setup({ --- -- If TS highlights are not enabled at all, or disabled via `disable` prop, --- -- highlighting will fallback to default Vim syntax highlighting --- highlight = { --- enable = true, --- -- Required for spellcheck, some LaTex highlights and --- -- code block highlights that do not have ts grammar --- additional_vim_regex_highlighting = { 'org' }, --- }, --- ensure_installed = { 'org' }, -- Or run :TSUpdate org ---}) - -require('orgmode').setup({ - org_agenda_files = { '~/Sync/wiki/org/**/*.org' }, - org_default_notes_file = '~/Sync/wiki/org/refile.org', - org_todo_keywords = { 'TODO(t)', 'NEXT(n)', '|', 'HOLD(h)', 'DONE(d)' } -}) - - -require('cmp').setup({ - sources = { - { name = 'orgmode' } - } -}) - -require('org-bullets').setup() - -require("org-roam").setup({ - directory = "~/Sync/wiki/org/roam/", - --org_files = { - -- "~/another_org_dir", - -- "~/some/folder/*.org", - -- "~/a/single/org_file.org", - --} - templates = { - d = { - description = "default", - template = "%?", - target = "%<%Y%m%d%H%M%S>-%[slug].org", - }, - f = { - description = "fleeting", - template = "#+filetags: fleeting\n\n%?", - target = "fleeting%[sep]%<%Y%m%d%H%M%S>-%[slug].org", - }, - l = { - description = "literature", - template = "#+filetags: literature\n\n* %?\n** Description\n\n** Notes\n - pg 1: ", - target = "literature%[sep]%<%Y%m%d%H%M%S>-%[slug].org", - }, - r = { - description = "reference", - template = "#+filetags: reference\n\n* %?\n** Description\n\n** Notes\n - pg 1: ", - target = "reference%[sep]%<%Y%m%d%H%M%S>-%[slug].org", - }, - m = { - description = "main", - template = "%?", - target = "%<%Y%m%d%H%M%S>-%[slug].org", - }, - }, -}) - --- Automatic line wrapping -vim.api.nvim_create_autocmd("FileType", { - pattern = "org", - callback = function() - vim.opt_local.textwidth = 80 - vim.opt_local.wrap = true - vim.opt_local.linebreak = true - end, -}) diff --git a/lua/core/plugin_config/telescope.lua b/lua/core/plugin_config/telescope.lua deleted file mode 100644 index 8cb950c..0000000 --- a/lua/core/plugin_config/telescope.lua +++ /dev/null @@ -1,6 +0,0 @@ -local builtin = require('telescope.builtin') - -vim.keymap.set('n', 'ff', builtin.find_files, {}) -vim.keymap.set('n', 'fo', builtin.oldfiles, {}) -vim.keymap.set('n', 'fg', builtin.live_grep, {}) -vim.keymap.set('n', 'fh', builtin.help_tags, {}) diff --git a/lua/core/plugin_config/terminal.lua b/lua/core/plugin_config/terminal.lua deleted file mode 100644 index 13502c6..0000000 --- a/lua/core/plugin_config/terminal.lua +++ /dev/null @@ -1,16 +0,0 @@ -require("toggleterm").setup({ - hide_numbers = true, - start_in_insert = true, - shell = vim.o.shell, -}) - --- Get out of terminal! -function _G.set_terminal_keymaps() - local opts = {buffer = 0} - vim.keymap.set('t', '', [[]], opts) - vim.keymap.set('t', '', [[]], opts) -end -vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') - --- Open terminal keymap -vim.keymap.set('n', 't', ":ToggleTerm",{noremap = true, silent = true}) diff --git a/lua/core/plugin_config/treesitter.lua b/lua/core/plugin_config/treesitter.lua deleted file mode 100644 index e14ad00..0000000 --- a/lua/core/plugin_config/treesitter.lua +++ /dev/null @@ -1,18 +0,0 @@ -require('nvim-treesitter').install({ 'stable' }) -require('nvim-treesitter').update() - --- Auto launch for every TSInstalled filetype -vim.api.nvim_create_autocmd('FileType', { - pattern = require('nvim-treesitter').get_installed(), - callback = function(event) - -- syntax highlighting, provided by Neovim - vim.treesitter.start() - -- Use regex highlighting as well as tree-sitter - vim.bo.syntax = event.match - -- folds, provided by Neovim - vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' - vim.wo.foldmethod = 'expr' - -- indentation, provided by nvim-treesitter - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" - end, -}) diff --git a/lua/core/plugin_config/whichkey.lua b/lua/core/plugin_config/whichkey.lua deleted file mode 100644 index 5bb2d9a..0000000 --- a/lua/core/plugin_config/whichkey.lua +++ /dev/null @@ -1,91 +0,0 @@ -local whichkey = require("which-key") - -local keymap = { - { "T", group = "todo" }, - { "TN", function() require("todo-comments").jump_prev() end, desc = "Jump to previous TODO:" }, - { "TT", "TodoTelescope", desc = "Search TODO:'s" }, - { "Tj", "TodoLocList", desc = "List TODO:'s in buffer" }, - { "Tn", function() require("todo-comments").jump_next() end, desc = "Jump to next TODO:" }, - { "d", group = "DAP debug tools" }, - { "dc", function() require('dap').continue() end, desc = "continue/launch" }, - { "db", function() require('dap').toggle_breakpoint() end, desc = "toggle breakpoint" }, - { "di", function() require('dap').step_into() end, desc = "step into" }, - { "do", function() require('dap').step_over() end, desc = "step over" }, - { "dO", function() require('dap').step_out() end, desc = "step over" }, - { "f", group = "find (telescope)" }, - { "ff", "Telescope find_files", desc = "Find" }, - { "fg", "Telescope live_grep", desc = "Grep" }, - { "fh", "Telescope help_tags", desc = "Help Tags" }, - { "fo", "Telescope oldfiles", desc = "Old Files" }, - { "g", group = "git" }, - { "gb", "Telescope git_branches", desc = "Branches" }, - { "gg", "Telescope git_commits", desc = "LazyGit" }, - { "gl", "LazyGit", desc = "Commits" }, - { "gs", "Telescope git_status", desc = "Status" }, - { "l", group = "lsp" }, - { "lD", "lua vim.lsp.buf.declaration()", desc = "Declaration" }, - { "lN", "lua vim.diagnostic.goto_prev()", desc = "Previous Diagnostic" }, - { "lR", "lua vim.lsp.buf.rename()", desc = "Rename" }, - { "la", "lua vim.lsp.buf.code_action()", desc = "Code Action" }, - { "ld", "lua vim.lsp.buf.definition()", desc = "Definition" }, - { "le", "lua vim.diagnostic.open_float()", desc = "Diagnostic Float" }, - { "lf", function() vim.lsp.buf.format { async = true } end, desc = "Format" }, - { "li", "lua vim.lsp.buf.implementation()", desc = "Implementation" }, - { "lj", "lua vim.diagnostic.setloclist()", desc = "Diagnostic List" }, - { "lk", "lua vim.lsp.buf.hover()", desc = "Hover" }, - { "ln", "lua vim.diagnostic.goto_next()", desc = "Next Diagnostic" }, - { "lr", "lua vim.lsp.buf.references()", desc = "References" }, - { "lt", "lua vim.lsp.buf.type_definition()", desc = "Type Definition" }, - { "m", "DarkLightSwitch", desc = "Toggle dark mode" }, - { "o", group = "org mode" }, - { "oI", "e ~/Sync/wiki/org", desc = "Open Org directory" }, - { "t", desc = "Toggle Terminal" }, - { "v", group = "obsidian Vault" }, - { "vL", "ObsidianLinkNew", desc = "Link New Note from Current Selection" }, - { "vT", "ObsidianTemplate", desc = "Open Template" }, - { "vb", "ObsidianBacklinks", desc = "List Backlinks" }, - { "vd", "ObsidianToday", desc = "Open Daily Note" }, - { "vf", "ObsidianFollowLink", desc = "Follow Link" }, - { "vi", "e ~/Sync/wiki/index.md", desc = "Open Index" }, - { "vl", "ObsidianLink", desc = "Link Current Selection" }, - { "vn", "ObsidianNew", desc = "New Note" }, - { "vo", "ObsidianOpen", desc = "Obsidian Open" }, - { "vp", "ObsidianPasteImg", desc = "Paste Image" }, - { "vq", "ObsidianQuickSwitch", desc = "Quick Switch with fzf" }, - { "vr", "ObsidianRename", desc = "Rename Note" }, - { "vs", "ObsidianSearch", desc = "Search Notes" }, - { "vT", "ObsidianTomorrow", desc = "Open Tomorrows Note" }, - { "vt", "Telescope obsidian_todo obsidian_todo", desc = "Search for all TODOs" }, - { "vw", "ObsidianWorkspace", desc = "Switch Workspace" }, - { "vy", "ObsidianYesterday", desc = "Open Yesterdays Note" }, - { "w", group = "window" }, - { "w+", desc = "Increase height" }, - { "w-", desc = "Decrease height" }, - { "w<", desc = "Decrease width" }, - { "w=", desc = "Equally high and wide" }, - { "w>", desc = "Increase width" }, - { "wT", desc = "Break out into a new tab" }, - { "wh", desc = "Go to the left window" }, - { "wj", desc = "Go to the down window" }, - { "wk", desc = "Go to the up window" }, - { "wl", desc = "Go to the right window" }, - { "wq", desc = "Quit a window" }, - { "ws", desc = "Split window" }, - { "wv", desc = "Split window vertically" }, - { "ww", desc = "Pick Window" }, - { "wx", desc = "Swap current with next" }, - { "w|", desc = "Max out the width" }, - } --- Map window keys to leader w -vim.cmd [[nmap w ]] - -whichkey.setup { - hide_statusline = false, - default_keymap_settings = { - silent = true, - noremap = true, - }, - default_mode = 'n', -} - -whichkey.add(keymap) diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua deleted file mode 100644 index 619f15d..0000000 --- a/lua/core/plugins.lua +++ /dev/null @@ -1,158 +0,0 @@ --- 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) - -local plugins = { - 'folke/lazy.nvim', - 'ellisonleao/gruvbox.nvim', - 'nvim-tree/nvim-tree.lua', - 'nvim-tree/nvim-web-devicons', - 'nvim-lualine/lualine.nvim', - 'nvim-treesitter/nvim-treesitter', - { - 'windwp/nvim-autopairs', - event = "InsertEnter", - opts = {} -- this is equalent to setup({}) function - }, - 'akinsho/toggleterm.nvim', - -- keybind tooltip - { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end, - }, - { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, - -- fzf - { - 'nvim-telescope/telescope.nvim', - --branch = "0.1.x", - dependencies = { { 'nvim-lua/plenary.nvim' } } - }, - -- TODO - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = {} - }, - -- Lsp - { - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - 'neovim/nvim-lspconfig' - }, - -- completion - 'hrsh7th/nvim-cmp', - 'hrsh7th/cmp-nvim-lsp', - { - "L3MON4D3/LuaSnip", - version = "2.*", -- Replace by the latest released major - -- install jsregexp (optional!). - build = "make install_jsregexp" - }, - 'saadparwaiz1/cmp_luasnip', - 'rafamadriz/friendly-snippets', - -- Org Mode - { - 'nvim-orgmode/orgmode', - dependencies = { - { 'nvim-treesitter/nvim-treesitter', lazy = true }, - }, - }, - { - 'akinsho/org-bullets.nvim', - dependencies = { { 'nvim-orgmode/orgmode' } }, - }, - { - "chipsenkbeil/org-roam.nvim", - tag = "0.1.1", - dependencies = { - { - "nvim-orgmode/orgmode", - --tag = "0.3.7", - }, - }, - }, - -- Obsidian - { - "epwalsh/obsidian.nvim", - version = "*", - lazy = true, - ft = "markdown", - dependencies = { - "nvim-lua/plenary.nvim", - }, - }, - { - "LilleAila/obsidian-todo.nvim", - dependencies = { 'nvim-telescope/telescope.nvim' } - }, - -- Lightmode switcher - 'eliseshaffer/darklight.nvim', - -- Mini tools - { - 'echasnovski/mini.animate', - version = false, - config = function() - local animate = require('mini.animate') - animate.setup({ - scroll = { timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }) }, - cursor = { enable = false } - }) - end - - }, - { - 'echasnovski/mini.starter', - version = false, - config = function() - require('mini.starter').setup() - end - - }, - -- Git tooling - { - "kdheepak/lazygit.nvim", - cmd = { - "LazyGit", - "LazyGitConfig", - "LazyGitCurrentFile", - "LazyGitFilter", - "LazyGitFilterCurrentFile", - }, - dependencies = { - "nvim-lua/plenary.nvim", - } - }, - { - "sindrets/diffview.nvim" - }, - -- DAP Debugging Tools - { - "rcarriga/nvim-dap-ui", - dependencies = { - "mfussenegger/nvim-dap", - "nvim-neotest/nvim-nio", - "jay-babu/mason-nvim-dap.nvim" - } - } -} - -local opts = {} - -require("lazy").setup(plugins, opts) diff --git a/lua/core/defaults.lua b/lua/defaults.lua similarity index 100% rename from lua/core/defaults.lua rename to lua/defaults.lua diff --git a/lua/lazy-bootstrap.lua b/lua/lazy-bootstrap.lua new file mode 100644 index 0000000..337dd51 --- /dev/null +++ b/lua/lazy-bootstrap.lua @@ -0,0 +1,35 @@ +-- 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) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +--vim.g.mapleader = " " +--vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/plugins/gruvbox.lua b/lua/plugins/gruvbox.lua new file mode 100644 index 0000000..aa0039d --- /dev/null +++ b/lua/plugins/gruvbox.lua @@ -0,0 +1,29 @@ +return { + "ellisonleao/gruvbox.nvim", + config = function() + require("gruvbox").setup({ + terminal_colors = true, -- add neovim terminal colors + undercurl = true, + underline = true, + bold = true, + italic = { + strings = true, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "hard", -- can be "hard", "soft" or empty string + overrides = {}, + dim_inactive = false, + transparent_mode = false, + }) + vim.cmd("colorscheme gruvbox") + end +} diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..98a1150 --- /dev/null +++ b/lua/plugins/lsp-config.lua @@ -0,0 +1,45 @@ +return { + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + { + "neovim/nvim-lspconfig", + config = function() + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'le', vim.diagnostic.open_float) + vim.keymap.set('n', 'ln', vim.diagnostic.goto_next) + vim.keymap.set('n', 'lN', vim.diagnostic.goto_prev) + vim.keymap.set('n', 'lj', vim.diagnostic.setloclist) + + vim.keymap.set('n', 'lD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'ld', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'lk', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'li', vim.lsp.buf.implementation, opts) + --vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + --vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + --vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + --vim.keymap.set('n', 'wl', function() + -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + --end, opts) + vim.keymap.set('n', 'lt', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'lR', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'la', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'lr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'lf', function() + vim.lsp.buf.format { async = true } + end, opts) + end, + }) + end + }, + } +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..0f62684 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,9 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup { + options = { theme = 'gruvbox' } + } + end +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..6c3f8be --- /dev/null +++ b/lua/plugins/neo-tree.lua @@ -0,0 +1,41 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "nvim-tree/nvim-web-devicons", + }, + }, + { + "antosha417/nvim-lsp-file-operations", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-neo-tree/neo-tree.nvim", -- makes sure that this loads after Neo-tree. + }, + config = function() + require("lsp-file-operations").setup() + vim.keymap.set("n", "s", ':Neotree toggle') + end, + }, + { + "s1n7ax/nvim-window-picker", + version = "2.*", + config = function() + require("window-picker").setup({ + filter_rules = { + include_current_win = false, + autoselect_one = true, + -- filter using buffer options + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { "neo-tree", "neo-tree-popup", "notify" }, + -- if the buffer type is one of following, the window will be ignored + buftype = { "terminal", "quickfix" }, + }, + }, + }) + end, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..b28f494 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,29 @@ +return { + { + 'nvim-telescope/telescope.nvim', + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + config = function() + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fo', builtin.oldfiles, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, {}) + end + }, + { + 'nvim-telescope/telescope-ui-select.nvim', + config = function() + require("telescope").setup { + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown { + } + } + } + } + require("telescope").load_extension("ui-select") + end + } +} + diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..7f25a26 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,22 @@ +return { + 'nvim-treesitter/nvim-treesitter', + lazy = false, + build = ':TSUpdate', + config = function() + -- Auto launch for every TSInstalled filetype + vim.api.nvim_create_autocmd('FileType', { + pattern = require('nvim-treesitter').get_installed(), + callback = function(event) + -- syntax highlighting, provided by Neovim + vim.treesitter.start() + -- Use regex highlighting as well as tree-sitter + vim.bo.syntax = event.match + -- folds, provided by Neovim + vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' + vim.wo.foldmethod = 'expr' + -- indentation, provided by nvim-treesitter + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, + }) + end +}