Add variable sizing to toggleterm, open horizontal by default. Add keymaps for using lazygit along size regular terminals

This commit is contained in:
Evie Litherland-Smith 2022-11-30 16:29:42 +00:00
parent 4b3277779d
commit 93eb85e5d8
4 changed files with 14 additions and 8 deletions

View file

@ -16,5 +16,5 @@ require('aerial').setup {
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[[', '<cmd>AerialPrevUp<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {})
end,
open_automatic = true,
open_automatic = false,
}

View file

@ -2,7 +2,7 @@ vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require('nvim-tree').setup {
open_on_setup=true,
open_on_setup_file=true,
open_on_setup_file=false,
hijack_cursor=true,
sync_root_with_cwd=true,
update_focused_file = {

View file

@ -1,7 +1,13 @@
require('toggleterm').setup {
direction = 'float',
direction = 'horizontal',
open_mapping = [[\t]],
size = 20,
size = function (term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.3
end
end,
hide_numbers = true, -- hide the number column in toggleterm buffers
persist_size = false,
}

View file

@ -13,7 +13,9 @@ end
vim.g.mapleader = ' '
-- Misc
imap('jk', '<Esc>')
nmap('<leader>gf', '<cmd>Git fetch<cr>')
nmap('<leader>gg', '<cmd>10TermExec cmd="lazygit; exit" direction="vertical" go_back=0<cr>')
nmap('<leader>gh', '<cmd>10TermExec cmd="lazygit; exit" direction="horizontal" go_back=0<cr>')
nmap('<leader>gf', '<cmd>10TermExec cmd="lazygit; exit" direction="float" go_back=0<cr>')
nmap('<leader>gp', '<cmd>Git pull<cr>')
nmap('<leader>gP', '<cmd>Git push<cr>')
nmap('<leader>cc', '<cmd>Git commit<cr>')
@ -39,7 +41,6 @@ nmap('<leader>hw', '<cmd>HopWord<cr>')
-- Nvim-tree
nmap('<leader>nt', '<cmd>NvimTreeToggle<cr>')
nmap('<leader>nf', '<cmd>NvimTreeFindFile<cr>')
-- Trouble
nmap('<leader>xx', '<cmd>TroubleToggle<cr>')
@ -49,5 +50,4 @@ nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>')
-- SnipRun
nmap('<leader>srs', '<cmd>SnipRun<cr>')
nmap('<leader>srr', '<cmd>%SnipRun<cr>')
nmap('<leader>sr', '<cmd>%SnipRun<cr>')