From 5de8b0dde156730f165301439b059cc0091c8cd5 Mon Sep 17 00:00:00 2001 From: Fazilov Kamil Date: Sat, 20 Mar 2021 14:58:18 +0300 Subject: [PATCH] Add support for terminal in default Vim --- README.md | 2 +- plugin/ez-window.vim | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba6a930..ec48431 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ How to use - Use default `` keys to adjust the split size. - `` to finish. -3. Open Terminal *(only for NeoVim users)*: +3. Open Terminal: - `` to *open / close* terminal. - Use default `` mapping to return to normal mode inside terminal split. diff --git a/plugin/ez-window.vim b/plugin/ez-window.vim index ab91ed0..de67221 100644 --- a/plugin/ez-window.vim +++ b/plugin/ez-window.vim @@ -54,7 +54,18 @@ function! s:NewTerminal() normal i endif else - echo "Sorry, you are not a 'NeoVim' user ;(" + if exists('t:terminal_buffer') + if (bufwinid(t:terminal_buffer) > 0) + exe "bd! " . t:terminal_buffer + unlet t:terminal_buffer + else + botright terminal ++rows=10 + let t:terminal_buffer = bufnr() + endif + else + botright terminal ++rows=10 + let t:terminal_buffer = bufnr() + endif endif endfunction