mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
feat: toggleterm
This commit is contained in:
parent
d867dae743
commit
202eaaf322
6 changed files with 94 additions and 0 deletions
17
flake.lock
17
flake.lock
|
@ -975,6 +975,7 @@
|
|||
"telescope": "telescope",
|
||||
"tidalcycles": "tidalcycles",
|
||||
"todo-comments": "todo-comments",
|
||||
"toggleterm-nvim": "toggleterm-nvim",
|
||||
"tokyonight": "tokyonight",
|
||||
"trouble": "trouble",
|
||||
"venn-nvim": "venn-nvim",
|
||||
|
@ -1162,6 +1163,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"toggleterm-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1675358836,
|
||||
"narHash": "sha256-9O7p/7tRStg51OFhMc88M5ewYquiYC9x9CV4s5veVP8=",
|
||||
"owner": "akinsho",
|
||||
"repo": "toggleterm.nvim",
|
||||
"rev": "19aad0f41f47affbba1274f05e3c067e6d718e1e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "akinsho",
|
||||
"repo": "toggleterm.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"tokyonight": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
19
flake.nix
19
flake.nix
|
@ -102,36 +102,45 @@
|
|||
};
|
||||
};
|
||||
vim.tabline.nvimBufferline.enable = true;
|
||||
|
||||
vim.treesitter = {
|
||||
enable = true;
|
||||
context.enable = true;
|
||||
};
|
||||
|
||||
vim.binds = {
|
||||
whichKey.enable = true;
|
||||
cheatsheet.enable = true;
|
||||
};
|
||||
|
||||
vim.telescope = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
vim.markdown = {
|
||||
enable = true;
|
||||
glow.enable = true;
|
||||
};
|
||||
|
||||
vim.git = {
|
||||
enable = true;
|
||||
gitsigns.enable = true;
|
||||
};
|
||||
|
||||
vim.minimap = {
|
||||
minimap-vim.enable = false;
|
||||
codewindow.enable = true; # lighter, faster, and uses lua for configuration
|
||||
};
|
||||
|
||||
vim.dashboard = {
|
||||
dashboard-nvim.enable = false;
|
||||
alpha.enable = true;
|
||||
};
|
||||
|
||||
vim.notify = {
|
||||
nvim-notify.enable = true;
|
||||
};
|
||||
|
||||
vim.utility = {
|
||||
colorizer.enable = true;
|
||||
icon-picker.enable = true;
|
||||
|
@ -142,6 +151,10 @@
|
|||
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
|
||||
orgmode.enable = true;
|
||||
};
|
||||
|
||||
vim.terminal = {
|
||||
toggleterm.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -528,6 +541,12 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# Terminal
|
||||
toggleterm-nvim = {
|
||||
url = "github:akinsho/toggleterm.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Dependencies
|
||||
plenary-nvim = {
|
||||
# (required by crates-nvim)
|
||||
|
|
|
@ -59,6 +59,7 @@ with lib; let
|
|||
"obsidian-nvim"
|
||||
"vim-markdown"
|
||||
"tabular"
|
||||
"toggleterm-nvim"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
./utility
|
||||
./presence
|
||||
./notes
|
||||
./terminal
|
||||
];
|
||||
|
||||
pkgsModule = {config, ...}: {
|
||||
|
|
5
modules/terminal/default.nix
Normal file
5
modules/terminal/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./toggleterm.nix
|
||||
];
|
||||
}
|
51
modules/terminal/toggleterm.nix
Normal file
51
modules/terminal/toggleterm.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.terminal.toggleterm;
|
||||
in {
|
||||
options.vim.terminal.toggleterm = {
|
||||
enable = mkEnableOption "Enable toggleterm as a replacement to built-in terminal command";
|
||||
direction = mkOption {
|
||||
type = types.enum ["horizontal" "vertical" "tab" "float"];
|
||||
default = "float";
|
||||
description = "Direction of the terminal";
|
||||
};
|
||||
enable_winbar = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable winbar";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"toggleterm-nvim"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
|
||||
require("toggleterm").setup({
|
||||
open_mapping = [[<c-t>]],
|
||||
direction = '${toString cfg.direction}',
|
||||
-- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it
|
||||
size = function(term)
|
||||
if term.direction == "horizontal" then
|
||||
return 15
|
||||
elseif term.direction == "vertical" then
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end,
|
||||
winbar = {
|
||||
enabled = '${toString cfg.enable_winbar}',
|
||||
name_formatter = function(term) -- term: Terminal
|
||||
return term.name
|
||||
end
|
||||
},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue