diff --git a/after/plugin/cloak.lua b/after/plugin/cloak.lua deleted file mode 100644 index 1eaf7d0f..00000000 --- a/after/plugin/cloak.lua +++ /dev/null @@ -1,22 +0,0 @@ -require("cloak").setup({ - enabled = true, - cloak_character = "*", - -- The applied highlight group (colors) on the cloaking, see `:h highlight`. - highlight_group = "Comment", - patterns = { - { - -- Match any file starting with ".env". - -- This can be a table to match multiple file patterns. - file_pattern = { - ".env*", - "wrangler.toml", - ".dev.vars", - }, - -- Match an equals sign and any character after it. - -- This can also be a table of patterns to cloak, - -- example: cloak_pattern = { ":.+", "-.+" } for yaml files. - cloak_pattern = "=.+" - }, - }, -}) - diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua deleted file mode 100644 index fe97b1bb..00000000 --- a/after/plugin/colors.lua +++ /dev/null @@ -1,14 +0,0 @@ -require('rose-pine').setup({ - disable_background = true -}) - -function ColorMyPencils(color) - color = color or "rose-pine" - vim.cmd.colorscheme(color) - - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) - -end - -ColorMyPencils() diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua deleted file mode 100644 index 41f0512b..00000000 --- a/after/plugin/fugitive.lua +++ /dev/null @@ -1,29 +0,0 @@ -vim.keymap.set("n", "gs", vim.cmd.Git) - -local ThePrimeagen_Fugitive = vim.api.nvim_create_augroup("ThePrimeagen_Fugitive", {}) - -local autocmd = vim.api.nvim_create_autocmd -autocmd("BufWinEnter", { - group = ThePrimeagen_Fugitive, - pattern = "*", - callback = function() - if vim.bo.ft ~= "fugitive" then - return - end - - local bufnr = vim.api.nvim_get_current_buf() - local opts = {buffer = bufnr, remap = false} - vim.keymap.set("n", "p", function() - vim.cmd.Git('push') - end, opts) - - -- rebase always - vim.keymap.set("n", "P", function() - vim.cmd.Git({'pull', '--rebase'}) - end, opts) - - -- NOTE: It allows me to easily set the branch i am pushing and any tracking - -- needed if i did not set the branch up correctly - vim.keymap.set("n", "t", ":Git push -u origin ", opts); - end, -}) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua deleted file mode 100644 index 4a6ba871..00000000 --- a/after/plugin/harpoon.lua +++ /dev/null @@ -1,12 +0,0 @@ -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") - -vim.keymap.set("n", "a", mark.add_file) -vim.keymap.set("n", "", ui.toggle_quick_menu) - -vim.keymap.set("n", "", function() ui.nav_file(1) end) -vim.keymap.set("n", "", function() ui.nav_file(2) end) -vim.keymap.set("n", "", function() ui.nav_file(3) end) -vim.keymap.set("n", "", function() ui.nav_file(4) end) - - diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua deleted file mode 100644 index 346a7ee5..00000000 --- a/after/plugin/lsp.lua +++ /dev/null @@ -1,60 +0,0 @@ -local lsp = require("lsp-zero") - -lsp.preset("recommended") - -lsp.ensure_installed({ - 'tsserver', - 'rust_analyzer', -}) - --- Fix Undefined global 'vim' -lsp.nvim_workspace() - - -local cmp = require('cmp') -local cmp_select = {behavior = cmp.SelectBehavior.Select} -local cmp_mappings = lsp.defaults.cmp_mappings({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), -}) - -cmp_mappings[''] = nil -cmp_mappings[''] = nil - -lsp.setup_nvim_cmp({ - mapping = cmp_mappings -}) - -lsp.set_preferences({ - suggest_lsp_servers = false, - sign_icons = { - error = 'E', - warn = 'W', - hint = 'H', - info = 'I' - } -}) - -lsp.on_attach(function(client, bufnr) - local opts = {buffer = bufnr, remap = false} - - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) -end) - -lsp.setup() - -vim.diagnostic.config({ - virtual_text = true -}) - diff --git a/after/plugin/refactoring.lua b/after/plugin/refactoring.lua deleted file mode 100644 index 2f9f70c1..00000000 --- a/after/plugin/refactoring.lua +++ /dev/null @@ -1,5 +0,0 @@ -require('refactoring').setup({}) - -vim.api.nvim_set_keymap("v", "ri", [[ lua require('refactoring').refactor('Inline Variable')]], {noremap = true, silent = true, expr = false}) - - diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua deleted file mode 100644 index 29f5a62f..00000000 --- a/after/plugin/telescope.lua +++ /dev/null @@ -1,8 +0,0 @@ -local builtin = require('telescope.builtin') -vim.keymap.set('n', 'pf', builtin.find_files, {}) -vim.keymap.set('n', '', builtin.git_files, {}) -vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) -end) -vim.keymap.set('n', 'vh', builtin.help_tags, {}) - diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua deleted file mode 100644 index 459b92fe..00000000 --- a/after/plugin/treesitter.lua +++ /dev/null @@ -1,23 +0,0 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" - ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust" }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, - - highlight = { - -- `false` will disable the whole extension - enable = true, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} - diff --git a/after/plugin/trouble.lua b/after/plugin/trouble.lua deleted file mode 100644 index cf1256a3..00000000 --- a/after/plugin/trouble.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.keymap.set("n", "xq", "TroubleToggle quickfix", - {silent = true, noremap = true} -) diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua deleted file mode 100644 index 97bb7ab0..00000000 --- a/after/plugin/undotree.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) - diff --git a/after/plugin/zenmode.lua b/after/plugin/zenmode.lua deleted file mode 100644 index 753fbf8a..00000000 --- a/after/plugin/zenmode.lua +++ /dev/null @@ -1,30 +0,0 @@ - -vim.keymap.set("n", "zz", function() - require("zen-mode").setup { - window = { - width = 90, - options = { } - }, - } - require("zen-mode").toggle() - vim.wo.wrap = false - vim.wo.number = true - vim.wo.rnu = true - ColorMyPencils() -end) - - -vim.keymap.set("n", "zZ", function() - require("zen-mode").setup { - window = { - width = 80, - options = { } - }, - } - require("zen-mode").toggle() - vim.wo.wrap = false - vim.wo.number = false - vim.wo.rnu = false - vim.opt.colorcolumn = "0" - ColorMyPencils() -end) diff --git a/dev b/dev deleted file mode 100755 index 6f51fbc7..00000000 --- a/dev +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -rm -rf ~/.config/nvim -ln -s $(pwd) ~/.config/nvim - diff --git a/init.lua b/init.lua index a39d9f18..e73966b1 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1,4 @@ require("theprimeagen") +-- hello fem + diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..e9bcf076 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,35 @@ +{ + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "b7d056dab963b5d3f2c560d92937cb51db61cb5b" }, + "cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "copilot.vim": { "branch": "release", "commit": "22fd9542e3c47552abab5e685fefd760e4f405b2" }, + "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, + "fidget.nvim": { "branch": "main", "commit": "1d1042d418ee8cb70d68f1e38db639844331c093" }, + "friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, + "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2b3d247fce06f53934174f5dfe0362c42d65c00c" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, + "neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" }, + "neotest": { "branch": "master", "commit": "73043d666780e35185a77589e01bec96a52db910" }, + "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" }, + "neotest-vitest": { "branch": "main", "commit": "87e91bfd9419a8c74bf0d105e2ae31b9692daf0b" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "1759ea68fbbb1303192020d3e59936189359e0ed" }, + "nvim-treesitter": { "branch": "master", "commit": "364b86ec8ea88e4a77ba676b93fb10829d6a9cb3" }, + "plenary": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "rose-pine": { "branch": "main", "commit": "9d7474f80afe2f0cfcb4fabfc5451f509d844b85" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" }, + "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, + "undotree": { "branch": "master", "commit": "a1758ba9990b7189f601a3a5acdfc8ca3907a700" }, + "vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" }, + "vim-fugitive": { "branch": "master", "commit": "f116dcc8e21021e6fbfb6b0a9f8f7b9566d933f4" }, + "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } +} \ No newline at end of file diff --git a/lua/theprimeagen/init.lua b/lua/theprimeagen/init.lua index 8db3ffac..9ec4f845 100644 --- a/lua/theprimeagen/init.lua +++ b/lua/theprimeagen/init.lua @@ -1,9 +1,17 @@ require("theprimeagen.set") require("theprimeagen.remap") +require("theprimeagen.lazy_init") +-- DO.not -- DO NOT INCLUDE THIS -vim.opt.rtp:append("~/personal/streamer-tools") + +-- If i want to keep doing lsp debugging +-- function restart_htmx_lsp() +-- require("lsp-debug-tools").restart({ expected = {}, name = "htmx-lsp", cmd = { "htmx-lsp", "--level", "DEBUG" }, root_dir = vim.loop.cwd(), }); +-- end + -- DO NOT INCLUDE THIS +-- DO.not local augroup = vim.api.nvim_create_augroup local ThePrimeagenGroup = augroup('ThePrimeagen', {}) @@ -15,6 +23,12 @@ function R(name) require("plenary.reload").reload_module(name) end +vim.filetype.add({ + extension = { + templ = 'templ', + } +}) + autocmd('TextYankPost', { group = yank_group, pattern = '*', @@ -32,6 +46,35 @@ autocmd({"BufWritePre"}, { command = [[%s/\s\+$//e]], }) +autocmd('BufEnter', { + group = ThePrimeagenGroup, + callback = function() + if vim.bo.filetype == "zig" then + pcall(vim.cmd.colorscheme, "tokyonight-night") + else + pcall(vim.cmd.colorscheme, "rose-pine-moon") + end + end +}) + + +autocmd('LspAttach', { + group = ThePrimeagenGroup, + callback = function(e) + local opts = { buffer = e.buf } + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + end +}) + vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 vim.g.netrw_winsize = 25 diff --git a/lua/theprimeagen/lazy/cloak.lua b/lua/theprimeagen/lazy/cloak.lua new file mode 100644 index 00000000..2dd083fe --- /dev/null +++ b/lua/theprimeagen/lazy/cloak.lua @@ -0,0 +1,26 @@ +return { + "laytan/cloak.nvim", + config = function() + require("cloak").setup({ + enabled = true, + cloak_character = "*", + -- The applied highlight group (colors) on the cloaking, see `:h highlight`. + highlight_group = "Comment", + patterns = { + { + -- Match any file starting with ".env". + -- This can be a table to match multiple file patterns. + file_pattern = { + ".env*", + "wrangler.toml", + ".dev.vars", + }, + -- Match an equals sign and any character after it. + -- This can also be a table of patterns to cloak, + -- example: cloak_pattern = { ":.+", "-.+" } for yaml files. + cloak_pattern = "=.+" + }, + }, + }) + end +} diff --git a/lua/theprimeagen/lazy/colors.lua b/lua/theprimeagen/lazy/colors.lua new file mode 100644 index 00000000..c345f9df --- /dev/null +++ b/lua/theprimeagen/lazy/colors.lua @@ -0,0 +1,91 @@ +function ColorMyPencils(color) + color = color or "rose-pine-moon" + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +end + +return { + + { + "erikbackman/brightburn.vim", + }, + + { + "folke/tokyonight.nvim", + lazy = false, + opts = {}, + config = function() + ColorMyPencils() + end + }, + { + "ellisonleao/gruvbox.nvim", + name = "gruvbox", + config = function() + require("gruvbox").setup({ + terminal_colors = true, -- add neovim terminal colors + undercurl = true, + underline = false, + bold = true, + italic = { + strings = false, + emphasis = false, + comments = false, + operators = false, + folds = false, + }, + 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 = "", -- can be "hard", "soft" or empty string + palette_overrides = {}, + overrides = {}, + dim_inactive = false, + transparent_mode = false, + }) + end, + }, + { + "folke/tokyonight.nvim", + config = function() + require("tokyonight").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` + transparent = true, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = false }, + keywords = { italic = false }, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows + }, + }) + end + }, + + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + require('rose-pine').setup({ + disable_background = true, + styles = { + italic = false, + }, + }) + + ColorMyPencils(); + end + }, + + +} diff --git a/lua/theprimeagen/lazy/conform.lua b/lua/theprimeagen/lazy/conform.lua new file mode 100644 index 00000000..3a4d3b4c --- /dev/null +++ b/lua/theprimeagen/lazy/conform.lua @@ -0,0 +1,30 @@ +return { + "stevearc/conform.nvim", + opts = {}, + config = function() + require("conform").setup({ + format_on_save = { + timeout_ms = 5000, + lsp_format = "fallback", + }, + formatters_by_ft = { + c = { "clang-format" }, + cpp = { "clang-format" }, + lua = { "stylua" }, + go = { "gofmt" }, + javascript = { "prettier" }, + typescript = { "prettier" }, + elixir = { "mix" }, + }, + formatters = { + ["clang-format"] = { + prepend_args = { "-style=file", "-fallback-style=LLVM" }, + }, + }, + }) + + vim.keymap.set("n", "f", function() + require("conform").format({ bufnr = 0 }) + end) + end, +} diff --git a/lua/theprimeagen/lazy/dap.lua b/lua/theprimeagen/lazy/dap.lua new file mode 100644 index 00000000..ed7504ae --- /dev/null +++ b/lua/theprimeagen/lazy/dap.lua @@ -0,0 +1,184 @@ +vim.api.nvim_create_augroup("DapGroup", { clear = true }) + +local function navigate(args) + local buffer = args.buf + + local wid = nil + local win_ids = vim.api.nvim_list_wins() -- Get all window IDs + for _, win_id in ipairs(win_ids) do + local win_bufnr = vim.api.nvim_win_get_buf(win_id) + if win_bufnr == buffer then + wid = win_id + end + end + + if wid == nil then + return + end + + vim.schedule(function() + if vim.api.nvim_win_is_valid(wid) then + vim.api.nvim_set_current_win(wid) + end + end) +end + +local function create_nav_options(name) + return { + group = "DapGroup", + pattern = string.format("*%s*", name), + callback = navigate + } +end + +return { + { + "mfussenegger/nvim-dap", + lazy = false, + config = function() + local dap = require("dap") + dap.set_log_level("DEBUG") + + vim.keymap.set("n", "", dap.continue, { desc = "Debug: Continue" }) + vim.keymap.set("n", "", dap.step_over, { desc = "Debug: Step Over" }) + vim.keymap.set("n", "", dap.step_into, { desc = "Debug: Step Into" }) + vim.keymap.set("n", "", dap.step_out, { desc = "Debug: Step Out" }) + vim.keymap.set("n", "b", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" }) + vim.keymap.set("n", "B", function() + dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end, { desc = "Debug: Set Conditional Breakpoint" }) + end + }, + + + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + local function layout(name) + return { + elements = { + { id = name }, + }, + enter = true, + size = 40, + position = "right", + } + end + local name_to_layout = { + repl = { layout = layout("repl"), index = 0 }, + stacks = { layout = layout("stacks"), index = 0 }, + scopes = { layout = layout("scopes"), index = 0 }, + console = { layout = layout("console"), index = 0 }, + watches = { layout = layout("watches"), index = 0 }, + breakpoints = { layout = layout("breakpoints"), index = 0 }, + } + local layouts = {} + + for name, config in pairs(name_to_layout) do + table.insert(layouts, config.layout) + name_to_layout[name].index = #layouts + end + + local function toggle_debug_ui(name) + dapui.close() + local layout_config = name_to_layout[name] + + if layout_config == nil then + error(string.format("bad name: %s", name)) + end + + local uis = vim.api.nvim_list_uis()[1] + if uis ~= nil then + layout_config.size = uis.width + end + + pcall(dapui.toggle, layout_config.index) + end + + vim.keymap.set("n", "dr", function() toggle_debug_ui("repl") end, { desc = "Debug: toggle repl ui" }) + vim.keymap.set("n", "ds", function() toggle_debug_ui("stacks") end, + { desc = "Debug: toggle stacks ui" }) + vim.keymap.set("n", "dw", function() toggle_debug_ui("watches") end, + { desc = "Debug: toggle watches ui" }) + vim.keymap.set("n", "db", function() toggle_debug_ui("breakpoints") end, + { desc = "Debug: toggle breakpoints ui" }) + vim.keymap.set("n", "dS", function() toggle_debug_ui("scopes") end, + { desc = "Debug: toggle scopes ui" }) + vim.keymap.set("n", "dc", function() toggle_debug_ui("console") end, + { desc = "Debug: toggle console ui" }) + + vim.api.nvim_create_autocmd("BufEnter", { + group = "DapGroup", + pattern = "*dap-repl*", + callback = function() + vim.wo.wrap = true + end, + }) + + vim.api.nvim_create_autocmd("BufWinEnter", create_nav_options("dap-repl")) + vim.api.nvim_create_autocmd("BufWinEnter", create_nav_options("DAP Watches")) + + dapui.setup({ + layouts = layouts, + enter = true, + }) + + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + dap.listeners.after.event_output.dapui_config = function(_, body) + if body.category == "console" then + dapui.eval(body.output) -- Sends stdout/stderr to Console + end + end + end, + }, + + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = { + "williamboman/mason.nvim", + "mfussenegger/nvim-dap", + "neovim/nvim-lspconfig", + }, + config = function() + require("mason-nvim-dap").setup({ + ensure_installed = { + "delve", + }, + automatic_installation = true, + handlers = { + function(config) + require("mason-nvim-dap").default_setup(config) + end, + delve = function(config) + table.insert(config.configurations, 1, { + args = function() return vim.split(vim.fn.input("args> "), " ") end, + type = "delve", + name = "file", + request = "launch", + program = "${file}", + outputMode = "remote", + }) + table.insert(config.configurations, 1, { + args = function() return vim.split(vim.fn.input("args> "), " ") end, + type = "delve", + name = "file args", + request = "launch", + program = "${file}", + outputMode = "remote", + }) + require("mason-nvim-dap").default_setup(config) + end, + }, + }) + end, + }, +} diff --git a/lua/theprimeagen/lazy/fugitive.lua b/lua/theprimeagen/lazy/fugitive.lua new file mode 100644 index 00000000..17399327 --- /dev/null +++ b/lua/theprimeagen/lazy/fugitive.lua @@ -0,0 +1,38 @@ +return { + "tpope/vim-fugitive", + config = function() + vim.keymap.set("n", "gs", vim.cmd.Git) + + local ThePrimeagen_Fugitive = vim.api.nvim_create_augroup("ThePrimeagen_Fugitive", {}) + + local autocmd = vim.api.nvim_create_autocmd + autocmd("BufWinEnter", { + group = ThePrimeagen_Fugitive, + pattern = "*", + callback = function() + if vim.bo.ft ~= "fugitive" then + return + end + + local bufnr = vim.api.nvim_get_current_buf() + local opts = {buffer = bufnr, remap = false} + vim.keymap.set("n", "p", function() + vim.cmd.Git('push') + end, opts) + + -- rebase always + vim.keymap.set("n", "P", function() + vim.cmd.Git({'pull', '--rebase'}) + end, opts) + + -- NOTE: It allows me to easily set the branch i am pushing and any tracking + -- needed if i did not set the branch up correctly + vim.keymap.set("n", "t", ":Git push -u origin ", opts); + end, + }) + + + vim.keymap.set("n", "gu", "diffget //2") + vim.keymap.set("n", "gh", "diffget //3") + end +} diff --git a/lua/theprimeagen/lazy/golf.lua b/lua/theprimeagen/lazy/golf.lua new file mode 100644 index 00000000..39ea8b8e --- /dev/null +++ b/lua/theprimeagen/lazy/golf.lua @@ -0,0 +1,3 @@ +return { + { "vuciv/golf" }, +} diff --git a/lua/theprimeagen/lazy/init.lua b/lua/theprimeagen/lazy/init.lua new file mode 100644 index 00000000..77c21588 --- /dev/null +++ b/lua/theprimeagen/lazy/init.lua @@ -0,0 +1,10 @@ +return { + + { + "nvim-lua/plenary.nvim", + name = "plenary" + }, + + "eandrju/cellular-automaton.nvim", +} + diff --git a/lua/theprimeagen/lazy/jai.lua b/lua/theprimeagen/lazy/jai.lua new file mode 100644 index 00000000..58cab1f3 --- /dev/null +++ b/lua/theprimeagen/lazy/jai.lua @@ -0,0 +1,4 @@ +return { + "rluba/jai.vim", +} + diff --git a/lua/theprimeagen/lazy/local.lua b/lua/theprimeagen/lazy/local.lua new file mode 100644 index 00000000..00b0da41 --- /dev/null +++ b/lua/theprimeagen/lazy/local.lua @@ -0,0 +1,127 @@ +local local_plugins = { + --{ + -- "vim-guys", + -- dir = "~/personal/vim-guys", + -- config = function() + -- end, + --}, + --{ + -- "cockpit", + -- dir = "~/personal/cockpit", + -- config = function() + -- require("cockpit") + -- vim.keymap.set("n", "ct", "CockpitTest") + -- vim.keymap.set("n", "cr", "CockpitRefresh") + -- end, + --}, + + { + "the-stru", + dir = "~/personal/the-stru", + }, + { + "cursor_agent", + dir = "~/personal/cursor_in_neovim/", + dependencies = { "nvim-lua/plenary.nvim" }, -- optional, improves HTTP; falls back to curl if absent + config = function() + require("cursor_agent").setup({ + -- optional config + ui = { + width = 60, -- panel width in columns + input_height = 3, -- input box height + border = "rounded", + }, + provider = { + name = "openai", -- or "anthropic" + openai = { + model = "gpt-4o-mini", + }, + anthropic = { + model = "claude-3-5-sonnet-20240620", + version = "2023-06-01", + max_tokens = 1024, + }, + }, + }) + end, + }, + + { + "streamer", + dir = "~/personal/eleven-streamer", + config = function() + vim.keymap.set("n", "er", function() + require("streamer").reload() + end) + vim.keymap.set("n", "es", function() + require("streamer").twitch_dashboard() + end) + vim.keymap.set("n", "en", function() + require("streamer").twitch_dashboard():stop() + end) + end, + }, + + { + "caleb", + dir = "~/personal/caleb", + config = function() end, + }, + { + "harpoon", + dir = "~/personal/harpoon", + config = function() + local harpoon = require("harpoon") + + harpoon:setup() + + vim.keymap.set("n", "A", function() + harpoon:list():prepend() + end) + vim.keymap.set("n", "a", function() + harpoon:list():add() + end) + vim.keymap.set("n", "", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + + vim.keymap.set("n", "", function() + harpoon:list():select(1) + end) + vim.keymap.set("n", "", function() + harpoon:list():select(2) + end) + vim.keymap.set("n", "", function() + harpoon:list():select(3) + end) + vim.keymap.set("n", "", function() + harpoon:list():select(4) + end) + vim.keymap.set("n", "", function() + harpoon:list():replace_at(1) + end) + vim.keymap.set("n", "", function() + harpoon:list():replace_at(2) + end) + vim.keymap.set("n", "", function() + harpoon:list():replace_at(3) + end) + vim.keymap.set("n", "", function() + harpoon:list():replace_at(4) + end) + end, + }, + { + "vim-apm", + dir = "~/personal/vim_apm", + config = function() end, + }, + + { + "vim-with-me", + dir = "~/personal/vim-with-me", + config = function() end, + }, +} + +return local_plugins diff --git a/lua/theprimeagen/lazy/lsp.lua b/lua/theprimeagen/lazy/lsp.lua new file mode 100644 index 00000000..be38ce34 --- /dev/null +++ b/lua/theprimeagen/lazy/lsp.lua @@ -0,0 +1,137 @@ +local root_files = { + '.luarc.json', + '.luarc.jsonc', + '.luacheckrc', + '.stylua.toml', + 'stylua.toml', + 'selene.toml', + 'selene.yml', + '.git', +} + +return { + "neovim/nvim-lspconfig", + dependencies = { + "stevearc/conform.nvim", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + }, + + config = function() + require("conform").setup({ + formatters_by_ft = { + } + }) + local cmp = require('cmp') + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities()) + + require("fidget").setup({}) + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + "rust_analyzer", + "gopls", + "tailwindcss", + }, + handlers = { + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup { + capabilities = capabilities + } + end, + + zls = function() + local lspconfig = require("lspconfig") + lspconfig.zls.setup({ + root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), + settings = { + zls = { + enable_inlay_hints = true, + enable_snippets = true, + warn_style = true, + }, + }, + }) + vim.g.zig_fmt_parse_errors = 0 + vim.g.zig_fmt_autosave = 0 + + end, + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup { + capabilities = capabilities, + settings = { + Lua = { + format = { + enable = true, + -- Put format options here + -- NOTE: the value should be STRING!! + defaultConfig = { + indent_style = "space", + indent_size = "2", + } + }, + } + } + } + end, + ["tailwindcss"] = function() + local lspconfig = require("lspconfig") + lspconfig.tailwindcss.setup({ + capabilities = capabilities, + filetypes = { "html", "css", "scss", "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte", "heex" }, + }) + end, + } + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + }), + sources = cmp.config.sources({ + { name = "copilot", group_index = 2 }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) + }) + + vim.diagnostic.config({ + -- update_in_insert = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + }) + end +} diff --git a/lua/theprimeagen/lazy/neotest.lua b/lua/theprimeagen/lazy/neotest.lua new file mode 100644 index 00000000..20bb1c3c --- /dev/null +++ b/lua/theprimeagen/lazy/neotest.lua @@ -0,0 +1,55 @@ +return { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + "fredrikaverpil/neotest-golang", + "leoluz/nvim-dap-go", + }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-golang")({ + dap = { justMyCode = false }, + }), + }, + }) + + vim.keymap.set("n", "tr", function() + require("neotest").run.run({ + suite = false, + testify = true, + }) + end, { desc = "Debug: Running Nearest Test" }) + + vim.keymap.set("n", "tv", function() + require("neotest").summary.toggle() + end, { desc = "Debug: Summary Toggle" }) + + vim.keymap.set("n", "ts", function() + require("neotest").run.run({ + suite = true, + testify = true, + }) + end, { desc = "Debug: Running Test Suite" }) + + vim.keymap.set("n", "td", function() + require("neotest").run.run({ + suite = false, + testify = true, + strategy = "dap", + }) + end, { desc = "Debug: Debug Nearest Test" }) + + vim.keymap.set("n", "to", function() + require("neotest").output.open() + end, { desc = "Debug: Open test output" }) + + vim.keymap.set("n", "ta", function() + require("neotest").run.run(vim.fn.getcwd()) + end, { desc = "Debug: Open test output" }) + + end +} diff --git a/lua/theprimeagen/lazy/peek.lua b/lua/theprimeagen/lazy/peek.lua new file mode 100644 index 00000000..4742c4b2 --- /dev/null +++ b/lua/theprimeagen/lazy/peek.lua @@ -0,0 +1,14 @@ +return { + { + "toppair/peek.nvim", + event = { "VeryLazy" }, + build = "deno task --quiet build:fast", + config = function() + require("peek").setup({ + filetype = { 'markdown', 'conf' } + }) + vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) + vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) + end, + }, +} diff --git a/lua/theprimeagen/lazy/snippets.lua b/lua/theprimeagen/lazy/snippets.lua new file mode 100644 index 00000000..d416029c --- /dev/null +++ b/lua/theprimeagen/lazy/snippets.lua @@ -0,0 +1,30 @@ + +return { + { + "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", + + dependencies = { "rafamadriz/friendly-snippets" }, + + config = function() + local ls = require("luasnip") + ls.filetype_extend("javascript", { "jsdoc" }) + + --- TODO: What is expand? + vim.keymap.set({"i"}, "e", function() ls.expand() end, {silent = true}) + + vim.keymap.set({"i", "s"}, ";", function() ls.jump(1) end, {silent = true}) + vim.keymap.set({"i", "s"}, ",", function() ls.jump(-1) end, {silent = true}) + + vim.keymap.set({"i", "s"}, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end, {silent = true}) + end, + } +} + diff --git a/lua/theprimeagen/lazy/supermaven.lua b/lua/theprimeagen/lazy/supermaven.lua new file mode 100644 index 00000000..ee77f633 --- /dev/null +++ b/lua/theprimeagen/lazy/supermaven.lua @@ -0,0 +1,9 @@ +return { + { + "supermaven-inc/supermaven-nvim", + config = function() + require("supermaven-nvim").setup({}) + end, + }, +} + diff --git a/lua/theprimeagen/lazy/telescope.lua b/lua/theprimeagen/lazy/telescope.lua new file mode 100644 index 00000000..185e3533 --- /dev/null +++ b/lua/theprimeagen/lazy/telescope.lua @@ -0,0 +1,30 @@ +return { + "nvim-telescope/telescope.nvim", + + tag = "0.1.5", + + dependencies = { + "nvim-lua/plenary.nvim" + }, + + config = function() + require('telescope').setup({}) + + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'pf', builtin.find_files, {}) + vim.keymap.set('n', '', builtin.git_files, {}) + vim.keymap.set('n', 'pws', function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set('n', 'pWs', function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) + end) + vim.keymap.set('n', 'vh', builtin.help_tags, {}) + end +} + diff --git a/lua/theprimeagen/lazy/tj.lua b/lua/theprimeagen/lazy/tj.lua new file mode 100644 index 00000000..6ce56ef2 --- /dev/null +++ b/lua/theprimeagen/lazy/tj.lua @@ -0,0 +1,9 @@ +return { + "tjdevries/php.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter" + }, + config = function() + require("php").setup({}) + end +} diff --git a/lua/theprimeagen/lazy/treesitter.lua b/lua/theprimeagen/lazy/treesitter.lua new file mode 100644 index 00000000..d0f3f4ea --- /dev/null +++ b/lua/theprimeagen/lazy/treesitter.lua @@ -0,0 +1,86 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + config = function() + require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" + ensure_installed = { + "vimdoc", "javascript", "typescript", "c", "lua", "rust", + "jsdoc", "bash", "go", + }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally + auto_install = true, + + indent = { + enable = true + }, + + highlight = { + -- `false` will disable the whole extension + enable = true, + disable = function(lang, buf) + if lang == "html" then + print("disabled") + return true + end + + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + vim.notify( + "File larger than 100KB treesitter disabled for performance", + vim.log.levels.WARN, + {title = "Treesitter"} + ) + return true + end + end, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on "syntax" being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = { "markdown" }, + }, + }) + + local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs() + treesitter_parser_config.templ = { + install_info = { + url = "https://github.com/vrischmann/tree-sitter-templ.git", + files = {"src/parser.c", "src/scanner.c"}, + branch = "master", + }, + } + + vim.treesitter.language.register("templ", "templ") + end + }, + + { + "nvim-treesitter/nvim-treesitter-context", + after = "nvim-treesitter", + config = function() + require'treesitter-context'.setup{ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + multiwindow = false, -- Enable multiwindow support. + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + } + end + } +} diff --git a/lua/theprimeagen/lazy/trouble.lua b/lua/theprimeagen/lazy/trouble.lua new file mode 100644 index 00000000..fa0e7f66 --- /dev/null +++ b/lua/theprimeagen/lazy/trouble.lua @@ -0,0 +1,23 @@ +return { + { + "folke/trouble.nvim", + config = function() + require("trouble").setup({ + icons = false, + }) + + vim.keymap.set("n", "tt", function() + require("trouble").toggle() + end) + + vim.keymap.set("n", "[t", function() + require("trouble").next({skip_groups = true, jump = true}); + end) + + vim.keymap.set("n", "]t", function() + require("trouble").previous({skip_groups = true, jump = true}); + end) + + end + }, +} diff --git a/lua/theprimeagen/lazy/undotree.lua b/lua/theprimeagen/lazy/undotree.lua new file mode 100644 index 00000000..f76ae051 --- /dev/null +++ b/lua/theprimeagen/lazy/undotree.lua @@ -0,0 +1,9 @@ + +return { + "mbbill/undotree", + + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end +} + diff --git a/lua/theprimeagen/lazy/vimbegood.lua b/lua/theprimeagen/lazy/vimbegood.lua new file mode 100644 index 00000000..8338dd51 --- /dev/null +++ b/lua/theprimeagen/lazy/vimbegood.lua @@ -0,0 +1,12 @@ +return { + "theprimeagen/vim-be-good", + + dependencies = { + "nvim-lua/plenary.nvim" + }, + + config = function() + end +} + + diff --git a/lua/theprimeagen/lazy/zenmode.lua b/lua/theprimeagen/lazy/zenmode.lua new file mode 100644 index 00000000..3b207072 --- /dev/null +++ b/lua/theprimeagen/lazy/zenmode.lua @@ -0,0 +1,37 @@ + +return { + "folke/zen-mode.nvim", + config = function() + vim.keymap.set("n", "zz", function() + require("zen-mode").setup { + window = { + width = 90, + options = { } + }, + } + require("zen-mode").toggle() + vim.wo.wrap = false + vim.wo.number = true + vim.wo.rnu = true + ColorMyPencils() + end) + + + vim.keymap.set("n", "zZ", function() + require("zen-mode").setup { + window = { + width = 80, + options = { } + }, + } + require("zen-mode").toggle() + vim.wo.wrap = false + vim.wo.number = false + vim.wo.rnu = false + vim.opt.colorcolumn = "0" + ColorMyPencils() + end) + end +} + + diff --git a/lua/theprimeagen/lazy_init.lua b/lua/theprimeagen/lazy_init.lua new file mode 100644 index 00000000..1c50d529 --- /dev/null +++ b/lua/theprimeagen/lazy_init.lua @@ -0,0 +1,17 @@ +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({ + spec = "theprimeagen.lazy", + change_detection = { notify = false } +}) diff --git a/lua/theprimeagen/packer.lua b/lua/theprimeagen/packer.lua deleted file mode 100644 index 96f7c6e1..00000000 --- a/lua/theprimeagen/packer.lua +++ /dev/null @@ -1,78 +0,0 @@ --- This file can be loaded by calling `lua require('plugins')` from your init.vim - --- Only required if you have packer configured as `opt` -vim.cmd.packadd('packer.nvim') - -return require('packer').startup(function(use) - -- Packer can manage itself - use 'wbthomason/packer.nvim' - - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.0', - -- or , branch = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } - } - - use({ - 'rose-pine/neovim', - as = 'rose-pine', - config = function() - vim.cmd('colorscheme rose-pine') - end - }) - - use({ - "folke/trouble.nvim", - config = function() - require("trouble").setup { - icons = false, - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } - end - }) - - use { - 'nvim-treesitter/nvim-treesitter', - run = function() - local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) - ts_update() - end,} - use("nvim-treesitter/playground") - use("theprimeagen/harpoon") - use("theprimeagen/refactoring.nvim") - use("mbbill/undotree") - use("tpope/vim-fugitive") - use("nvim-treesitter/nvim-treesitter-context"); - - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v1.x', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, - - -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, - - -- Snippets - {'L3MON4D3/LuaSnip'}, - {'rafamadriz/friendly-snippets'}, - } - } - - use("folke/zen-mode.nvim") - use("github/copilot.vim") - use("eandrju/cellular-automaton.nvim") - use("laytan/cloak.nvim") - -end) - diff --git a/lua/theprimeagen/remap.lua b/lua/theprimeagen/remap.lua index e165d1ab..ea82b5cf 100644 --- a/lua/theprimeagen/remap.lua +++ b/lua/theprimeagen/remap.lua @@ -1,15 +1,18 @@ - vim.g.mapleader = " " vim.keymap.set("n", "pv", vim.cmd.Ex) vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") +vim.api.nvim_set_keymap("n", "tf", "PlenaryTestFile", { noremap = false, silent = false }) + vim.keymap.set("n", "J", "mzJ`z") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") +vim.keymap.set("n", "=ap", "ma=ap'a") +vim.keymap.set("n", "zig", "LspRestart") vim.keymap.set("n", "vwm", function() require("vim-with-me").StartVimWithMe() @@ -22,17 +25,18 @@ end) vim.keymap.set("x", "p", [["_dP]]) -- next greatest remap ever : asbjornHaland -vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set({ "n", "v" }, "y", [["+y]]) vim.keymap.set("n", "Y", [["+Y]]) -vim.keymap.set({"n", "v"}, "d", [["_d]]) +vim.keymap.set({ "n", "v" }, "d", "\"_d") -- This is going to get me cancelled vim.keymap.set("i", "", "") vim.keymap.set("n", "Q", "") vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") -vim.keymap.set("n", "f", vim.lsp.buf.format) +vim.keymap.set("n", "", "silent !tmux-sessionizer -s 0 --vsplit") +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer -s 0") vim.keymap.set("n", "", "cnextzz") vim.keymap.set("n", "", "cprevzz") @@ -42,8 +46,33 @@ vim.keymap.set("n", "j", "lprevzz") vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) -vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua"); -vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain"); +vim.keymap.set( + "n", + "ee", + "oif err != nil {}Oreturn err" +) + +vim.keymap.set( + "n", + "ea", + "oassert.NoError(err, \"\")F\";a" +) + +vim.keymap.set( + "n", + "ef", + "oif err != nil {}Olog.Fatalf(\"error: %s\\n\", err.Error())jj" +) + +vim.keymap.set( + "n", + "el", + "oif err != nil {}O.logger.Error(\"error\", \"error\", err)F.;i" +) + +vim.keymap.set("n", "ca", function() + require("cellular-automaton").start_animation("make_it_rain") +end) vim.keymap.set("n", "", function() vim.cmd("so") diff --git a/lua/theprimeagen/set.lua b/lua/theprimeagen/set.lua index 18acbf18..2c9ad6e0 100644 --- a/lua/theprimeagen/set.lua +++ b/lua/theprimeagen/set.lua @@ -29,4 +29,3 @@ vim.opt.isfname:append("@-@") vim.opt.updatetime = 50 vim.opt.colorcolumn = "80" - diff --git a/lua/theprimeagen/unused_copilot.lua b/lua/theprimeagen/unused_copilot.lua new file mode 100644 index 00000000..df12d4da --- /dev/null +++ b/lua/theprimeagen/unused_copilot.lua @@ -0,0 +1,12 @@ +--[[ +return { + "copilotlsp-nvim/copilot-lsp", + init = function() + vim.g.copilot_nes_debounce = 500 + vim.lsp.enable("copilot") + vim.keymap.set("n", "", function() + require("copilot-lsp.nes").apply_pending_nes() + end) + end, +} +--]] diff --git a/test.lua b/test.lua new file mode 100644 index 00000000..7813a785 --- /dev/null +++ b/test.lua @@ -0,0 +1,6 @@ +local api = vim.api +local buf = api.nvim_create_buf(false, true) +local win = vim.api.nvim_open_win(buf, true, + {relative='win', row=3, col=3, width=12, height=3}) + +