From 306c74eddb46b8d7096c7f7c33d47816a7452d99 Mon Sep 17 00:00:00 2001 From: Will Handley Date: Fri, 13 Dec 2019 09:24:38 +0000 Subject: [PATCH] Added ability to have vertical terminals (#21) * Added ability to have vertical terminals * Corrected comment lines * Updated changelog --- README.rst | 12 +++++++++++- autoload/vimteractive.vim | 6 ++++-- doc/vimteractive.txt | 11 ++++++++++- plugin/vimteractive.vim | 6 ++++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 664ef27..065a2ef 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ Vimteractive ============ :vimteractive: send commands from text files to interactive programs via vim :Author: Will Handley -:Version: 2.1.0 +:Version: 2.2.0 :Homepage: https://github.com/williamjameshandley/vimteractive :Documentation: ``:help vimteractive`` @@ -160,6 +160,15 @@ In Visual mode, ``CTRL-S`` sends the current selection to the terminal. ``ALT-S`` sends all lines from the start to the current line. +Options +~~~~~~~ +These options can be put in your ``.vimrc``, or run manually as desired: + +.. code:: vim + + let g:vimteractive_vertical = 1 " Vertically split terminals + let g:vimteractive_autostart = 0 " Don't start terminals by default + Extending functionality ----------------------- @@ -218,6 +227,7 @@ Similar projects Changelist ---------- +:v2.2: `Vertical splitting option `__ :v2.1: `Visual selection improvement `__ :v2.0: `Multiple terminal functionality `__ :v1.7: `Autodetection of terminals `__ diff --git a/autoload/vimteractive.vim b/autoload/vimteractive.vim index 2652156..8f2da8c 100644 --- a/autoload/vimteractive.vim +++ b/autoload/vimteractive.vim @@ -124,13 +124,15 @@ function! vimteractive#term_start(term_type) if v:version < 801 call term_start(l:term_command, { \ "term_name": l:term_bufname, - \ "term_finish": "close" + \ "term_finish": "close", + \ "vertical": g:vimteractive_vertical \ }) else call term_start(l:term_command, { \ "term_name": l:term_bufname, \ "term_kill": "term", - \ "term_finish": "close" + \ "term_finish": "close", + \ "vertical": g:vimteractive_vertical \ }) endif diff --git a/doc/vimteractive.txt b/doc/vimteractive.txt index 5cb4000..27aa09f 100644 --- a/doc/vimteractive.txt +++ b/doc/vimteractive.txt @@ -132,6 +132,15 @@ create one for you using |:Iterm|. connect any number of buffers to one REPL. {buffer} can be omitted if there is only one terminal. +============================================================================== +3. Vimteractive options *vimteractive-options* + +These options can be put in your |.vimrc|, or run manually as desired: + + let g:vimteractive_vertical = 1 " Vertically split terminals + let g:vimteractive_autostart = 0 " Don't start terminals by default + + ============================================================================== 4. Extending functionality *vimteractive-extending* @@ -159,7 +168,7 @@ milliseconds like this: This project is very much in an alpha phase, so if you have any issues that arise on your system, feel free to contact me: - williamjameshandley@gmail.com. + williamjameshandley@gmail.com ============================================================================== 5. About *vimteractive-functionality* diff --git a/plugin/vimteractive.vim b/plugin/vimteractive.vim index ef078cb..9666e66 100644 --- a/plugin/vimteractive.vim +++ b/plugin/vimteractive.vim @@ -14,11 +14,17 @@ if !has_key(g:, 'vimteractive_autostart') let g:vimteractive_autostart = 1 endif +" Start in a horizontal terminal by default +if !has_key(g:, 'vimteractive_vertical') + let g:vimteractive_vertical = 0 +endif + " Variables for running the various sessions if !has_key(g:, 'vimteractive_commands') let g:vimteractive_commands = { } endif + let g:vimteractive_commands.ipython = 'ipython --matplotlib --no-autoindent' let g:vimteractive_commands.ipython2 = 'ipython2 --matplotlib --no-autoindent' let g:vimteractive_commands.ipython3 = 'ipython3 --matplotlib --no-autoindent'