From 2cf415538d76ba297e06cfe8335d2bce47f0834f Mon Sep 17 00:00:00 2001 From: Gesting Date: Wed, 25 Nov 2020 16:28:37 +0100 Subject: [PATCH] Give option for vertical split refs #4 Also updated doc for this option --- doc/matlab-screen.txt | 4 ++++ ftplugin/matlab.vim | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/matlab-screen.txt b/doc/matlab-screen.txt index 8dcb1c8..8ba4ec4 100644 --- a/doc/matlab-screen.txt +++ b/doc/matlab-screen.txt @@ -23,6 +23,10 @@ CONFIGURATION *matlab-screen-configuration* * matlab terminal height, default: 10 > let g:matlab_screen_terminal_height = 10 +* the matlab terminal is split vertically and runs on the right. + In this case, the panes are of equal size. default: 0 > + let g:matlab_screen_vertical_terminal = 1 + * default shortcut & Function > vnoremap mr :call matlab#RunSelected() nnoremap mr :call matlab#RunCell() diff --git a/ftplugin/matlab.vim b/ftplugin/matlab.vim index 59d2ebe..1e65437 100644 --- a/ftplugin/matlab.vim +++ b/ftplugin/matlab.vim @@ -6,9 +6,15 @@ function matlab#Start() echom "Only one MATLAB process in current vim!" return endif - rightbelow let s:matlab_buf = - \term_start(g:matlab_term_cmd, - \{"term_finish" : "close", "term_rows": g:matlab_screen_terminal_height, "norestore" : 1 }) + if exists('g:matlab_screen_vertical_terminal') && g:matlab_screen_vertical_terminal == 1 + rightbelow let s:matlab_buf = + \term_start(g:matlab_term_cmd, + \{"term_finish" : "close", "vertical" : 1, "norestore" : 1 }) + else + rightbelow let s:matlab_buf = + \term_start(g:matlab_term_cmd, + \{"term_finish" : "close", "term_rows": g:matlab_screen_terminal_height, "norestore" : 1 }) + endif wincmd p endfunction