summaryrefslogtreecommitdiff
path: root/.config/nvim/after/plugin/toggleterm.lua
diff options
context:
space:
mode:
authorjoott <josh@ottmail.me>2025-07-30 15:53:29 -0400
committerjoott <josh@ottmail.me>2025-07-30 15:53:29 -0400
commit26694e09e8f5bf2262737312e7ad217118db20de (patch)
treeca55eee2f8c5106c61e747979780d6f393fd24c9 /.config/nvim/after/plugin/toggleterm.lua
parent89a596a50ec61b8ebd6040b06a7cab994afd1b3a (diff)
downloaddotfiles-26694e09e8f5bf2262737312e7ad217118db20de.tar.gz
dotfiles-26694e09e8f5bf2262737312e7ad217118db20de.zip
switching to yadm
Diffstat (limited to '.config/nvim/after/plugin/toggleterm.lua')
-rw-r--r--.config/nvim/after/plugin/toggleterm.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/.config/nvim/after/plugin/toggleterm.lua b/.config/nvim/after/plugin/toggleterm.lua
new file mode 100644
index 0000000..61742f6
--- /dev/null
+++ b/.config/nvim/after/plugin/toggleterm.lua
@@ -0,0 +1,47 @@
+local Terminal = require('toggleterm.terminal').Terminal
+
+-- lazygit
+local lazygit = Terminal:new({
+ cmd = 'lazygit',
+ display_name = 'lazygit',
+ dir = 'git_dir',
+ hidden = true,
+ direction = 'float',
+ winbar = { enabled = false, },
+ float_opts = {
+ border = 'rounded',
+ }
+})
+
+function _lazygit_toggle()
+ lazygit:toggle()
+end
+
+-- julia
+local jlrepl = Terminal:new({
+ cmd = 'julia',
+ on_open = function()
+ local key = vim.api.nvim_replace_termcodes([[<C-\><C-n><C-w><C-p>]], true, false, true)
+ vim.api.nvim_feedkeys(key, 'n', false)
+ vim.keymap.set('n', '<leader>jr', '<cmd>lua _jlrepl_exec()<CR>', { noremap = true, silent = true })
+ end,
+ on_close = function()
+ vim.keymap.set('n', '<leader>jr', '<Nop>')
+ end,
+})
+
+function _jlrepl_exec()
+ jlrepl:send(string.format('include("%s")', vim.fn.expand('%:p')), true)
+end
+
+function _jlrepl_open()
+ if not jlrepl:is_open() then
+ jlrepl:open()
+ end
+end
+
+-- repl send
+local trim_spaces = true
+vim.keymap.set("v", "<space>s", function()
+ require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count })
+end)