diff --git a/nix/base-system/flake.nix b/nix/base-system/flake.nix index 3f85155..c1a1d4c 100644 --- a/nix/base-system/flake.nix +++ b/nix/base-system/flake.nix @@ -29,9 +29,13 @@ age = agenix-flake.packages."${system}".default; in { config, pkgs, ... }: let nvim-treesitter-csharp = pkgs.callPackage ./nvim-treesitter-csharp.nix { - buildGrammar = pkgs.tree-sitter.buildGrammar; - fetchFromGitHub = pkgs.fetchFromGitHub; + inherit (pkgs.tree-sitter) buildGrammar; + inherit (pkgs) fetchFromGitHub; }; + possession-nvim = pkgs.callPackage ./possession-nvim.nix { + inherit (pkgs.vimUtils) buildVimPlugin; + inherit (pkgs) fetchFromGitHub; + }; expected-parsers = (pkgs.lib.attrVals [ "tree-sitter-rust" "tree-sitter-lua" @@ -77,8 +81,8 @@ customRC = "lua << EOF ${builtins.readFile ./init.lua} EOF"; - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ + packages.myVimPackage = { + start = (with pkgs.vimPlugins; [ nvim-tree-lua nvim-lspconfig packer-nvim @@ -107,7 +111,7 @@ EOF"; telescope-nvim telescope-lsp-handlers-nvim plenary-nvim - ]; + ]) ++ [ possession-nvim ]; }; }; diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index a13db24..129776c 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -411,11 +411,37 @@ vim.keymap.set("n", "mg", function() vim.cmd("MagitOnly") end) +require('possession').setup{ + commands = { + save = 'SSave', + load = 'SLoad', + delete = 'SDelete', + list = 'SList', + }, + autosave = { + current = true, + on_load = true, + on_quit = true, + }, + telescope = { + list = { + default_action = 'load', + mappings = { + save = { n = '', i = '' }, + load = { n = '', i = '' }, + delete = { n = '', i = '' }, + rename = { n = '', i = '' }, + }, + }, + }, +} + -- Telelscope configuration local telescope = require('telescope') local telescope_builtins = require('telescope.builtin') local telescope_actions = require('telescope.actions') +telescope.load_extension('possession') -- https://github.com/nvim-telescope/telescope.nvim telescope.setup({ defaults = { @@ -428,6 +454,7 @@ telescope.setup({ }, }) +vim.keymap.set("n", "pl", telescope.extensions.possession.list) vim.keymap.set("n", "nff", telescope_builtins.fd) vim.keymap.set("n", "rl", telescope_builtins.lsp_references) vim.keymap.set("n", "rn", vim.lsp.buf.rename) diff --git a/nix/base-system/nvim-treesitter-csharp.nix b/nix/base-system/nvim-treesitter-csharp.nix index c09200b..a00dd65 100644 --- a/nix/base-system/nvim-treesitter-csharp.nix +++ b/nix/base-system/nvim-treesitter-csharp.nix @@ -6,6 +6,6 @@ buildGrammar { owner = "tree-sitter"; repo = "tree-sitter-c-sharp"; rev = "1648e21b4f087963abf0101ee5221bb413107b07"; - hash = "sha256-WvkHtw8t14UNqiJvmS9dbGYQSVVzHS9mcWzxq+KLMnU=";#pkgs.lib.fakeHash; + hash = "sha256-WvkHtw8t14UNqiJvmS9dbGYQSVVzHS9mcWzxq+KLMnU="; }; } diff --git a/nix/base-system/possession-nvim.nix b/nix/base-system/possession-nvim.nix new file mode 100644 index 0000000..a1bc7bf --- /dev/null +++ b/nix/base-system/possession-nvim.nix @@ -0,0 +1,11 @@ +{buildVimPlugin, fetchFromGitHub, ...}: +buildVimPlugin { + pname = "possession.nvim"; + version = "2023-09-10"; + src = fetchFromGitHub { + owner = "jedrzejboczar"; + repo = "possession.nvim"; + rev = "9fef60176e1dbb28b9216ae288029be2e27f0e40"; + hash = "sha256-kiKoDSyu0TXj+lcLS+f+9NEOYAZV6YH4xPa7ZzY696Y"; + }; +} diff --git a/nix/darwin/flake.lock b/nix/darwin/flake.lock index 066013f..0f2611a 100644 --- a/nix/darwin/flake.lock +++ b/nix/darwin/flake.lock @@ -34,12 +34,12 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-ssLNR+zsRahPClwxaYQlNbKeAzOOgVVCLIdvHLycmG8=", - "path": "/nix/store/8fmmlzxglqwwlliigfwg1x7d6s1kmky7-source/nix/base-system", + "narHash": "sha256-vks0c+ByEs5/F4x6nMkDecgUAXOLNnVSxaSJEoywhRg=", + "path": "/nix/store/fb05dg2zd1hl4kpmwjfynp3a9hpkdmwz-source/nix/base-system", "type": "path" }, "original": { - "path": "/nix/store/8fmmlzxglqwwlliigfwg1x7d6s1kmky7-source/nix/base-system", + "path": "/nix/store/fb05dg2zd1hl4kpmwjfynp3a9hpkdmwz-source/nix/base-system", "type": "path" } },