diff --git a/plugin/split-term.vim b/plugin/split-term.vim index 8396901..23dff4f 100644 --- a/plugin/split-term.vim +++ b/plugin/split-term.vim @@ -53,12 +53,23 @@ endf " Opens a new terminal buffer, but instead of doing so using 'enew' (same " window), it uses :vnew and :new instead. Usually, I want to open a new " terminal and not replace my current buffer. -fun! s:openTerm(args, count, vertical) - let params = split(a:args) +fun! s:openSplitTerm(args, count, vertical) let direction = s:force_vertical ? 1 : a:vertical call s:openBuffer(a:count, direction) + call s:openTerm(a:args) +endf + +" Opens a new terminal buffer, but instead of doing so using split buffer, it +" uses :tabnew instead. +fun! s:openTabTerm(args) + exe 'tabnew' + call s:openTerm(a:args) +endf +" Open a new terminal in the active buffer, while defining default mappings +" for this plugin. +fun! s:openTerm(args) let prevShell = &shell if exists('g:split_term_default_shell') exe 'set shell =' . s:default_shell @@ -75,5 +86,6 @@ fun! s:openTerm(args, count, vertical) endif endf -command! -count -nargs=* Term call s:openTerm(, , 0) -command! -count -nargs=* VTerm call s:openTerm(, , 1) +command! -count -nargs=* Term call s:openSplitTerm(, , 0) +command! -count -nargs=* VTerm call s:openSplitTerm(, , 1) +command! -nargs=* TTerm call s:openTabTerm() diff --git a/readme.md b/readme.md index 1eb9e04..5b37dd2 100644 --- a/readme.md +++ b/readme.md @@ -47,9 +47,11 @@ extracting the files in your `~/.vim` or `~/.config/nvim` directory. - **`:Term`** Opens a new terminal buffer using `:new` (splits horizontally) - **`:VTerm`** Opens a new terminal buffer using `:vnew` (splits vertically) +- **`:TTerm`** Opens a new terminal buffer using `:tabnew` (new tab) -Both commands accept a `` like their `:new`/`:vnew` counterparts. You -can prefix both commands with a number to specifiy the buffer height / width. +Both `:Term` and `:VTerm` commands accept a `` like their `:new`/`:vnew` +counterparts. You can prefix both commands with a number to specifiy the buffer +height / width. Similar to the original `:terminal`, both commands accepts any number of arguments. It can be used to spawn a cmd and see the result, or even start a