-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(terminal-integration): add
toggleterm-manager.nvim
(#959)
--------- Co-authored-by: Micah Halter <[email protected]>
- Loading branch information
1 parent
9bbab93
commit 22a9151
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
lua/astrocommunity/terminal-integration/toggleterm-manager-nvim/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# toggleterm-manager.nvim | ||
|
||
A Telescope extension to manage Toggleterm's terminals in NeoVim | ||
|
||
Key `<Leader>ts` is mapped to open the telescope interface. | ||
|
||
Additionally added keymaps in the Telescope interface: | ||
|
||
- `n` normal mode: | ||
- `<CR>`: toggle the selected terminal. | ||
- `r`: rename the selected terminal. | ||
- `d`: delete the selected terminal. | ||
- `n`: create a new terminal buffer | ||
- `i` insert mode: | ||
- `<CR>`: toggle the selected terminal. | ||
- `<C-r>`: rename the selected terminal. | ||
- `<C-d>`: delete the selected terminal. | ||
- `<C-i>`: create a new terminal buffer | ||
|
||
**Repository:** <https://github.com/ryanmsnyder/toggleterm-manager.nvim> |
38 changes: 38 additions & 0 deletions
38
lua/astrocommunity/terminal-integration/toggleterm-manager-nvim/init.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
return { | ||
"ryanmsnyder/toggleterm-manager.nvim", | ||
lazy = true, | ||
init = function(plugin) require("astrocore").on_load("telescope.nvim", plugin.name) end, | ||
dependencies = { | ||
"akinsho/toggleterm.nvim", | ||
"nvim-telescope/telescope.nvim", | ||
"nvim-lua/plenary.nvim", | ||
{ | ||
"AstroNvim/astrocore", | ||
opts = { | ||
mappings = { | ||
n = { | ||
["<Leader>ts"] = { "<cmd>Telescope toggleterm_manager<cr>", desc = "Search Toggleterms" }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
opts = function(_, opts) | ||
local term_icon = require("astroui").get_icon "Terminal" | ||
local toggleterm_manager = require "toggleterm-manager" | ||
local actions = toggleterm_manager.actions | ||
|
||
return require("astrocore").extend_tbl(opts, { | ||
titles = { prompt = term_icon .. " Terminals" }, | ||
results = { term_icon = term_icon }, | ||
mappings = { | ||
n = { | ||
["<CR>"] = { action = actions.toggle_term, exit_on_action = true }, -- toggles terminal open/closed | ||
["r"] = { action = actions.rename_term, exit_on_action = false }, -- provides a prompt to rename a terminal | ||
["d"] = { action = actions.delete_term, exit_on_action = false }, -- deletes a terminal buffer | ||
["n"] = { action = actions.create_term, exit_on_action = false }, -- creates a new terminal buffer | ||
}, | ||
}, | ||
}) | ||
end, | ||
} |