diff --git a/nvim/.config/nvim/after/plugin/which-key.lua b/nvim/.config/nvim/after/plugin/which-key.lua index 9bf6e0e..7048666 100644 --- a/nvim/.config/nvim/after/plugin/which-key.lua +++ b/nvim/.config/nvim/after/plugin/which-key.lua @@ -42,6 +42,8 @@ wk.register({ -- Debugging D = "Debug UI", B = "Set Breakpoint", + [""] = "Open IPython", + [""] = "Execute py file", [""] = "Debug: Continue", }, }) diff --git a/nvim/.config/nvim/lua/clint/keybindings.lua b/nvim/.config/nvim/lua/clint/keybindings.lua index 5242aae..491f701 100644 --- a/nvim/.config/nvim/lua/clint/keybindings.lua +++ b/nvim/.config/nvim/lua/clint/keybindings.lua @@ -82,4 +82,27 @@ keymap('n', '', ":lua require'dap'.step_over()", default_ops) keymap('n', 'D', ":lua require'dapui'.toggle()", default_ops) -- REPL -keymap('v', 'x', ':ToggleTermSendVisualLines', default_ops) +keymap('v', 'x', ':ToggleTermSendVisualLines 100', default_ops) + + +-- Helpful stuff for ToggleTerm, taken from their docs +function _G.set_terminal_keymaps() + local opts = {buffer = 0} + vim.keymap.set('t', '', [[]], opts) + vim.keymap.set('t', 'jk', [[]], opts) + vim.keymap.set('t', '', [[wincmd h]], opts) + vim.keymap.set('t', '', [[wincmd j]], opts) + vim.keymap.set('t', '', [[wincmd k]], opts) + vim.keymap.set('t', '', [[wincmd l]], opts) + vim.keymap.set('t', '', [[]], opts) +end +-- if you only want these mappings for toggle term use term://*toggleterm#* instead +vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') + +-- Toggle a custom Terminal with ipython +local Terminal = require('toggleterm.terminal').Terminal +local ipython = Terminal:new({ cmd="ipython", direction="horizontal", count="100"}) +function _ipython_toggle() + ipython:toggle() +end +keymap('n', '', ":lua _ipython_toggle()wincmd k", default_ops)