diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 1c61892..9e44b7f 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -6,6 +6,7 @@ local map_wrapper = utils.map local maps = config.mappings local plugin_maps = maps.plugins local nvChad_options = config.options.nvChad +local terminal_options = config.options.terminal local cmd = vim.cmd @@ -95,14 +96,26 @@ M.misc = function() -- get out of terminal mode map("t", term_maps.esc_termmode, "") -- hide a term from within terminal mode - map("t", term_maps.esc_hide_termmode, " :lua require('core.utils').close_buffer() ") + map("t", term_maps.esc_hide_termmode, "lua require('nvchad.terminal').hide() ") -- pick a hidden term map("n", term_maps.pick_term, ":Telescope terms ") -- Open terminals -- TODO this opens on top of an existing vert/hori term, fixme - map("n", term_maps.new_horizontal, ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert ") - map("n", term_maps.new_vertical, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert ") - map("n", term_maps.new_window, ":execute 'terminal' | let b:term_type = 'wind' | startinsert ") + map( + { "n", "t" }, + term_maps.new_horizontal, + "lua require('nvchad.terminal').new_or_toggle('horizontal', " + .. tostring(terminal_options.window.split_height) + .. ")" + ) + map( + { "n", "t" }, + term_maps.new_vertical, + "lua require('nvchad.terminal').new_or_toggle('vertical', " + .. tostring(terminal_options.window.vsplit_width) + .. ")" + ) + --map("n", term_maps.new_window, "") not supported yet -- terminal mappings end -- -- Add Packer commands because we are not loading it at startup diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index eb7ac59..25e7989 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -8,7 +8,6 @@ end local override_req = require("core.utils").override_req local plugins = { - { "NvChad/extensions" }, { "nvim-lua/plenary.nvim" }, { "lewis6991/impatient.nvim" }, { "nathom/filetype.nvim" }, @@ -18,6 +17,13 @@ local plugins = { event = "VimEnter", }, + { + "NvChad/extensions", + config = function () + vim.schedule_wrap(require("nvchad.terminal").init()) + end + }, + { "NvChad/nvim-base16.lua", after = "packer.nvim",