diff --git a/.gitignore b/.gitignore index 92b2793..064d89b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .direnv +result/ diff --git a/candy/lua/marshmallow/colorscheme.lua b/candy/lua/marshmallow/colorscheme.lua deleted file mode 100644 index d35fc30..0000000 --- a/candy/lua/marshmallow/colorscheme.lua +++ /dev/null @@ -1,29 +0,0 @@ --- require("catppuccin").setup({ --- term_colors = true, --- custom_highlights = function(colors) --- return { --- StatusLine = { bg = colors.base }, --- --- MiniMapDiagnosticError = { bg = colors.red, fg = colors.red }, --- MiniMapDiagnosticWarn = { bg = colors.yellow, fg = colors.yellow }, --- MiniMapDiagnosticInfo = { bg = colors.teal, fg = colors.teal }, --- MiniMapDiagnosticHint = {}, --- --- MiniFilesBorder = { fg = colors.surface0 }, --- MiniFilesNormal = { bg = colors.base }, --- --- MiniPickBorder = { fg = colors.surface0 }, --- MiniPickNormal = { bg = colors.base }, --- MiniPickPrompt = { fg = colors.mauve }, --- --- FloatBorder = { fg = colors.mauve }, --- --- Directory = { fg = colors.mauve }, --- --- -- native_lsp method doesnt work? --- LspInlayHint = { fg = colors.overlay0, bg = colors.base }, --- } --- end, --- }) - -vim.cmd.colorscheme("kanagawa") diff --git a/candy/lua/marshmallow/defaults.lua b/candy/lua/marshmallow/defaults.lua index 1c07d3c..08eea11 100644 --- a/candy/lua/marshmallow/defaults.lua +++ b/candy/lua/marshmallow/defaults.lua @@ -3,6 +3,9 @@ vim.g.mapleader = " " vim.o.timeout = true vim.o.timeoutlen = 300 +-- Colourscheme -- +vim.cmd.colorscheme("lackluster-hack") + -- Terminal -- vim.opt.termguicolors = true @@ -41,6 +44,7 @@ vim.opt.guifont = { "JetBrainsMono Nerd Font Mono", ":h14:w-1" } -- Diagnostics -- vim.diagnostic.config({ virtual_text = false, + virtual_lines = true, signs = false, update_in_insert = false, severity_sort = true, diff --git a/candy/lua/marshmallow/env/gui.lua b/candy/lua/marshmallow/env/gui.lua index f776b11..f528fc6 100644 --- a/candy/lua/marshmallow/env/gui.lua +++ b/candy/lua/marshmallow/env/gui.lua @@ -22,7 +22,7 @@ vim.g.neovide_padding_bottom = 10 vim.g.neovide_padding_right = 10 vim.g.neovide_padding_left = 10 -vim.g.neovide_transparency = 0.9 +vim.g.neovide_opacity = 0.9 vim.g.neovide_refresh_rate = 240 diff --git a/candy/lua/marshmallow/init.lua b/candy/lua/marshmallow/init.lua index 6d7ded1..6d2aa2e 100644 --- a/candy/lua/marshmallow/init.lua +++ b/candy/lua/marshmallow/init.lua @@ -1,7 +1,6 @@ require("marshmallow.defaults") require("marshmallow.statusline") require("marshmallow.remap") -require("marshmallow.colorscheme") require("marshmallow.treesitter") require("marshmallow.completion") require("marshmallow.lsp") @@ -9,6 +8,12 @@ require("marshmallow.snippets") -- Too short for file require("mini.pick").setup() +require("mini.move").setup() +require("mini.surround").setup() +require("hardtime").setup() +require("mini.jump2d").setup({ view = { dim = true } }) +require("mini.jump").setup() +require("mini.bracketed").setup() require("marshmallow.format") require("marshmallow.files") diff --git a/candy/lua/marshmallow/lsp.lua b/candy/lua/marshmallow/lsp.lua index ad75953..eb1d7c4 100644 --- a/candy/lua/marshmallow/lsp.lua +++ b/candy/lua/marshmallow/lsp.lua @@ -14,12 +14,6 @@ vim.api.nvim_create_autocmd("LspAttach", { local opts = { noremap = true, silent = true } vim.keymap.set("n", "E", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "[d", function() - vim.diagnostic.jump({ count = -1 }) - end, opts) - vim.keymap.set("n", "]d", function() - vim.diagnostic.jump({ count = 1 }) - end, opts) vim.keymap.set( "n", "q", diff --git a/candy/lua/marshmallow/remap.lua b/candy/lua/marshmallow/remap.lua index 26146de..3c16e5a 100644 --- a/candy/lua/marshmallow/remap.lua +++ b/candy/lua/marshmallow/remap.lua @@ -1,9 +1,65 @@ -require("which-key").setup({}) +-- require("which-key").setup({}) +local miniclue = require("mini.clue") +miniclue.setup({ + triggers = { + -- Leader triggers + { mode = "n", keys = "" }, + { mode = "x", keys = "" }, + + -- Built-in completion + { mode = "i", keys = "" }, + + -- `g` key + { mode = "n", keys = "g" }, + { mode = "x", keys = "g" }, + + -- Marks + { mode = "n", keys = "'" }, + { mode = "n", keys = "`" }, + { mode = "x", keys = "'" }, + { mode = "x", keys = "`" }, + + -- Registers + { mode = "n", keys = '"' }, + { mode = "x", keys = '"' }, + { mode = "i", keys = "" }, + { mode = "c", keys = "" }, + + -- Window commands + { mode = "n", keys = "" }, + + -- `z` key + { mode = "n", keys = "z" }, + { mode = "x", keys = "z" }, + + -- mini surround + { mode = "n", keys = "s" }, + { mode = "x", keys = "s" }, + + -- mini bracketed + { mode = "n", keys = "]" }, + { mode = "n", keys = "[" }, + }, + + clues = { + -- Enhance this by adding descriptions for mapping groups + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + }, +}) -- experimental -- vim.keymap.set("n", "0", "^", { noremap = true, silent = true }) vim.keymap.set("n", "^", "0", { noremap = true, silent = true }) +-- mini.surround +-- fix s key deleting characters +vim.keymap.set({ "n", "x" }, "s", "") + -- nvim-spider require("lz.n").load({ "nvim-spider", @@ -43,24 +99,14 @@ vim.keymap.set("t", "", "h", { silent = true }) -- Grep / Pick -- vim.keymap.set("n", "f", require("mini.pick").builtin.files, { desc = "Pick (root dir)" }) +vim.keymap.set("n", "g", require("mini.pick").builtin.resume, { desc = "Resume Pick" }) vim.keymap.set("n", "/", function() local cope = function() - local items = require("mini.pick").get_picker_items() - - vim.fn.setqflist(vim.tbl_map(function(value) - local split = vim.split(value, ":") - local text = table.concat(split, "", 4) + local query = require("mini.pick").get_picker_query() - return { - filename = split[1], - lnum = split[2], - col = split[3], - text = vim.trim(text), - } - end, items)) + vim.cmd("Ggrep " .. table.concat(query)) - vim.cmd.cope() return true end local buffer_mappings = { wipeout = { char = "", func = cope } } @@ -75,6 +121,10 @@ vim.keymap.set("n", "", function() require("mini.pick").builtin.buffers({ include_current = false }, { mappings = buffer_mappings }) end, { desc = "Switch Buffer" }) +vim.keymap.set("n", "s", function() + require("mini.jump2d").start() +end, { desc = "Jump2d" }) + -- Harpoon -- require("lz.n").load({ "harpoon", diff --git a/candy/lua/marshmallow/statusline.lua b/candy/lua/marshmallow/statusline.lua index d7cb9c2..42bb15c 100644 --- a/candy/lua/marshmallow/statusline.lua +++ b/candy/lua/marshmallow/statusline.lua @@ -1,6 +1,6 @@ local M = {} -local function set_highlights(recording) +local function set_highlights_kanagawa(recording) local palette = require("kanagawa.colors").setup().theme local bg = recording and palette.diff.delete or palette.ui.bg_m2 @@ -23,23 +23,70 @@ local function set_highlights(recording) bg = bg, }) - vim.api.nvim_set_hl(0, "StatusAdd", { - fg = palette.vcs.added, + vim.api.nvim_set_hl(0, "StatusHead", { + fg = palette.syn.identifier, + bg = bg, + }) +end + +-- color = { +-- black = "#000000", +-- blue = "#7788AA", +-- gray1 = "#080808", +-- gray2 = "#191919", +-- gray3 = "#2a2a2a", +-- gray4 = "#444444", +-- gray5 = "#555555", +-- gray6 = "#7a7a7a", +-- gray7 = "#aaaaaa", +-- gray8 = "#cccccc", +-- gray9 = "#DDDDDD", +-- green = "#789978", +-- lack = "#708090", +-- luster = "#deeeed", +-- none = "none", +-- orange = "#ffaa88", +-- red = "#D70000", +-- yellow = "#abab77" +-- }, +-- color_special = { +-- comment = "#3A3A3A", +-- exception = "#505050", +-- keyword = "#666666", +-- main_background = "#101010", +-- menu_background = "#191919", +-- param = "#8E8E8E", +-- popup_background = "#1A1A1A", +-- statusline = "#242424", +-- whitespace = "#202020" +-- }, + +local function set_highlights_lackluster(recording) + local lackluster = require("lackluster") + + local bg = lackluster.color_special.statusline + local fg = recording and lackluster.color.red or lackluster.color.gray7 + + -- xxx guifg=#aaaaaa guibg=#242424 + vim.api.nvim_set_hl(0, "StatusLine", { fg = fg, bg = bg }) + + vim.api.nvim_set_hl(0, "Ruler", { + fg = lackluster.color.gray7, bg = bg, }) - vim.api.nvim_set_hl(0, "StatusChanged", { - fg = palette.vcs.changed, + vim.api.nvim_set_hl(0, "StatusLsp", { + fg = lackluster.color.green, bg = bg, }) - vim.api.nvim_set_hl(0, "StatusRemoved", { - fg = palette.vcs.removed, + vim.api.nvim_set_hl(0, "StatusFt", { + fg = lackluster.color.orange, bg = bg, }) vim.api.nvim_set_hl(0, "StatusHead", { - fg = palette.syn.identifier, + fg = lackluster.color.yellow, bg = bg, }) end @@ -50,7 +97,7 @@ vim.api.nvim_create_autocmd({ "ColorScheme", "RecordingLeave" }, { pattern = "*", group = augroup, callback = function() - set_highlights(false) + set_highlights_lackluster(false) end, }) @@ -58,7 +105,7 @@ vim.api.nvim_create_autocmd({ "RecordingEnter" }, { pattern = "*", group = augroup, callback = function() - set_highlights(true) + set_highlights_lackluster(true) end, }) @@ -93,9 +140,9 @@ local function git() local removed_count = status.removed or 0 local changed_count = status.removed or 0 - local added = added_count > 0 and ("%#StatusAdd#+" .. added_count .. "%*") or "" - local removed = removed_count > 0 and ("%#StatusRemoved#-" .. removed_count .. "%*") or "" - local changed = changed_count > 0 and ("%#StatusChanged#~" .. changed_count .. "%*") or "" + local added = added_count > 0 and ("%#GitSignsAdd#+" .. added_count .. "%*") or "" + local removed = removed_count > 0 and ("%#GitSignsDelete#-" .. removed_count .. "%*") or "" + local changed = changed_count > 0 and ("%#GitSignsChange#~" .. changed_count .. "%*") or "" local changes = "(" .. added .. removed .. changed .. "%#StatusHead#)%*" return " %#StatusHead#" .. status.head .. (has_changes and changes or "") .. "%*" diff --git a/candy/lua/marshmallow/usercommand.lua b/candy/lua/marshmallow/usercommand.lua index b323aff..12b3395 100644 --- a/candy/lua/marshmallow/usercommand.lua +++ b/candy/lua/marshmallow/usercommand.lua @@ -1,8 +1,8 @@ -vim.api.nvim_create_user_command("Trans", function() - if vim.g.neovide_transparency ~= 1 then - vim.g.neovide_transparency = 1 +vim.api.nvim_create_user_command("Opacity", function() + if vim.g.neovide_opacity ~= 1 then + vim.g.neovide_opacity = 1 else - vim.g.neovide_transparency = 0.9 + vim.g.neovide_opacity = 0.9 end end, {}) diff --git a/flake.lock b/flake.lock index 3fe649a..869932c 100644 --- a/flake.lock +++ b/flake.lock @@ -50,6 +50,21 @@ "type": "github" } }, + "flake-compat_3": { + "locked": { + "lastModified": 1746162366, + "narHash": "sha256-5SSSZ/oQkwfcAz/o/6TlejlVGqeK08wyREBQ5qFFPhM=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "0f158086a2ecdbb138cd0429410e44994f1b7e4b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -314,6 +329,7 @@ }, "tolerable": { "inputs": { + "flake-compat": "flake-compat_3", "nightly": [ "nightly" ], @@ -322,11 +338,11 @@ ] }, "locked": { - "lastModified": 1744942880, - "narHash": "sha256-XH9Y4ffQq9dHWsSDzPabtaxvEjOyShDYWgkfcggnZVk=", + "lastModified": 1747708726, + "narHash": "sha256-SipAOpY97/8g2CanfpQBBwR61b9ZLLshA9ikOClqmys=", "owner": "wires-org", "repo": "tolerable-nvim-nix", - "rev": "f1e0e952fba1aa6745f656961655642c4f8ffb09", + "rev": "192f8ebf629f584faf4ef46ebfca739b046e8872", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 25a231f..ef7ccdc 100644 --- a/flake.nix +++ b/flake.nix @@ -20,114 +20,135 @@ inputs.vim-firestore.url = "github:delphinus/vim-firestore"; inputs.vim-firestore.flake = false; - outputs = inputs: - inputs.flake-parts.lib.mkFlake {inherit inputs;} ({config, ...}: { - systems = [ - "x86_64-linux" - "x86_64-darwin" - "aarch64-linux" - "aarch64-darwin" - ]; + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } ( + { config, ... }: + { + systems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; - imports = [ - inputs.devshell.flakeModule - ]; + imports = [ + inputs.devshell.flakeModule + ]; - perSystem = { - inputs', - system, - config, - lib, - pkgs, - ... - }: { - packages = { - neovim = inputs.tolerable.makeNightlyNeovimConfig "candy" { - inherit pkgs; - src = lib.fileset.toSource { - root = ./.; - fileset = ./candy; + perSystem = + { + inputs', + system, + config, + lib, + pkgs, + ... + }: + let + tolerableConfig = { + inherit pkgs; + src = lib.fileset.toSource { + root = ./.; + fileset = ./candy; + }; + path = with pkgs; [ + curl + git + stylua + prettierd + black + nixfmt-rfc-style + taplo + lua-language-server + nil + statix + nodePackages.typescript-language-server + tailwindcss-language-server + nodePackages.sql-formatter + gopls + golangci-lint-langserver + golangci-lint + pyright + tinymist + ]; + config = { + plugins = + let + opt = plugin: { + inherit plugin; + optional = true; + }; + in + with pkgs.vimPlugins; + [ + lz-n + nvim-treesitter.withAllGrammars + nvim-lspconfig + catppuccin-nvim + mini-nvim + colorizer + luasnip + (opt conform-nvim) + plenary-nvim + (pkgs.vimUtils.buildVimPlugin { + src = inputs.harpoon-nvim; + name = "harpoon"; + doCheck = false; + }) + rustaceanvim + lackluster-nvim + typescript-tools-nvim + direnv-vim + vim-dotenv + (opt nvim-spider) + vim-fugitive + gitsigns-nvim + vim-gnupg + fidget-nvim + presence-nvim + hardtime-nvim + (pkgs.vimUtils.buildVimPlugin { + src = inputs.vim-firestore; + name = "firestore"; + }) + + # nvim-cmp + nvim-cmp + cmp-nvim-lsp + cmp-cmdline + cmp-async-path + cmp-buffer + luasnip + cmp_luasnip + ]; + }; }; - path = with pkgs; [ - curl - git - stylua - prettierd - black - nixfmt-rfc-style - taplo - lua-language-server - nil - statix - nodePackages.typescript-language-server - tailwindcss-language-server - nodePackages.sql-formatter - gopls - golangci-lint-langserver - golangci-lint - pyright - tinymist - ]; - config = { - plugins = let - opt = plugin: { - inherit plugin; - optional = true; - }; - in - with pkgs.vimPlugins; [ - lz-n - nvim-treesitter.withAllGrammars - nvim-lspconfig - catppuccin-nvim - kanagawa-nvim - mini-nvim - luasnip - (opt conform-nvim) - plenary-nvim - which-key-nvim - (pkgs.vimUtils.buildVimPlugin { - src = inputs.harpoon-nvim; - name = "harpoon"; - doCheck = false; - }) - rustaceanvim - nvim-web-devicons - typescript-tools-nvim - direnv-vim - vim-dotenv - (opt nvim-spider) - vim-fugitive - gitsigns-nvim - vim-gnupg - fidget-nvim - presence-nvim - vim-wakatime - (pkgs.vimUtils.buildVimPlugin { - src = inputs.vim-firestore; - name = "firestore"; - }) + in + { + packages = { + neovim = inputs.tolerable.makeNightlyNeovimConfig "candy" tolerableConfig; + + default = config.packages.neovim; - # nvim-cmp - nvim-cmp - cmp-nvim-lsp - cmp-cmdline - cmp-async-path - cmp-buffer - luasnip - cmp_luasnip - ]; + testing = inputs.tolerable.makeNightlyNeovimConfig "candy" ( + tolerableConfig + // { + testing = true; + } + ); }; }; - default = config.packages.neovim; - }; - }; - - flake = let - package = inputs.nixpkgs.lib.genAttrs config.systems (system: inputs.self.packages.${system}.default); - in { - defaultPackage = package; - }; - }); + flake = + let + package = inputs.nixpkgs.lib.genAttrs config.systems ( + system: inputs.self.packages.${system}.default + ); + in + { + defaultPackage = package; + }; + } + ); }