Skip to content

Commit

Permalink
dynamic veritcal terminal width
Browse files Browse the repository at this point in the history
  • Loading branch information
BakerNet committed Jun 10, 2023
1 parent 90d8ac6 commit 1374abc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions after/plugin/toggleterm.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
require('toggleterm').setup({
open_mapping = [[<C-t>]],
size = 20,
size = function(term)
if term.direction == "horizontal" then
return 20
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
persist_mode = true
})

Expand All @@ -15,5 +21,5 @@ end
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')

vim.keymap.set('n', '<leader>tv', [[<Cmd>ToggleTerm size=100 direction=vertical persist_mode=true<CR>]])
vim.keymap.set('n', '<leader>th', [[<Cmd>ToggleTerm size=20 direction=horizontal persist_mode=true<CR>]])
vim.keymap.set('n', '<leader>tv', [[<Cmd>ToggleTerm direction=vertical persist_mode=true<CR>]])
vim.keymap.set('n', '<leader>th', [[<Cmd>ToggleTerm direction=horizontal persist_mode=true<CR>]])

0 comments on commit 1374abc

Please sign in to comment.