Add the posession plugin

This commit is contained in:
Jeremy Wall 2023-09-11 10:26:01 -04:00
parent 2a9e3dc572
commit f9acfc44ab
5 changed files with 51 additions and 9 deletions

View File

@ -29,8 +29,12 @@
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"
@ -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 ];
};
};

View File

@ -411,11 +411,37 @@ vim.keymap.set("n", "<Leader>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 = '<c-x>', i = '<c-x>' },
load = { n = '<c-v>', i = '<c-v>' },
delete = { n = '<c-t>', i = '<c-t>' },
rename = { n = '<c-r>', i = '<c-r>' },
},
},
},
}
-- 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", "<leader>pl", telescope.extensions.possession.list)
vim.keymap.set("n", "<Leader>nff", telescope_builtins.fd)
vim.keymap.set("n", "<Leader>rl", telescope_builtins.lsp_references)
vim.keymap.set("n", "<Leader>rn", vim.lsp.buf.rename)

View File

@ -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=";
};
}

View File

@ -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";
};
}

6
nix/darwin/flake.lock generated
View File

@ -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"
}
},