diff --git a/init.lua b/init.lua index a6c33d46..97c150b7 100644 --- a/init.lua +++ b/init.lua @@ -1056,3 +1056,19 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +local toggleterm = require 'toggleterm' + +toggleterm.setup { + open_mapping = 'T', -- press T in normal or terminal to toggle + direction = 'float', -- use a floating window + float_opts = { + border = 'single', -- or "double", "curved", etc. + -- dynamic sizing: 85% of the current editor dimensions + width = function() + return math.floor(vim.o.columns * 0.85) + end, + height = function() + return math.floor(vim.o.lines * 0.85) + end, + }, +} diff --git a/lua/custom/keymaps/init.lua b/lua/custom/keymaps/init.lua index 623d0a70..0a2b6768 100644 --- a/lua/custom/keymaps/init.lua +++ b/lua/custom/keymaps/init.lua @@ -22,26 +22,4 @@ vim.keymap.set('n', 'J', ':m .+1==', { noremap = true, silent = true }) -- Move current line up with K vim.keymap.set('n', 'K', ':m .-2==', { noremap = true, silent = true }) --- Map T to toggle terminal -vim.keymap.set('n', 'T', function() - local Terminal = require('toggleterm.terminal').Terminal - local float_term = Terminal:new { - direction = 'float', - hidden = true, -- ensures it doesn't persist visually - } - float_term:toggle() - require('toggleterm').toggle_all() -end, { desc = 'Toggle Floating Terminal' }) - -vim.keymap.set('n', 'bd', function() - -- Close all open toggleterm terminals - require('toggleterm').toggle_all() - - -- Then close the current buffer - vim.cmd 'bdelete!' -end, { desc = 'Close buffer and toggleterm' }) - -vim.keymap.set('n', '/', require('telescope.builtin').current_buffer_fuzzy_find, { desc = '[/] Fuzzy search in current buffer' }) -vim.keymap.set('t', '', [[]], { desc = 'Exit terminal mode' }) - return {} diff --git a/test.txt b/test.txt deleted file mode 100644 index 21cf490a..00000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -Line from main branch