diff --git a/lazy-lock.json b/lazy-lock.json index e9bcf076..55fb5852 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,35 +1,39 @@ { - "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, - "cellular-automaton.nvim": { "branch": "main", "commit": "b7d056dab963b5d3f2c560d92937cb51db61cb5b" }, - "cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "brightburn.vim": { "branch": "master", "commit": "fc0d2fafc51e86d6065acd54b5e82e686019ff2f" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" }, + "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "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 + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gruvbox": { "branch": "main", "commit": "68c3460a5d1d1a362318960035c9f3466d5011f5" }, + "harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" }, + "lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, + "nvim-lspconfig": { "branch": "master", "commit": "f98fa715acc975c2dd5fb5ba7ceddeb1cc725ad2" }, + "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, + "nvim-tree.lua": { "branch": "master", "commit": "d05881f65f0a653db8d830ccc4d2e07d6a720628" }, + "nvim-treesitter": { "branch": "master", "commit": "4988b7068001b3a772c7cc738708341e612e3c26" }, + "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, + "plenary": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "rose-pine": { "branch": "main", "commit": "42f0724e0bca9f57f0bcfa688787c37b8d4befe8" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "tokyonight.nvim": { "branch": "main", "commit": "dca4adba7dc5f09302a00b0e76078d54d82d2658" }, + "trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" }, + "undotree": { "branch": "master", "commit": "2556c6800b210b2096b55b66e74b4cc1d9ebbe4f" }, + "vim-be-good": { "branch": "master", "commit": "0ae3de14eb8efc6effe7704b5e46495e91931cc5" }, + "vim-fugitive": { "branch": "master", "commit": "d74a7cff4cfcf84f83cc7eccfa365488f3bbabc2" }, + "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } +} diff --git a/lua/theprimeagen/init.lua b/lua/theprimeagen/init.lua index 02b01bca..946908f4 100644 --- a/lua/theprimeagen/init.lua +++ b/lua/theprimeagen/init.lua @@ -50,13 +50,23 @@ autocmd('BufEnter', { group = ThePrimeagenGroup, callback = function() if vim.bo.filetype == "zig" then - vim.cmd.colorscheme("tokyonight-night") + -- vim.cmd.colorscheme("tokyonight-night") else - vim.cmd.colorscheme("rose-pine-moon") + -- vim.cmd.colorscheme("rose-pine-moon") end end }) +autocmd("BufWritePost", { + callback = function() + -- local file_name = vim.fn.expand("%:p") -- Get the full file path + -- vim.notify("File saved: " .. file_name, "info", { + -- title = "File Save Notification", + -- timeout = 2000, -- Optional: Override default timeout + -- }) + end, +}) + autocmd('LspAttach', { group = ThePrimeagenGroup, @@ -75,6 +85,205 @@ autocmd('LspAttach', { end }) + +vim.api.nvim_create_autocmd("CursorHold", { + callback = function() + vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" }) + end, +}) + + vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 vim.g.netrw_winsize = 25 + +vim.opt.runtimepath:append("/mnt/c/repos/SandboxDotJs") + +local file_map = { + Foo = "/mnt/c/repos/SandboxDotJs/FrontEndMasters/test.txt", + Bar = "/path/to/bar.txt", + Baz = "/path/to/baz.lua", +} + +vim.api.nvim_create_user_command( + 'DocTree', + function(opts) + print("Argument: " .. opts.args) + if opts.args then + -- after confirmed argument, check table for reference + vim.cmd("edit /mnt/c/repos/SandboxDotJs/master-index.txt") + end + end, + { nargs = 1 } +) + + + +local function jump_to_file() + print("jump_to_file executed") + local word = vim.fn.expand("") -- Get the word under the cursor + local filepath = file_map[word] + + if filepath then + print("Opening file: " .. filepath) + vim.cmd("edit " .. filepath) -- Open the file + else + print("No file mapped for: " .. word) + end +end + +-- Use vim.keymap.set for simplicity +vim.keymap.set("n", "gf", jump_to_file, { noremap = true, silent = true }) + +-- Define the highlight group +vim.api.nvim_set_hl(0, "HighlightFoo", { fg = "#00FF00" }) -- Green color + +-- Create the autocommand group +vim.api.nvim_create_augroup("HighlightFoo", { clear = true }) + +-- Add autocommands for *.txt files +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = "HighlightFoo", + pattern = "*.txt", + callback = function() + vim.cmd("syntax match FooWord /\\/") + vim.cmd("highlight link FooWord HighlightFoo") + end, +}) + + +vim.keymap.set("t", "", "") + +local state = { + floating = { + buf = -1, + win = -1, + } +} + +local function create_floating_window(opts) + opts = opts or {} + local width = opts.width or math.floor(vim.o.columns * 0.8) + local height = opts.height or math.floor(vim.o.lines * 0.8) + + -- Calculate the position to center the window + local col = math.floor((vim.o.columns - width) / 2) + local row = math.floor((vim.o.lines - height) / 2) + + -- Create a buffer + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer + end + + -- Define window configuration + local win_config = { + relative = "editor", + width = width, + height = height, + col = col, + row = row, + style = "minimal", -- No borders or extra UI elements + border = "rounded", + } + + -- Create the floating window + local win = vim.api.nvim_open_win(buf, true, win_config) + + return { buf = buf, win = win } +end + +local toggle_terminal = function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = create_floating_window { buf = state.floating.buf } + if vim.bo[state.floating.buf].buftype ~= "terminal" then + vim.cmd.terminal() + end + else + vim.api.nvim_win_hide(state.floating.win) + end +end + +-- Example usage: +-- Create a floating window with default dimensions +vim.api.nvim_create_user_command("Floaterminal", toggle_terminal, {}) + +local toggle_numbers = function() + vim.opt.relativenumber = false + vim.opt.number = true +end + +local toggle_numberszen = function() + vim.opt.relativenumber = false + vim.opt.number = false +end + +vim.keymap.set("n", "lz", toggle_numberszen, {}) + + + +vim.api.nvim_create_user_command("UseNumbers", toggle_numbers, {}) +vim.keymap.set("n", "ln", toggle_numbers, {}) + + +local toggle_relativenumbers = function() + vim.opt.relativenumber = true + vim.opt.number = false +end + +vim.keymap.set("n", "lr", toggle_relativenumbers, {}) + +vim.api.nvim_create_autocmd("TermOpen", { +-- group = vim.api.nvim_create_augroup("custom-term-open", { clear = true }), + callback = function() + vim.opt.number = false + vim.opt.relativenumber = false + end, +}) + +local job_id = 0 +vim.keymap.set("n", "to", function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd("J") + vim.api.nvim_win_set_height(0, 20) + + job_id = vim.bo.channel + + -- Send 'clear' command and press Enter in the terminal + vim.api.nvim_chan_send(job_id, "clear\n") +end) + +vim.keymap.set("n", "th", function() + local current_file_dir = vim.fn.expand('%:p:h') -- Get the directory of the current file + + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd("L") + + job_id = vim.bo.channel + + + -- Send 'clear' command and press Enter in the terminal + vim.api.nvim_chan_send(job_id, "clear; cd ".. current_file_dir..";fmtz;cargo run;\n") + vim.cmd('setlocal modifiable') + vim.api.nvim_feedkeys('i', 'n', false) + +end) + +vim.keymap.set("n", "tf", ":Floaterminal") + +local current_command = "" +vim.keymap.set("n", "te", function() + current_command = vim.fn.input("Command: ") +end) + +vim.keymap.set("n", "tr", function() + if current_command == "" then + current_command = vim.fn.input("Command: ") + end + + vim.fn.chansend(job_id, { current_command .. "\r\n" }) +end) diff --git a/lua/theprimeagen/lazy/alpha.lua b/lua/theprimeagen/lazy/alpha.lua new file mode 100644 index 00000000..b3ad8fbb --- /dev/null +++ b/lua/theprimeagen/lazy/alpha.lua @@ -0,0 +1,106 @@ +-- Lazy plugin setup for alpha-nvim +return { + "goolord/alpha-nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + + vim.cmd [[ + highlight AlphaHeader guifg=#FF5733 ctermfg=Red + highlight AlphaHeaderYellow guifg=#FFFF00 ctermfg=Yellow + ]] + -- vim.cmd [[ + -- highlight AlphaHeader guifg=#FF0000 ctermfg=Red + -- ]] + + -- DOOM ASCII art + local doom_ascii = { + "================= =============== =============== ======== ========", + "\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //", + "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . \\/ . . .||", + "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", + "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", + "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . .||", + "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|_ |. . ||", + "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| .||", + "||_-' || .|/ || || \\ |. || `-_|| ||_-' || .|/ || || |\\ / |-_.||", + "|| ||_-' || || `-_|| || || ||_-' || || |\\ / | `||", + "|| `' || || `' || || `' || || |\\ / | ||", + "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", + "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", + "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", + "|| .==' _-' '-__\\._-' '-_./__-' `' |. /| | ||", + "||.==' _-' `' | /==.||", + "==' _-' N E O V I M \\/ `==", + "\\ _-' `-_ /", + " ", + } + + dashboard.section.header.val = doom_ascii + + dashboard.section.header.opts.hl = "AlphaHeader" + -- Footer + dashboard.section.footer.val = "🔥 Welcome to DOOM 🔥" + + -- Buttons + dashboard.section.buttons.val = { + dashboard.button("e", "📄 New File", ":ene startinsert "), + dashboard.button("f", "🔍 Find File", ":Telescope find_files "), + dashboard.button("q", "❌ Quit Neovim", ":qa"), + } + + -- Simulating flames + -- local flame_colors = { "red", "orange", "yellow" } + -- local flame_timer = vim.loop.new_timer() + + -- flame_timer:start(0, 500, vim.schedule_wrap(function() + -- Randomly pick flame colors + -- local random_color = flame_colors[math.random(#flame_colors)] + -- vim.api.nvim_set_hl(0, "AlphaHeader", { fg = random_color }) + + -- Redraw + -- vim.cmd("redraw") + -- end)) + + -- Setup alpha with the dashboard + alpha.setup(dashboard.config) + vim.defer_fn(function() + -- Change the highlight group to yellow + -- dashboard.section.header.val = "|| || " + + -- Refresh the Alpha dashboard to apply the new highlight + alpha.redraw() + end, 5000) -- 5000ms = 5 seconds + -- Clean up timer on exit + -- vim.api.nvim_create_autocmd("VimLeavePre", { + -- callback = function() + -- flame_timer:stop() + -- flame_timer:close() + -- end, + -- }) + -- Timer to alternate colors + local timer = vim.loop.new_timer() + local toggle = true -- State toggle + + timer:start(0, 1500, vim.schedule_wrap(function() + if toggle then + -- Switch to yellow + vim.cmd [[ highlight AlphaHeaderRed guifg=#FFFF00 ctermfg=Yellow ]] + dashboard.section.header.opts.hl = "AlphaHeaderRed" + else + -- Switch back to red + vim.cmd [[ highlight AlphaHeaderRed guifg=#FF5733 ctermfg=Red ]] + dashboard.section.header.opts.hl = "AlphaHeaderRed" + end + + -- Toggle the state + toggle = not toggle + + -- Redraw the dashboard to apply changes + alpha.redraw() + end)) + + end, +} + diff --git a/lua/theprimeagen/lazy/colors.lua b/lua/theprimeagen/lazy/colors.lua index c345f9df..1b45c23d 100644 --- a/lua/theprimeagen/lazy/colors.lua +++ b/lua/theprimeagen/lazy/colors.lua @@ -1,11 +1,21 @@ function ColorMyPencils(color) + -- print("color my pencils called ".. os.date("%m%d%Y")) color = color or "rose-pine-moon" - vim.cmd.colorscheme(color) + vim.cmd.colorscheme(color) - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + --vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + --vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + + vim.api.nvim_set_hl(0, "HighlightFoo", { fg = "#00FF00" }) end +vim.api.nvim_create_autocmd("ColorScheme", { + group = vim.api.nvim_create_augroup("HighlightFix", { clear = true }), + callback = function() + vim.api.nvim_set_hl(0, "HighlightFoo", { fg = "#00FF00" }) -- Green color for Foo + end, +}) + return { { diff --git a/lua/theprimeagen/lazy/comment.lua b/lua/theprimeagen/lazy/comment.lua new file mode 100644 index 00000000..6712af98 --- /dev/null +++ b/lua/theprimeagen/lazy/comment.lua @@ -0,0 +1,6 @@ +return { + 'numToStr/Comment.nvim', + config = function() + require('Comment').setup() + end +} diff --git a/lua/theprimeagen/lazy/harpoon.lua b/lua/theprimeagen/lazy/harpoon.lua new file mode 100644 index 00000000..1673e26f --- /dev/null +++ b/lua/theprimeagen/lazy/harpoon.lua @@ -0,0 +1,31 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require("harpoon") + + -- REQUIRED + harpoon:setup() + -- REQUIRED + + -- Add file to Harpoon list + vim.keymap.set("n", "a", function() harpoon:list():add() end) + + -- Toggle quick menu + vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + + -- Navigate to specific files + 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():select(5) end) + vim.keymap.set("n", "", function() harpoon:list():select(6) end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set("n", "", function() harpoon:list():prev() end) + vim.keymap.set("n", "", function() harpoon:list():next() end) + end, +} + diff --git a/lua/theprimeagen/lazy/local.lua b/lua/theprimeagen/lazy/local.lua deleted file mode 100644 index 6cd8fce9..00000000 --- a/lua/theprimeagen/lazy/local.lua +++ /dev/null @@ -1,56 +0,0 @@ - -local local_plugins = { - { - "rfceez", - dir = "~/personal/rfceez", - config = function() - local rfc = require("rfceez") - rfc.setup() - vim.keymap.set("n", "ra", function() rfc.add() end) - vim.keymap.set("n", "rd", function() rfc.rm() end) - vim.keymap.set("n", "rs", function() rfc.show_notes() end) - vim.keymap.set("n", "[r", function() rfc.nav_next() end) - vim.keymap.set("n", "[[r", function() rfc.show_next() end) - 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() - --[[ - local apm = require("vim-apm") - - apm:setup({}) - vim.keymap.set("n", "apm", function() apm:toggle_monitor() end) - --]] - 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 index 859b3398..086bc043 100644 --- a/lua/theprimeagen/lazy/lsp.lua +++ b/lua/theprimeagen/lazy/lsp.lua @@ -71,7 +71,6 @@ return { }) local cmp_select = { behavior = cmp.SelectBehavior.Select } - cmp.setup({ snippet = { expand = function(args) @@ -81,8 +80,10 @@ return { 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(), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ select = false }), + }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, diff --git a/lua/theprimeagen/lazy/lualine.lua b/lua/theprimeagen/lazy/lualine.lua new file mode 100644 index 00000000..5eafd827 --- /dev/null +++ b/lua/theprimeagen/lazy/lualine.lua @@ -0,0 +1,34 @@ +return { +'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup({ + options = { + theme = 'iceberg_dark', -- Choose a theme + icons_enabled = true, + section_separators = '', + component_separators = '' + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch'}, + lualine_c = { + function() + local filepath = vim.fn.expand('%:p') + if filepath == '' then + return '[No Name]' + end + local parts = vim.split(filepath, '/') + local len = #parts + if len < 3 then + return filepath + end + return table.concat(parts, '/', len - 2, len) + end + }, + lualine_x = {'diagnostics','encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + } + }) + end} diff --git a/lua/theprimeagen/lazy/neotest.lua b/lua/theprimeagen/lazy/neotest.lua deleted file mode 100644 index 7557c0cd..00000000 --- a/lua/theprimeagen/lazy/neotest.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - { - "nvim-neotest/neotest", - dependencies = { - "nvim-lua/plenary.nvim", - "antoinemadec/FixCursorHold.nvim", - "nvim-treesitter/nvim-treesitter", - "marilari88/neotest-vitest", - "nvim-neotest/neotest-plenary", - }, - config = function() - local neotest = require("neotest") - neotest.setup({ - adapters = { - require("neotest-vitest"), - require("neotest-plenary").setup({ - -- this is my standard location for minimal vim rc - -- in all my projects - min_init = "./scripts/tests/minimal.vim", - }), - } - }) - - vim.keymap.set("n", "tc", function() - neotest.run.run() - end) - end, - }, -} - diff --git a/lua/theprimeagen/lazy/notify.lua b/lua/theprimeagen/lazy/notify.lua new file mode 100644 index 00000000..700ed94f --- /dev/null +++ b/lua/theprimeagen/lazy/notify.lua @@ -0,0 +1,6 @@ +return { + "rcarriga/nvim-notify", + config = function() + vim.notify = require("notify") + end, +} diff --git a/lua/theprimeagen/lazy/nvim-tree.lua b/lua/theprimeagen/lazy/nvim-tree.lua new file mode 100644 index 00000000..832a1428 --- /dev/null +++ b/lua/theprimeagen/lazy/nvim-tree.lua @@ -0,0 +1,57 @@ +return { + "nvim-tree/nvim-tree.lua", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + local nvimtree = require("nvim-tree") + + -- recommended settings from nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + nvimtree.setup({ + view = { + width = 35, + relativenumber = true, + }, + -- change folder arrow icons + renderer = { + indent_markers = { + enable = true, + }, + icons = { + glyphs = { + folder = { + arrow_closed = "", -- arrow when folder is closed + arrow_open = "", -- arrow when folder is open + }, + }, + }, + }, + -- disable window_picker for + -- explorer to work well with + -- window splits + actions = { + open_file = { + window_picker = { + enable = false, + }, + }, + }, + filters = { + custom = { ".DS_Store" }, + }, + git = { + ignore = false, + }, + }) + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "ee", "NvimTreeToggle", { desc = "Toggle file explorer" }) -- toggle file explorer + keymap.set("n", "ef", "NvimTreeFindFileToggle", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file + keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) -- collapse file explorer + keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) -- refresh file explorer + keymap.set("n", "ez", "NvimTreeFocus", { desc = "Focus File tree" }) + end +} diff --git a/lua/theprimeagen/lazy/telescope.lua b/lua/theprimeagen/lazy/telescope.lua index 185e3533..24bdd44a 100644 --- a/lua/theprimeagen/lazy/telescope.lua +++ b/lua/theprimeagen/lazy/telescope.lua @@ -1,15 +1,40 @@ return { "nvim-telescope/telescope.nvim", - - tag = "0.1.5", - + branch = "0.1.x", dependencies = { - "nvim-lua/plenary.nvim" + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release" }, + "nvim-tree/nvim-web-devicons", + "folke/todo-comments.nvim", }, - config = function() - require('telescope').setup({}) + local telescope = require("telescope") + local actions = require("telescope.actions") + local transform_mod = require("telescope.actions.mt").transform_mod + + local trouble = require("trouble") + local trouble_telescope = require("trouble.sources.telescope") + + -- or create your custom action + local custom_actions = transform_mod({ + open_trouble_qflist = function(prompt_bufnr) + trouble.toggle("quickfix") + end, + }) + telescope.setup({ + defaults = { + path_display = { "smart" }, + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, + [""] = trouble_telescope.open, + }, + }, + }, + }) local builtin = require('telescope.builtin') vim.keymap.set('n', 'pf', builtin.find_files, {}) vim.keymap.set('n', '', builtin.git_files, {}) @@ -17,14 +42,15 @@ return { 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, {}) + + + vim.keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) + vim.keymap.set("n", "fr", "Telescope oldfiles", { desc = "Fuzzy find recent files" }) + vim.keymap.set("n", "fs", "Telescope live_grep", { desc = "Find string in cwd" }) + vim.keymap.set("n", "fc", "Telescope grep_string", { desc = "Find string under cursor in cwd" }) end } - diff --git a/lua/theprimeagen/lazy/treesitter.lua b/lua/theprimeagen/lazy/treesitter.lua index 7fa29176..324272bd 100644 --- a/lua/theprimeagen/lazy/treesitter.lua +++ b/lua/theprimeagen/lazy/treesitter.lua @@ -6,7 +6,7 @@ return { -- A list of parser names, or "all" ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust", - "jsdoc", "bash", + "jsdoc", "bash","go" }, -- Install parsers synchronously (only applied to `ensure_installed`) diff --git a/lua/theprimeagen/notes.txt b/lua/theprimeagen/notes.txt new file mode 100644 index 00000000..5b290973 --- /dev/null +++ b/lua/theprimeagen/notes.txt @@ -0,0 +1,30 @@ +Todos - List of things I want to do with my neovim environment +-------------------------------------------------------------- +1. Create plugin for quick notes + - open floating terminal + - focus, insert mode + - jot down a notes + - send to location + - create custom commands to send notes to custom pre set locations + +2. DocTree (too much for this list) + - MVP: create easily linkable and configurable text + + should spend some time researching telescope and treesitter + to see if + +** making a secondary note here to make sure you play around with Telescope a +bit more ** + +3. Remove Primeagen labels and make your own repo + - should be legal I think , I'm not selling it or anything + +4. Add background image for terminal + - make this configurable + +5. Research configuration best practices (managing environment variables) + +6. Make terminal colors/background/opacity more configurable + - can probably create a script to modify values in the settings.json file + - probably create themes and switch between those + +7. Add errors to lualine diff --git a/lua/theprimeagen/remap.lua b/lua/theprimeagen/remap.lua index b6916025..f2d82227 100644 --- a/lua/theprimeagen/remap.lua +++ b/lua/theprimeagen/remap.lua @@ -2,6 +2,7 @@ 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") @@ -19,6 +20,9 @@ vim.keymap.set("n", "svwm", function() require("vim-with-me").StopVimWithMe() end) +vim.keymap.set("n", "", ":w") + + -- greatest remap ever vim.keymap.set("x", "p", [["_dP]]) diff --git a/lua/theprimeagen/set.lua b/lua/theprimeagen/set.lua index 18acbf18..47266918 100644 --- a/lua/theprimeagen/set.lua +++ b/lua/theprimeagen/set.lua @@ -1,7 +1,6 @@ vim.opt.guicursor = "" -vim.opt.nu = true -vim.opt.relativenumber = true + vim.opt.tabstop = 4 vim.opt.softtabstop = 4 @@ -21,6 +20,7 @@ vim.opt.hlsearch = false vim.opt.incsearch = true vim.opt.termguicolors = true +vim.opt.background = "dark" vim.opt.scrolloff = 8 vim.opt.signcolumn = "yes" @@ -30,3 +30,10 @@ vim.opt.updatetime = 50 vim.opt.colorcolumn = "80" +vim.opt.textwidth = 80 +vim.opt.wrap = true +vim.opt.linebreak = true +vim.opt.colorcolumn = "81" + +vim.opt.clipboard:append("unnamedplus") +vim.cmd("let g:netrw_liststyle = 3") diff --git a/lua/theprimeagen/test.txt b/lua/theprimeagen/test.txt new file mode 100644 index 00000000..04626dfc --- /dev/null +++ b/lua/theprimeagen/test.txt @@ -0,0 +1 @@ +Foo Foo diff --git a/notes.txt b/notes.txt new file mode 100644 index 00000000..7cd30dfb --- /dev/null +++ b/notes.txt @@ -0,0 +1,11 @@ +Nvim Notes +---------- +Use this space for documenting specific commands / things I find noteworthy +about nvim + + +Questions +--------- + +- +