From 9da534148d8b533637ccea94ad0510ea41770acb Mon Sep 17 00:00:00 2001 From: siduck Date: Fri, 13 May 2022 16:03:13 +0530 Subject: avoid mapping by default fix https://github.com/NvChad/NvChad/issues/1071 --- README.md | 58 +++++++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index dd06473..5a13c6e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ -# NvChad Official Terminal Plugin +# NvChad terminal Plugin -## Setup +## Install -### Installation +- Simply install the plugin with packer as you would for any other: -Simply install the plugin with packer as you would for any other: - -``` +```lua use { "NvChad/nvterm", config = function () @@ -16,8 +14,9 @@ use { ``` ### Configuration -Pass a table of configuration options to the plugin's `.setup()` function above. -A sample configuration table with the default options is shown below: + +- Pass a table of configuration options to the plugin's `.setup()` function above. +- Default configuration table ```lua require("nvterm").setup({ @@ -40,26 +39,9 @@ require("nvterm").setup({ close_on_exit = true, auto_insert = true, }, - mappings = { - toggle = { - float = "", - horizontal = "", - vertical = "", - }, - new = { - horizontal = "", - vertical = "", - }, - }, - enable_new_mappings = false, }) ``` -``` -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 = { @@ -72,11 +54,6 @@ require("nvterm").setup({ }, horizontal = { location = "rightbelow", split_ratio = .3, }, vertical = { location = "rightbelow", split_ratio = .5 }, - mappings{ - toggle { - horizontal = "" - } - } }) ``` @@ -104,9 +81,29 @@ require("nvterm").setup({ }) ``` +### Functions + +Use the below functions to map them for keybindings + +#### Toggle + +```lua +require("nvterm.terminal").toggle "float" +require("nvterm.terminal").toggle "horizontal" +require("nvterm.terminal").toggle "vertical" +``` + +#### Spawn new terminals + +```lua +require("nvterm.terminal").new "horizontal" +require("nvterm.terminal").new "vertical" +``` + ### Additional Functionality NvTerm provides an api for you to send commands to the terminal. You can create different ones for different filetypes like so: + ```lua require("nvterm").setup() @@ -131,4 +128,3 @@ end `terminal.send` also takes a 'type' parameter, so you can choose what type of terminal to send the command to. By default, it runs the command in the last opened terminal, or a vertical one if none exist. `terminal.send(ft_cmds[vim.bo.filetype], "float")` will run the command in a floating terminal - -- cgit v1.2.3-70-g09d2