mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-23 04:35:38 +00:00
add toggleterm plugin
This commit is contained in:
parent
59c5369783
commit
42877bdebc
@ -49,9 +49,9 @@ key("n", "<Leader>wh", ":split<CR>")
|
|||||||
key("n", "<Leader>wm", ":only<CR>")
|
key("n", "<Leader>wm", ":only<CR>")
|
||||||
|
|
||||||
-- Vimrc editing
|
-- Vimrc editing
|
||||||
key("n", "<Leader>rr", ":luafile $MYVIMRC<CR>")
|
key("n", "<Leader>rr", ":luafile $HOME/.config/nvim/init.lua<CR>")
|
||||||
key("n", "<Leader>rp", ":luafile $MYVIMRC<CR>:PackerInstall<CR>:")
|
key("n", "<Leader>rp", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerInstall<CR>:")
|
||||||
key("n", "<Leader>rc", ":luafile $MYVIMRC<CR>:PackerCompile<CR>")
|
key("n", "<Leader>rc", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerCompile<CR>")
|
||||||
|
|
||||||
-- Keep cursor in place
|
-- Keep cursor in place
|
||||||
key("n", "n", "nzz")
|
key("n", "n", "nzz")
|
||||||
@ -71,7 +71,6 @@ key("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
|
|||||||
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
|
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
|
||||||
|
|
||||||
-- Other
|
-- Other
|
||||||
key("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
|
|
||||||
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
|
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
|
||||||
key("n", "Y", "y$") --- Copy to end of line
|
key("n", "Y", "y$") --- Copy to end of line
|
||||||
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
|
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
|
||||||
|
37
modules/editor/neovim/lua/packer/toggleterm.lua
Normal file
37
modules/editor/neovim/lua/packer/toggleterm.lua
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.packer = function(use)
|
||||||
|
use({
|
||||||
|
"akinsho/toggleterm.nvim",
|
||||||
|
tag = "v2.*",
|
||||||
|
config = function()
|
||||||
|
require("toggleterm").setup({
|
||||||
|
open_mapping = [[<c-\>]],
|
||||||
|
hide_numbers = true,
|
||||||
|
direction = "float",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
|
||||||
|
|
||||||
|
-- Only set these keymaps for toggleterm
|
||||||
|
vim.api.nvim_create_autocmd("TermOpen", {
|
||||||
|
pattern = "term://*toggleterm#*",
|
||||||
|
callback = function()
|
||||||
|
-- vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --- Exit terminal mode
|
||||||
|
vim.keymap.set("t", "<C-h>", "<C-\\><C-n><C-w>h")
|
||||||
|
vim.keymap.set("t", "<C-j>", "<C-\\><C-n><C-w>j")
|
||||||
|
vim.keymap.set("t", "<C-k>", "<C-\\><C-n><C-w>k")
|
||||||
|
vim.keymap.set("t", "<C-l>", "<C-\\><C-n><C-w>l")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local terminal = require("toggleterm.terminal").Terminal
|
||||||
|
local nixpkgs = terminal:new({ cmd = "nix repl '<nixpkgs>'" })
|
||||||
|
function NIXPKGS_TOGGLE()
|
||||||
|
nixpkgs:toggle()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
@ -25,6 +25,7 @@ require("packer").startup(function(use)
|
|||||||
require("packer.completion").packer(use)
|
require("packer.completion").packer(use)
|
||||||
require("packer.syntax").packer(use)
|
require("packer.syntax").packer(use)
|
||||||
require("packer.telescope").packer(use)
|
require("packer.telescope").packer(use)
|
||||||
|
require("packer.toggleterm").packer(use)
|
||||||
|
|
||||||
-- Auto-install after bootstrapping
|
-- Auto-install after bootstrapping
|
||||||
if PACKER_BOOTSTRAP then
|
if PACKER_BOOTSTRAP then
|
||||||
|
Loading…
Reference in New Issue
Block a user