From 8c435a2cf81365d1fcc8628133f83d482a333c82 Mon Sep 17 00:00:00 2001 From: zbirenbaum Date: Mon, 25 Apr 2022 04:39:51 -0400 Subject: finish shortcut method and update readme --- README.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index c1188f8..dd06473 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,21 @@ require("nvterm").setup({ float = "", horizontal = "", vertical = "", - } - } + }, + new = { + horizontal = "", + vertical = "", + }, + }, + enable_new_mappings = false, }) ``` -A shortcut is available for setting options of the different terminal types: + +``` +By default, the mappings for creating a new terminal rather than toggling the current one are disabled. +If `enable_new_mappings` is set to true, `new` will be set to any mappings passed in the configuration table under `new` or the defaults. +``` +A shortcut is available for setting options of the different terminal types and mappings: ```lua require("nvterm").setup({ float = { @@ -62,6 +72,11 @@ require("nvterm").setup({ }, horizontal = { location = "rightbelow", split_ratio = .3, }, vertical = { location = "rightbelow", split_ratio = .5 }, + mappings{ + toggle { + horizontal = "" + } + } }) ``` @@ -81,8 +96,11 @@ require("nvterm").setup({ }, horizontal = { location = "rightbelow", split_ratio = .3, }, vertical = { location = "rightbelow", split_ratio = .5 }, - } - } + }, + }, + toggle { + horizontal = "", + }, }) ``` @@ -101,8 +119,8 @@ local ft_cmds = { } local mappings = { { 'n', '', function () terminal.send(ft_cmds[vim.bo.filetype]) end }, - { 'n', 's', function () terminal.new_or_toggle('horizontal') end }, - { 'n', 'v', function () terminal.new_or_toggle('vertical') end }, + { 'n', 's', function () terminal.toggle('horizontal') end }, + { 'n', 'v', function () terminal.toggle('vertical') end }, } local opts = { noremap = true, silent = true } for _, mapping in ipairs(mappings) do -- cgit v1.2.3-70-g09d2