From a4a08dc7efe585b87b79ca39f0cad05f150f7141 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 23 Oct 2024 21:19:48 +0300 Subject: [PATCH] Nvim: Make prettier. --- flake.lock | 51 +++++++++++++------- flake.nix | 12 +++-- home/config/nvim/default.nix | 6 ++- home/config/nvim/module/config/Highlight.nix | 16 +++++- home/config/nvim/module/key/Prompt.nix | 4 +- home/config/nvim/module/plugin/Dressing.nix | 6 +++ home/config/nvim/module/plugin/Gen.nix | 8 +++ home/config/nvim/module/plugin/Ollama.nix | 18 ------- home/config/nvim/module/plugin/Telescope.nix | 8 +-- 9 files changed, 77 insertions(+), 52 deletions(-) create mode 100644 home/config/nvim/module/plugin/Dressing.nix create mode 100644 home/config/nvim/module/plugin/Gen.nix delete mode 100644 home/config/nvim/module/plugin/Ollama.nix diff --git a/flake.lock b/flake.lock index d796a8aa..47a1b27f 100644 --- a/flake.lock +++ b/flake.lock @@ -561,6 +561,38 @@ "type": "github" } }, + "nvimDressing": { + "flake": false, + "locked": { + "lastModified": 1726594554, + "narHash": "sha256-EtLYhAwoSoHyGiGrHAVYL4/CqcgO4rSbV6otO3V08hM=", + "owner": "stevearc", + "repo": "dressing.nvim", + "rev": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2", + "type": "github" + }, + "original": { + "owner": "stevearc", + "repo": "dressing.nvim", + "type": "github" + } + }, + "nvimGen": { + "flake": false, + "locked": { + "lastModified": 1728201978, + "narHash": "sha256-rBUltJdluSseNUiTfjBZyuBwrGrASWbW1ROVdcAW6ug=", + "owner": "David-Kunz", + "repo": "gen.nvim", + "rev": "83f1d6b6ffa6a6f32f6a93a33adc853f27541a94", + "type": "github" + }, + "original": { + "owner": "David-Kunz", + "repo": "gen.nvim", + "type": "github" + } + }, "nvimGitsigns": { "flake": false, "locked": { @@ -625,22 +657,6 @@ "type": "github" } }, - "nvimOllama": { - "flake": false, - "locked": { - "lastModified": 1717906114, - "narHash": "sha256-8tW5tp2GiYw+PnR7rqiKfykLW/yqvGOtqauZCgEeQCg=", - "owner": "nomnivore", - "repo": "ollama.nvim", - "rev": "45e58779fecde7ac5b8f62800bbe7180d4b48507", - "type": "github" - }, - "original": { - "owner": "nomnivore", - "repo": "ollama.nvim", - "type": "github" - } - }, "nvimPlenary": { "flake": false, "locked": { @@ -775,11 +791,12 @@ "nvimCloseBuffers": "nvimCloseBuffers", "nvimColorizer": "nvimColorizer", "nvimDevicons": "nvimDevicons", + "nvimDressing": "nvimDressing", + "nvimGen": "nvimGen", "nvimGitsigns": "nvimGitsigns", "nvimGruvboxMaterial": "nvimGruvboxMaterial", "nvimIndentoMatic": "nvimIndentoMatic", "nvimLspconfig": "nvimLspconfig", - "nvimOllama": "nvimOllama", "nvimPlenary": "nvimPlenary", "nvimTelescope": "nvimTelescope", "nvimTodo": "nvimTodo", diff --git a/flake.nix b/flake.nix index a57dd352..82cbc3cc 100644 --- a/flake.nix +++ b/flake.nix @@ -67,6 +67,14 @@ url = "github:nvim-tree/nvim-web-devicons"; flake = false; }; + nvimDressing = { + url = "github:stevearc/dressing.nvim"; + flake = false; + }; + nvimGen = { + url = "github:David-Kunz/gen.nvim"; + flake = false; + }; nvimGitsigns = { url = "github:lewis6991/gitsigns.nvim"; flake = false; @@ -83,10 +91,6 @@ url = "github:neovim/nvim-lspconfig"; flake = false; }; - nvimOllama = { - url = "github:nomnivore/ollama.nvim"; - flake = false; - }; nvimPlenary = { url = "github:nvim-lua/plenary.nvim"; flake = false; diff --git a/home/config/nvim/default.nix b/home/config/nvim/default.nix index 70fd5edf..33e5f9e7 100644 --- a/home/config/nvim/default.nix +++ b/home/config/nvim/default.nix @@ -31,11 +31,12 @@ in "${inputs.nvimCloseBuffers}" "${inputs.nvimColorizer}" "${inputs.nvimDevicons}" + "${inputs.nvimDressing}" + "${inputs.nvimGen}" "${inputs.nvimGitsigns}" "${inputs.nvimGruvboxMaterial}" "${inputs.nvimIndentoMatic}" "${inputs.nvimLspconfig}" - "${inputs.nvimOllama}" "${inputs.nvimPlenary}" "${inputs.nvimTelescope}" "${inputs.nvimTodo}" @@ -66,8 +67,9 @@ in ./module/plugin/Align.nix ./module/plugin/Treesitter.nix ./module/plugin/Fold.nix - ./module/plugin/Ollama.nix + ./module/plugin/Gen.nix ./module/plugin/Colorizer.nix + ./module/plugin/Dressing.nix ./module/plugin/lsp/Go.nix ./module/plugin/lsp/Haskell.nix ./module/plugin/lsp/Lua.nix diff --git a/home/config/nvim/module/config/Highlight.nix b/home/config/nvim/module/config/Highlight.nix index 2eaecab5..5a30e2af 100644 --- a/home/config/nvim/module/config/Highlight.nix +++ b/home/config/nvim/module/config/Highlight.nix @@ -22,6 +22,10 @@ let transparent = { bg = lib.generators.mkLuaInline "clear"; }; + border = { + bg = lib.generators.mkLuaInline "clear"; + fg = "#${color.accent}"; + }; in { text = '' @@ -29,15 +33,23 @@ in group = vim.api.nvim_create_augroup('Color', {}), pattern = "*", callback = function () - -- Backgrounds. + -- Background. ${mkHighlight "CursorLine" bg} - ${mkHighlight "TelescopeSelection" bg} + ${mkHighlight "Pmenu" bg} + ${mkHighlight "PmenuExtra" bg} -- Selection. ${mkHighlight "Visual" selection} + ${mkHighlight "PmenuSel" selection} + ${mkHighlight "TelescopeSelection" selection} -- Transparent. ${mkHighlight "NormalFloat" transparent} + + -- Border. + ${mkHighlight "FloatBorder" border} + ${mkHighlight "FloatTitle" border} + ${mkHighlight "TelescopeBorder" border} end }) ''; diff --git a/home/config/nvim/module/key/Prompt.nix b/home/config/nvim/module/key/Prompt.nix index 13c9b346..86a567ca 100644 --- a/home/config/nvim/module/key/Prompt.nix +++ b/home/config/nvim/module/key/Prompt.nix @@ -1,7 +1,7 @@ { ... }: { text = '' - rekey_normal("p", ":lua require('ollama').prompt()") - rekey_visual("p", ":lua require('ollama').prompt()") + rekey_normal("p", ":Gen") + rekey_visual("p", ":Gen") ''; } diff --git a/home/config/nvim/module/plugin/Dressing.nix b/home/config/nvim/module/plugin/Dressing.nix new file mode 100644 index 00000000..1f50c94f --- /dev/null +++ b/home/config/nvim/module/plugin/Dressing.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + text = '' + require("dressing").setup({ }) + ''; +} diff --git a/home/config/nvim/module/plugin/Gen.nix b/home/config/nvim/module/plugin/Gen.nix new file mode 100644 index 00000000..0f55d577 --- /dev/null +++ b/home/config/nvim/module/plugin/Gen.nix @@ -0,0 +1,8 @@ +{ config, ... }: +{ + text = '' + require("gen").setup { + model = "${config.setting.ollama.primaryModel}" + } + ''; +} diff --git a/home/config/nvim/module/plugin/Ollama.nix b/home/config/nvim/module/plugin/Ollama.nix deleted file mode 100644 index 01503feb..00000000 --- a/home/config/nvim/module/plugin/Ollama.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, ... }: -{ - text = '' - require("ollama").setup { - model = "${config.setting.ollama.primaryModel}", - url = "http://127.0.0.1:11434", - -- View the actual default prompts in ./lua/ollama/prompts.lua - prompts = { - -- Sample_Prompt = { - -- prompt = "This is a sample prompt that receives $input and $sel(ection), among others.", - -- input_label = "> ", - -- model = "mistral", - -- action = "display", - -- } - } - } - ''; -} diff --git a/home/config/nvim/module/plugin/Telescope.nix b/home/config/nvim/module/plugin/Telescope.nix index 3d0106af..d7037252 100644 --- a/home/config/nvim/module/plugin/Telescope.nix +++ b/home/config/nvim/module/plugin/Telescope.nix @@ -2,13 +2,7 @@ { text = '' require("telescope").setup{ - defaults = { - mappings = { - i = { - [""] = "which_key", - } - } - }, + defaults = { }, extensions = { }, pickers = { }, }