commit fd9cc9c38bdacff3a4607c1a57a0bdf0cb30b3e4 Author: lucy Date: Sun Mar 1 18:53:20 2026 +0100 add shit diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..b243cc8 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,6 @@ +{ + "diagnostics.globals": [ + "vim", + "Snacks" + ] +} \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..84b8d55 --- /dev/null +++ b/init.lua @@ -0,0 +1,4 @@ +require("config.options") +require("config.lazy") +require("config.keymaps") +vim.cmd.colorscheme("base16-catppuccin-mocha") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..495653d --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,16 @@ +{ + "base16-nvim": { "branch": "master", "commit": "80ce668de796d1564d875a3c31822b4db3ae1d91" }, + "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "conform.nvim": { "branch": "master", "commit": "e969e302bced7ffb9a0a0323629f31feb0ca35a6" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "nvim-lspconfig": { "branch": "master", "commit": "ead0f5f342d8d323441e7d4b88f0fc436a81ad5f" }, + "nvim-treesitter": { "branch": "main", "commit": "6bc51d020a5e06b7e20ea82dbc47196d3d3027c7" }, + "nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" }, + "snacks.nvim": { "branch": "main", "commit": "9912042fc8bca2209105526ac7534e9a0c2071b2" } +} diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..a5accae --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,35 @@ +local map = vim.keymap.set + +map("n", "ff", function() + Snacks.picker.files() +end) +map("n", "lg", function() + Snacks.picker.grep() +end) +map("n", "", function() + require("conform").format({ async = true, lsp_fallback = true }) +end) + +-- lsp keybinds +map("n", "K", " Lspsaga hover_doc") +map("n", "go", " Lspsaga goto_definition") +map("n", "gr", " Lspsaga finder") +map("n", "qf", " Lspsaga code_action") +-- bufferline keybinds +map("n", "", " BufferLineGoToBuffer 1 ") +map("n", "", " BufferLineGoToBuffer 2 ") +map("n", "", " BufferLineGoToBuffer 3 ") +map("n", "", " BufferLineGoToBuffer 4 ") +map("n", "", " BufferLineGoToBuffer 5 ") +map("n", "", " BufferLineGoToBuffer 6 ") +map("n", "", " BufferLineGoToBuffer 7 ") +map("n", "", " BufferLineGoToBuffer 8 ") +map("n", "", " BufferLineGoToBuffer 9 ") +map("n", "", " BufferLineGoToBuffer last ") +map("n", "w", " bdelete! ") + +-- util keybinds +map("n", "t", " terminal ") +map("n", "", "Lspsaga term_toggle") +map("t", "", "") +map("n", "", "NvimTreeToggle") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..9a1acd5 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,52 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +local opt = vim.opt +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" +opt.number = true +opt.relativenumber = true +opt.cursorline = true +opt.termguicolors = true +opt.winborder = "single" +opt.signcolumn = "yes" +vim.lsp.inlay_hint.enable = true +opt.tabstop = 8 +opt.shiftwidth = 8 +vim.diagnostic.config({ + virtual_text = { + spacing = 2, + source = true, + }, +}) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "base16-catppuccin-mocha" } }, + -- automatically check for plugin updates + checker = { enabled = true }, + change_detection = { notify = false }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..d5612a3 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,2 @@ +local opt = vim.opt + diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua new file mode 100644 index 0000000..f738dea --- /dev/null +++ b/lua/plugins/coding.lua @@ -0,0 +1,76 @@ +return { + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + jsonc = { "prettierd", "prettier", stop_after_first = true }, + c = { "clang-format" }, + cpp = { "clang-format" }, + sh = { "shfmt" }, + bash = { "shfmt" }, + }, + formatters = { + ["clang-format"] = { + prepend_args = { + "--style={BasedOnStyle: LLVM, BreakBeforeBraces: Allman, ColumnLimit: 300, IndentWidth: 8, UseTab: Never}", + }, + }, + }, + }, + }, + + { + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, + }, + + { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets", "neovim/nvim-lspconfig" }, + + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = "default" }, + + appearance = { + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, + }, +} diff --git a/lua/plugins/cord.lua b/lua/plugins/cord.lua new file mode 100644 index 0000000..fede7ac --- /dev/null +++ b/lua/plugins/cord.lua @@ -0,0 +1,11 @@ +return { + { + "vyfor/cord.nvim", + ---@type CordConfig + opts = { + display = { + theme = "atom", + } + }, + }, +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..b71395a --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,117 @@ +return { + { + "folke/snacks.nvim", + opts = { + dashboard = { + enabled = true, + width = 60, + row = nil, -- dashboard position. nil for center + col = nil, -- dashboard position. nil for center + pane_gap = 4, -- empty columns between vertical panes + autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -- autokey sequence + -- These settings are used by some built-in sections + preset = { + -- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick` + ---@type fun(cmd:string, opts:table)|nil + pick = nil, + -- Used by the `keys` section to show keymaps. + -- Set your custom keymaps here. + -- When using a function, the `items` argument are the default keymaps. + ---@type snacks.dashboard.Item[] + keys = { + { + icon = " ", + key = "f", + desc = "Find File", + action = ":lua Snacks.dashboard.pick('files')", + }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { + icon = " ", + key = "g", + desc = "Find Text", + action = ":lua Snacks.dashboard.pick('live_grep')", + }, + { + icon = " ", + key = "r", + desc = "Recent Files", + action = ":lua Snacks.dashboard.pick('oldfiles')", + }, + { + icon = " ", + key = "c", + desc = "Config", + action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})", + }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { + icon = "󰒲 ", + key = "L", + desc = "Lazy", + action = ":Lazy", + enabled = package.loaded.lazy ~= nil, + }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + -- Used by the `header` section + header = [[ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⣉⣙⣷⡦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢤⣴⠖⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣉⠛⠓⠶⢤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣽⡿⠟⠁⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠙⠛⠷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⡶⠶⠛⠉⠉⠉⠉⠁⠀⠀⠀⠀⠉⠙⠿⠓⠒⠶⢺⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢶⡶⠶⠶⠶⠖⠖⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠘⣧⡀⠀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠈⠻⢤⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⢻⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡀⢀⣿⡿⠶⠶⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⢸⡇⠀⣀⣀⠀⢀⣀⣤⡀⠀⠀⠀⠀⠸⠶⠶⠚⠛⠋⢹⣿⣿⣟⣉⠉⠒⠀⠻⣦⣠⣤⣤⣤⣄⣀⠀⠀ +⠀⢀⣤⢾⣿⣷⣶⡍⠙⠙⠛⠋⠉⠀⠀⢴⡶⠀⠀⠀⠀⢀⣠⡶⠟⠛⠛⣷⠀⠉⠁⠀⠀⠈⣧⡀⠀⠩⣀⠈⢹⣆ +⠀⣠⠔⢉⡴⢿⣿⡟⠛⠛⠛⠶⣤⣀⠀⠀⠀⠀⠀⠀⣴⡿⠋⠀⠀⠀⢀⡉⠀⠀⠀⠀⢀⣼⠛⠛⢛⣿⡿⠀⣾⡟ +⠀⠁⣰⠋⢀⡿⠁⠀⠀⠀⠀⠀⠀⠉⠻⣦⡀⠀⠀⣼⠟⠀⠀⠀⢀⣠⣾⢁⣀⣤⣴⡶⠟⣁⣴⠞⠋⠉⢀⣼⣿⠁ +⠀⠀⠉⠀⠈⠷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠈⢿⡗⠚⡏⠀⢀⣤⡶⠛⠋⠉⠉⠉⠉⠀⣠⣾⠟⢁⣀⣤⣶⣿⠟⠁⠀ +⠀⠀⠀⠀⠀⠀⠀⠈⠉⠑⠲⠤⣄⣦⣤⡴⠞⠁⠀⠉⠙⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠹⠿⠾⠾⠟⠛⠁⠀⠀⠀⠀ +]], + }, + -- item field formatters + formats = { + icon = function(item) + if item.file and item.icon == "file" or item.icon == "directory" then + return Snacks.dashboard.icon(item.file, item.icon) + end + return { item.icon, width = 2, hl = "icon" } + end, + footer = { "%s", align = "center" }, + header = { "%s", align = "center" }, + file = function(item, ctx) + local fname = vim.fn.fnamemodify(item.file, ":~") + fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname + if #fname > ctx.width then + local dir = vim.fn.fnamemodify(fname, ":h") + local file = vim.fn.fnamemodify(fname, ":t") + if dir and file then + file = file:sub(-(ctx.width - #dir - 2)) + fname = dir .. "/…" .. file + end + end + local dir, file = fname:match("^(.*)/(.+)$") + return dir and { { dir .. "/", hl = "dir" }, { file, hl = "file" } } + or { { fname, hl = "file" } } + end, + }, + sections = { + { section = "header" }, + { section = "keys", gap = 1, padding = 1 }, + { section = "startup" }, + }, + }, + notifier = { enabled = true }, + indent = { enabled = true }, + picker = { enabled = true }, + statuscolumn = { enabled = true }, + }, + }, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..8277520 --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,50 @@ +return { + { "RRethy/base16-nvim" }, + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local has_lualine, lualine = pcall(require, "lualine") + if not has_lualine then + return + end + require("lualine").setup({ + options = { + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "diagnostics" }, + lualine_c = { "filename", "branch", "navic" }, + lualine_x = { "lsp_status", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + }) + end, + }, + + { + "nvimdev/lspsaga.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", -- for syntax highlighting inside the popup + "nvim-tree/nvim-web-devicons", -- for pretty icons + }, + opts = { + ui = { + border = "rounded", + }, + symbol_in_winbar = { enable = true }, + hover = { + max_width = 0.6, + open_link = "gx", + open_browser = "!google-chrome", + }, + }, + }, + { + "akinsho/bufferline.nvim", + opts = {}, + }, +}