mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-02 21:34:33 +02:00
harpoon: init plugin (#145)
* plugins: Add harpoon * harpoon: use example * merge main --------- Co-authored-by: Pedro Alves <pta2002@pta2002.com>
This commit is contained in:
parent
c5d9ea91b5
commit
13943b4ab2
2 changed files with 126 additions and 1 deletions
|
@ -21,7 +21,6 @@
|
|||
./git/gitmessenger.nix
|
||||
./git/gitsigns.nix
|
||||
./git/neogit.nix
|
||||
|
||||
./languages/clangd-extensions.nix
|
||||
./languages/ledger.nix
|
||||
./languages/markdown-preview.nix
|
||||
|
@ -57,6 +56,10 @@
|
|||
./utils/endwise.nix
|
||||
./utils/floaterm.nix
|
||||
./utils/goyo.nix
|
||||
<<<<<<< HEAD
|
||||
./utils/harpoon.nix
|
||||
=======
|
||||
>>>>>>> origin/main
|
||||
./utils/indent-blankline.nix
|
||||
./utils/intellitab.nix
|
||||
./utils/mark-radar.nix
|
||||
|
|
122
plugins/utils/harpoon.nix
Normal file
122
plugins/utils/harpoon.nix
Normal file
|
@ -0,0 +1,122 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.harpoon;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
|
||||
projectConfigModule = types.submodule {
|
||||
options = {
|
||||
termCommands = helpers.mkNullOrOption (types.listOf types.str) ''
|
||||
List of predefined terminal commands for this project.
|
||||
'';
|
||||
|
||||
marks = helpers.mkNullOrOption (types.listOf types.str) ''
|
||||
List of predefined marks (filenames) for this project.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.harpoon = {
|
||||
enable = mkEnableOption "harpoon";
|
||||
|
||||
package = helpers.mkPackageOption "harpoon" pkgs.vimPlugins.harpoon;
|
||||
|
||||
saveOnToggle = helpers.defaultNullOpts.mkBool false ''
|
||||
Sets the marks upon calling `toggle` on the ui, instead of require `:w`.
|
||||
'';
|
||||
|
||||
saveOnChange = helpers.defaultNullOpts.mkBool true ''
|
||||
Saves the harpoon file upon every change. disabling is unrecommended.
|
||||
'';
|
||||
|
||||
enterOnSendcmd = helpers.defaultNullOpts.mkBool false ''
|
||||
Sets harpoon to run the command immediately as it's passed to the terminal when calling `sendCommand`.
|
||||
'';
|
||||
|
||||
tmuxAutocloseWindows = helpers.defaultNullOpts.mkBool false ''
|
||||
Closes any tmux windows harpoon that harpoon creates when you close Neovim.
|
||||
'';
|
||||
|
||||
excludedFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "['harpoon']" ''
|
||||
Filetypes that you want to prevent from adding to the harpoon list menu.
|
||||
'';
|
||||
|
||||
markBranch = helpers.defaultNullOpts.mkBool false ''
|
||||
Set marks specific to each git branch inside git repository
|
||||
'';
|
||||
|
||||
projects = mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
Predefined projetcs. The keys of this attrs should be the path to the project.
|
||||
$HOME is working.
|
||||
'';
|
||||
example = ''
|
||||
projects = {
|
||||
"$HOME/personal/vim-with-me/server" = {
|
||||
term.cmds = [
|
||||
"./env && npx ts-node src/index.ts"
|
||||
];
|
||||
};
|
||||
};
|
||||
'';
|
||||
type = types.attrsOf projectConfigModule;
|
||||
};
|
||||
|
||||
menu = {
|
||||
width = helpers.defaultNullOpts.mkInt 60 ''
|
||||
Menu window width
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkInt 10 ''
|
||||
Menu window height
|
||||
'';
|
||||
|
||||
borderChars = helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
"[ \"─\" \"│\" \"─\" \"│\" \"╭\" \"╮\" \"╯\" \"╰\" ]"
|
||||
"Border characters"
|
||||
;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
projects = builtins.mapAttrs
|
||||
(
|
||||
name: value: {
|
||||
term.cmds = value.termCommands;
|
||||
mark.marks = map (mark: { filename = mark; }) value.marks;
|
||||
}
|
||||
)
|
||||
cfg.projects;
|
||||
|
||||
options = {
|
||||
global_settings = {
|
||||
save_on_toggle = cfg.saveOnToggle;
|
||||
save_on_change = cfg.saveOnChange;
|
||||
enter_on_sendcmd = cfg.enterOnSendcmd;
|
||||
tmux_autoclose_windows = cfg.tmuxAutocloseWindows;
|
||||
excluded_filetypes = cfg.excludedFiletypes;
|
||||
mark_branch = cfg.markBranch;
|
||||
};
|
||||
|
||||
projects = projects;
|
||||
|
||||
menu = {
|
||||
width = cfg.menu.width;
|
||||
height = cfg.menu.height;
|
||||
borderchars = cfg.menu.borderChars;
|
||||
};
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('harpoon').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue