commit 24d5bcc0479b1d01f9262b2ea344e97adcddb1e4 Author: Joe bellus Date: Tue Dec 30 01:31:05 2025 -0600 initial commit diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..3292a2f --- /dev/null +++ b/init.lua @@ -0,0 +1,38 @@ +local config_path = vim.fn.stdpath("config") +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +local plugins = {} + +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +map = vim.keymap.set +function plugin(spec) + table.insert(plugins, spec) +end + +for _, file in ipairs(vim.fn.readdir(config_path .. "/lua", [[v:val =~ '\.lua$']])) do + require(file:gsub("%.lua$", "")) +end + +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) + +require("lazy").setup({ + spec = { + plugins, + }, + install = { colorscheme = { "habamax" } }, + checker = { enabled = true }, +}) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..b793097 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,30 @@ +{ + "CopilotChat.nvim": { "branch": "main", "commit": "df5376c132382dd47e3e552612940cbf25b3580c" }, + "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, + "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, + "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, + "conform.nvim": { "branch": "master", "commit": "ffe26e8df8115c9665d24231f8a49fadb2d611ce" }, + "copilot.lua": { "branch": "master", "commit": "881f99b827d65b41f522eecc21b112cf518028ac" }, + "elixir-tools.nvim": { "branch": "main", "commit": "b51b48edc668924a6b2f6610f9a0aff34741d20e" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "nvim-lspconfig": { "branch": "master", "commit": "f7c6e585fd80d5a2c075ab27ac312ac55bcf1550" }, + "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, + "obsidian.nvim": { "branch": "main", "commit": "4065c233f618cdbfbf084d87e97317f8d019ef59" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, + "ranger.nvim": { "branch": "main", "commit": "fd2cc999f3ef88f7cdcbcad5f26000c52b16c489" }, + "rustaceanvim": { "branch": "master", "commit": "6c3785d6a230bec63f70c98bf8e2842bed924245" }, + "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "38b06435305c30966b7ceb0a43e460dc43acaada" }, + "tmux-status.nvim": { "branch": "main", "commit": "d985ba67132269dedc9a5f6479f2d40f10e06315" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" }, + "vim-test": { "branch": "master", "commit": "1eeb12774a0f251571700ccf68da27789b2f0852" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/lua/_blink.lua b/lua/_blink.lua new file mode 100644 index 0000000..b9dd1cb --- /dev/null +++ b/lua/_blink.lua @@ -0,0 +1,45 @@ +plugin({ + "saghen/blink.cmp", + dependencies = { "rafamadriz/friendly-snippets" }, + version = "1.*", + opts = { + -- keymap = { preset = "super-tab" }, + keymap = { preset = "enter" }, + signature = { enabled = true }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = true } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "obsidian", "obsidian_new", "obsidian_tags", "lsp", "path", "snippets", "buffer", "copilot" }, + -- default = { "obsidian", "obsidian_new", "obsidian_tags", "lsp", "path", "snippets", "buffer" }, + providers = { + snippets = { + score_offset = 100, + }, + copilot = { + name = "copilot", + module = "blink-cmp-copilot", + score_offset = 50, + async = true, + }, + }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +}) diff --git a/lua/_copilot.lua b/lua/_copilot.lua new file mode 100644 index 0000000..f067d3f --- /dev/null +++ b/lua/_copilot.lua @@ -0,0 +1,46 @@ +plugin({ + lazy = false, + "CopilotC-Nvim/CopilotChat.nvim", + dependencies = { + { "zbirenbaum/copilot.lua" }, -- or zbirenbaum/copilot.lua + { "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions + }, + build = "make tiktoken", -- Only on MacOS or Linux + opts = { + -- See Configuration section for options + }, + -- See Commands section for default commands if you want to lazy load on them +}) +plugin({ + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + config = function() + require("copilot").setup({ + suggestion = { enabled = true }, + panel = { enabled = false }, + }) + end, +}) +plugin({ + "giuxtaposition/blink-cmp-copilot", + dependencies = { + { "zbirenbaum/copilot.lua" }, + }, +}) + +map("n", "ac", function() + require("CopilotChat").open() +end, { desc = "Copilot chat" }) + +map("n", "ap", function() + require("copilot.panel").open() +end, { desc = "Copilot chat" }) + +map("v", "ad", function() + require("CopilotChat").ask("Create documentation for this code") +end, { desc = "Copilot chat" }) + +map("v", "at", function() + require("CopilotChat").ask("#buffer:active Write tests for this code") +end, { desc = "Copilot chat" }) diff --git a/lua/_elixir.lua b/lua/_elixir.lua new file mode 100644 index 0000000..a6982b3 --- /dev/null +++ b/lua/_elixir.lua @@ -0,0 +1,36 @@ +plugin({ + "elixir-tools/elixir-tools.nvim", + version = "*", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local elixir = require("elixir") + local elixirls = require("elixir.elixirls") + + elixir.setup({ + -- nextls = { enable = true }, + elixirls = { + enable = true, + cmd = "elixir-ls", + settings = elixirls.settings({ + dialyzerEnabled = true, + enableTestLenses = true, + }), + on_attach = function(client, bufnr) + vim.keymap.set("n", "fp", ":ElixirFromPipe", { buffer = true, noremap = true }) + vim.keymap.set("n", "tp", ":ElixirToPipe", { buffer = true, noremap = true }) + vim.keymap.set("v", "em", ":ElixirExpandMacro", { buffer = true, noremap = true }) + end, + }, + projectionist = { + enable = true, + }, + }) + end, + dependencies = { + "nvim-lua/plenary.nvim", + }, +}) + +map("n", "cr", function() + vim.lsp.codelens.run() +end) diff --git a/lua/_lsp.lua b/lua/_lsp.lua new file mode 100644 index 0000000..2917544 --- /dev/null +++ b/lua/_lsp.lua @@ -0,0 +1,17 @@ +plugin({ + "neovim/nvim-lspconfig", + config = function() + -- lspconfig.nextls.setup({ + -- cmd = { "nextls" }, + -- }) + -- lspconfig.elixirls.setup({ + -- cmd = { "elixir-ls" }, + -- }) + -- lspconfig.lexical.setup({ + -- cmd = { "lexical" }, + -- }) + end, +}) + +-- vim.lsp.enable("lexical") +vim.lsp.enable("pyright") diff --git a/lua/_lualine.lua b/lua/_lualine.lua new file mode 100644 index 0000000..a582d5a --- /dev/null +++ b/lua/_lualine.lua @@ -0,0 +1,157 @@ +plugin({ + "nvim-lualine/lualine.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + "christopher-francisco/tmux-status.nvim", + }, + config = function() + -- Eviline config for lualine + -- Author: shadmansaleh + -- Credit: glepnir + local lualine = require("lualine") + + local colors = { + bg = "none", + fg = "#bbc2cf", + yellow = "#ECBE7B", + cyan = "#008080", + darkblue = "#081633", + green = "#98be65", + orange = "#FF8800", + violet = "#a9a1e1", + magenta = "#c678dd", + blue = "#51afef", + red = "#ec5f67", + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + local theme = require("lualine.themes.tokyonight") + theme.normal.c.bg = "None" + theme.inactive.c.bg = "None" + vim.cmd("hi StatusLine guibg=NONE ctermbg=NONE") + vim.cmd("hi StatusLineNC guibg=NONE ctermbg=NONE") + + -- Config + local config = { + options = { + -- Disable sections and component separators + component_separators = "", + section_separators = "", + theme = theme, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left({ + "filetype", + }) + + ins_left({ + -- filesize component + "filesize", + cond = conditions.buffer_not_empty, + }) + + ins_left({ "location" }) + + ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } }) + + ins_left({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " " }, + diagnostics_color = { + error = { fg = colors.red }, + warn = { fg = colors.yellow }, + info = { fg = colors.cyan }, + }, + }) + + ins_left({ + function() + return "%=" + end, + }) + + ins_left({ + "filename", + cond = conditions.buffer_not_empty, + path = 1, + color = { fg = colors.magenta, gui = "bold" }, + }) + + ins_right({ + "lsp_status", + }) + + ins_right({ + "branch", + icon = "", + color = { fg = colors.violet, gui = "bold" }, + }) + + ins_right({ + "diff", + -- Is it me or the symbol for modified us really weird + symbols = { added = " ", modified = "󰝤 ", removed = " " }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + }) + + ins_right({ + function() + return "▊" + end, + color = { fg = colors.blue }, + padding = { left = 1 }, + }) + + -- Now don't forget to initialize lualine + lualine.setup(config) + end, +}) diff --git a/lua/_obsidian.lua b/lua/_obsidian.lua new file mode 100644 index 0000000..c79555f --- /dev/null +++ b/lua/_obsidian.lua @@ -0,0 +1,104 @@ +vim.opt.conceallevel = 1 + +plugin({ + "obsidian-nvim/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = false, + ft = "markdown", + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" + -- -- refer to `:h file-pattern` for more examples + -- "BufReadPre path/to/my-vault/*.md", + -- "BufNewFile path/to/my-vault/*.md", + -- }, + dependencies = { + -- Required. + "nvim-lua/plenary.nvim", + + -- see below for full list of optional dependencies 👇 + }, + opts = { + legacy_commands = false, + workspaces = { + { + name = "personal", + path = "~/Documents/obsidian/Personal", + }, + { + name = "Quikserve", + path = "~/Documents/obsidian/Quikserve", + }, + { + name = "Visage", + path = "~/Documents/obsidian/Visage", + }, + }, + notes_subdir = "notes", + new_notes_location = "notes_subdir", + note_id_func = function(title) + -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. + -- In this case a note with the title 'My new note' will be given an ID that looks + -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'. + -- You may have as many periods in the note ID as you'd like—the ".md" will be added automatically + 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 + prefix = os.date("%Y%m%d%H%M") + return tostring(prefix .. "-" .. suffix) + end, + daily_notes = { + -- Optional, if you keep daily notes in a separate directory. + folder = "dailies", + -- Optional, if you want to change the date format for the ID of daily notes. + date_format = "%Y-%m-%d", + -- Optional, if you want to change the date format of the default alias of daily notes. + alias_format = "%B %-d, %Y", + -- Optional, default tags to add to each new daily note created. + default_tags = { "daily-notes" }, + -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' + template = "daily", + }, + templates = { + folder = "templates", + date_format = "%Y-%m-%d-%a", + time_format = "%H:%M", + }, + completion = { + blink = true, + }, + picker = { + -- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'. + name = "snacks.pick", + -- Optional, configure key mappings for the picker. These are the defaults. + -- Not all pickers support all mappings. + note_mappings = { + -- Create a new note from your query. + new = "", + -- Insert a link to the selected note. + insert_link = "", + }, + tag_mappings = { + -- Add tag(s) to current note. + tag_note = "", + -- Insert a tag at the current location. + insert_tag = "", + }, + }, + }, +}) + +map("n", "ot", ":Obsidian today", { desc = "Today Note" }) +map("n", "on", ":Obsidian new", { desc = "New Note" }) +map("n", "oN", ":Obsidian new_from_template", { desc = "New From Template" }) +map("n", "ow", ":Obsidian workspace", { desc = "Change Workspace" }) +map("n", "oo", "::Obsidian quick_switch", { desc = "Find Note" }) +map("n", "os", "!./sync.sh", { desc = "Sync" }) diff --git a/lua/_rust.lua b/lua/_rust.lua new file mode 100644 index 0000000..8139339 --- /dev/null +++ b/lua/_rust.lua @@ -0,0 +1,4 @@ +plugin({ + "mrcjkb/rustaceanvim", + lazy = false, -- This plugin is already lazy +}) diff --git a/lua/_snacks.lua b/lua/_snacks.lua new file mode 100644 index 0000000..e5ff454 --- /dev/null +++ b/lua/_snacks.lua @@ -0,0 +1,323 @@ +plugin({ + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + notifier = { + enabled = true, + timeout = 3000, + }, + picker = { enabled = true, ui_select = true }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { + enabled = true, + left = { "mark", "sign" }, -- priority of signs on the left (high to low) + right = { "fold", "git" }, -- priority of signs on the right (high to low) + folds = { + open = true, -- show open fold icons + git_hl = true, -- use Git Signs hl for fold icons + }, + git = { + -- patterns to match Git signs + patterns = { "GitSign", "MiniDiffSign" }, + }, + refresh = 50, -- refresh at most every 50ms + }, + words = { enabled = true }, + styles = { + notification = { + -- wo = { wrap = true } -- Wrap notifications + }, + }, + }, + keys = { + -- Top Pickers & Explorer + { + "", + function() + Snacks.picker.smart({ + multi = { "buffers", "recent", "files" }, + format = "file", -- use `file` format for all sources + matcher = { + cwd_bonus = true, -- boost cwd matches + frecency = true, -- use frecency boosting + sort_empty = true, -- sort even when the filter is empty + }, + transform = "unique_file", + }) + end, + desc = "Smart Find Files", + }, + { + ",", + function() + Snacks.picker.buffers() + end, + desc = "Buffers", + }, + { + "/", + function() + Snacks.picker.grep() + end, + desc = "Grep", + }, + { + "n", + function() + Snacks.picker.notifications() + end, + desc = "Notification History", + }, + { + "e", + function() + Snacks.picker.explorer({ + auto_close = true, + }) + end, + desc = "File Explorer", + }, + { + "ff", + function() + Snacks.picker.files() + end, + desc = "Find Files", + }, + { + "fp", + function() + Snacks.picker.projects() + end, + desc = "Projects", + }, + { + "fr", + function() + Snacks.picker.recent() + end, + desc = "Recent", + }, + -- Grep + { + "sb", + function() + Snacks.picker.lines() + end, + desc = "Buffer Lines", + }, + { + "bB", + function() + Snacks.picker.grep_buffers() + end, + desc = "Grep Open Buffers", + }, + { + "sg", + function() + Snacks.picker.grep() + end, + desc = "Grep", + }, + { + "sw", + function() + Snacks.picker.grep_word() + end, + desc = "Visual selection or word", + mode = { "n", "x" }, + }, + -- search + { + "s/", + function() + Snacks.picker.search_history() + end, + desc = "Search History", + }, + { + "sb", + function() + Snacks.picker.lines() + end, + desc = "Buffer Lines", + }, + { + "sc", + function() + Snacks.picker.commands() + end, + desc = "Commands", + }, + { + "sd", + function() + Snacks.picker.diagnostics() + end, + desc = "Diagnostics", + }, + { + "sD", + function() + Snacks.picker.diagnostics_buffer() + end, + desc = "Buffer Diagnostics", + }, + { + "si", + function() + Snacks.picker.icons() + end, + desc = "Icons", + }, + { + "uC", + function() + Snacks.picker.colorschemes() + end, + desc = "Colorschemes", + }, + -- LSP + { + "gd", + function() + Snacks.picker.lsp_definitions() + end, + desc = "Goto Definition", + }, + { + "gD", + function() + Snacks.picker.lsp_declarations() + end, + desc = "Goto Declaration", + }, + { + "gr", + function() + Snacks.picker.lsp_references() + end, + nowait = true, + desc = "References", + }, + { + "gI", + function() + Snacks.picker.lsp_implementations() + end, + desc = "Goto Implementation", + }, + { + "gy", + function() + Snacks.picker.lsp_type_definitions() + end, + desc = "Goto T[y]pe Definition", + }, + { + "ss", + function() + Snacks.picker.lsp_symbols() + end, + desc = "LSP Symbols", + }, + { + "sS", + function() + Snacks.picker.lsp_workspace_symbols() + end, + desc = "LSP Workspace Symbols", + }, + -- Other + { + "z", + function() + Snacks.zen() + end, + desc = "Toggle Zen Mode", + }, + { + ".", + function() + Snacks.scratch() + end, + desc = "Toggle Scratch Buffer", + }, + { + "S", + function() + Snacks.scratch.select() + end, + desc = "Select Scratch Buffer", + }, + { + "n", + function() + Snacks.notifier.show_history() + end, + desc = "Notification History", + }, + { + "cR", + function() + Snacks.rename.rename_file() + end, + desc = "Rename File", + }, + { + "gg", + function() + Snacks.lazygit() + end, + desc = "Lazygit", + }, + { + "un", + function() + Snacks.notifier.hide() + end, + desc = "Dismiss All Notifications", + }, + { + "", + function() + Snacks.terminal() + end, + desc = "Toggle Terminal", + }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + -- Setup some globals for debugging (lazy-loaded) + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + -- Create some toggle mappings + Snacks.toggle.option("spell", { name = "Spelling" }):map("ts") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.diagnostics():map("ud") + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") + Snacks.toggle.line_number():map("ul") + Snacks.toggle.inlay_hints():map("uh") + Snacks.toggle.dim():map("uD") + end, + }) + end, +}) diff --git a/lua/_treesitter.lua b/lua/_treesitter.lua new file mode 100644 index 0000000..41c7e8f --- /dev/null +++ b/lua/_treesitter.lua @@ -0,0 +1,26 @@ +plugin({ + "nvim-treesitter/nvim-treesitter", + branch = "master", + lazy = false, + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "elixir", + "eex", + "heex", + "json", + "javascript", + "css", + "scss", + "lua", + "rust", + "python", + "markdown", + "markdown_inline", + }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, +}) diff --git a/lua/aichat.lua b/lua/aichat.lua new file mode 100644 index 0000000..598991c --- /dev/null +++ b/lua/aichat.lua @@ -0,0 +1,11 @@ +map("n", "aa", function() + Snacks.input.input({ prompt = "Enter prompt" }, function(value) + if value ~= nil then + vim.cmd(":read !aichat -c " .. value .. " /nothink") + -- local output = vim.fn.system("!aichat -c " .. value .. " /nothink") + -- local lines = vim.split(output, "\n", { plain = true }) + -- local bufnr = target_bufnr or vim.api.nvim_get_current_buf() + -- vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) + end + end) +end) diff --git a/lua/clipboard.lua b/lua/clipboard.lua new file mode 100644 index 0000000..66948f1 --- /dev/null +++ b/lua/clipboard.lua @@ -0,0 +1,2 @@ +vim.api.nvim_set_option("clipboard", "unnamed") +vim.opt.clipboard = "unnamedplus" diff --git a/lua/editor.lua b/lua/editor.lua new file mode 100644 index 0000000..bebbdcf --- /dev/null +++ b/lua/editor.lua @@ -0,0 +1,128 @@ +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true + +vim.opt.number = true +vim.o.relativenumber = true +vim.o.numberwidth = 2 +vim.o.ruler = false + +vim.opt.autoindent = smartindent +vim.opt.syntax = enable + +vim.o.cursorline = true +vim.o.cursorlineopt = "number" +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.mouse = "a" + +vim.o.cmdheight = 0 +vim.opt.laststatus = 0 + +-- vim.opt.foldmethod = "expr" +-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.o.foldcolumn = "1" -- '0' is not bad +vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + +vim.opt.fillchars = { eob = " " } + +vim.o.undofile = true + +plugin({ + "folke/which-key.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +}) + +plugin({ + "lewis6991/gitsigns.nvim", +}) + +plugin({ + "tpope/vim-abolish", +}) + +plugin({ + { + "kevinhwang91/nvim-ufo", + dependencies = { + { "kevinhwang91/promise-async" }, + }, + config = function() + require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + return { "treesitter", "indent" } + end, + }) + end, + }, +}) + +plugin({ + "vim-test/vim-test", +}) + +map("n", "tt", ":TestNearest", { desc = "Test Nearest" }) + +plugin({ + "kelly-lin/ranger.nvim", + config = function() + require("ranger-nvim").setup({ replace_netrw = true }) + vim.api.nvim_set_keymap("n", "ff", "", { + noremap = true, + callback = function() + require("ranger-nvim").open(true) + end, + }) + end, +}) + +plugin({ + "rachartier/tiny-inline-diagnostic.nvim", + event = "VeryLazy", -- Or `LspAttach` + priority = 1000, -- needs to be loaded in first + config = function() + require("tiny-inline-diagnostic").setup() + vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics + end, +}) + +map("n", "x", function() + Snacks.bufdelete() +end, { desc = "Delete Buffer" }) +map("n", "", "noh", { desc = "general clear highlights" }) + +map("n", "dm", function() + local bufnr = vim.api.nvim_get_current_buf() + local cur_line = vim.fn.line(".") + ---@type { mark: string, pos: number[] }[] + local all_marks_local = vim.fn.getmarklist(bufnr) + for _, mark in ipairs(all_marks_local) do + if mark.pos[2] == cur_line and string.match(mark.mark, "'[a-z]") then + vim.notify("Deleting mark: " .. string.sub(mark.mark, 2, 2)) + vim.api.nvim_buf_del_mark(bufnr, string.sub(mark.mark, 2, 2)) + end + end + local bufname = vim.api.nvim_buf_get_name(bufnr) + ---@type { file: string, mark: string, pos: number[] }[] + local all_marks_global = vim.fn.getmarklist() + for _, mark in ipairs(all_marks_global) do + local expanded_file_name = vim.fn.fnamemodify(mark.file, ":p") + if bufname == expanded_file_name and mark.pos[2] == cur_line and string.match(mark.mark, "'[A-Z]") then + vim.notify("Deleting mark: " .. string.sub(mark.mark, 2, 2)) + vim.api.nvim_del_mark(string.sub(mark.mark, 2, 2)) + end + end +end, { desc = "delete marks" }) diff --git a/lua/file_handling.lua b/lua/file_handling.lua new file mode 100644 index 0000000..db16047 --- /dev/null +++ b/lua/file_handling.lua @@ -0,0 +1,3 @@ +map("n", "", "w", { desc = "general save file" }) +map("n", "/", "gcc", { desc = "toggle comment", remap = true }) +map("v", "/", "gc", { desc = "toggle comment", remap = true }) diff --git a/lua/format.lua b/lua/format.lua new file mode 100644 index 0000000..60081de --- /dev/null +++ b/lua/format.lua @@ -0,0 +1,23 @@ +plugin({ + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + elixir = { "mix" }, + javascript = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + html = { "prettier" }, + heex = { "mix" }, + nix = { "nixfmt" }, + json = { "prettier" }, + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 2000, + lsp_fallback = true, + }, + }, +}) diff --git a/lua/snippets.lua b/lua/snippets.lua new file mode 100644 index 0000000..f07859c --- /dev/null +++ b/lua/snippets.lua @@ -0,0 +1,7 @@ +plugin({ + "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", +}) diff --git a/lua/theme.lua b/lua/theme.lua new file mode 100644 index 0000000..ffeac21 --- /dev/null +++ b/lua/theme.lua @@ -0,0 +1,18 @@ +-- plugin({ +-- "catppuccin/nvim", +-- name = "catppuccin", +-- priority = 1000, +-- init = function() +-- vim.cmd.colorscheme("catppuccin-mocha") +-- end, +-- }) + +plugin({ + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + init = function() + vim.cmd([[colorscheme tokyonight-night]]) + end, +}) diff --git a/lua/tmux.lua b/lua/tmux.lua new file mode 100644 index 0000000..d63b32d --- /dev/null +++ b/lua/tmux.lua @@ -0,0 +1,16 @@ +plugin({ + "alexghergh/nvim-tmux-navigation", + config = function() + require("nvim-tmux-navigation").setup({ + disable_when_zoomed = true, -- defaults to false + keybindings = { + left = "", + down = "", + up = "", + right = "", + last_active = "", + next = "", + }, + }) + end, +}) diff --git a/snippets/global.json b/snippets/global.json new file mode 100644 index 0000000..ab1deb0 --- /dev/null +++ b/snippets/global.json @@ -0,0 +1,11 @@ +{ + "Basic": { "prefix": "ba", "body": "T1=$1 T2=$2 T0=$0" }, + "Placeholders": { "prefix": "pl", "body": "T1=${1:aa}\nT2=${2:<$1>}" }, + "Choices": { "prefix": "ch", "body": "T1=${1|a,b|} T2=${2|c,d|}" }, + "Linked": { "prefix": "li", "body": "T1=$1\n\tT1=$1" }, + "Variables": { "prefix": "va", "body": "Runtime: $VIMRUNTIME\n" }, + "Complex": { + "prefix": "co", + "body": [ "T1=${1:$RANDOM}", "T3=${3:$1_${2:$1}}", "T2=$2" ] + } +}