Skip to content

Commit 3c1def1

Browse files
Merge pull request #15 from williamjameshandley/visual_selection
Send only visually selected text
2 parents ce77368 + 308f7f3 commit 3c1def1

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Vimteractive
33
============
44
:vimteractive: send commands from text files to interactive programs via vim
55
:Author: Will Handley
6-
:Version: 2.0.2
6+
:Version: 2.1.0
77
:Homepage: https://github.com/williamjameshandley/vimteractive
88
:Documentation: ``:help vimteractive``
99

@@ -156,8 +156,7 @@ cursor the terminal.
156156
In Insert mode, ``CTRL-S`` sends the line currently being edited, and
157157
then returns to insert mode at the same location.
158158

159-
In Visual mode, ``CTRL-S`` sends all currently selected lines to the
160-
terminal.
159+
In Visual mode, ``CTRL-S`` sends the current selection to the terminal.
161160

162161
``ALT-S`` sends all lines from the start to the current line.
163162

@@ -219,6 +218,7 @@ Similar projects
219218

220219
Changelist
221220
----------
221+
:v2.1: `Visual selection improvement <https://github.com/williamjameshandley/vimteractive/pull/15>`__
222222
:v2.0: `Multiple terminal functionality <https://github.com/williamjameshandley/vimteractive/pull/9>`__
223223
:v1.7: `Autodetection of terminals <https://github.com/williamjameshandley/vimteractive/pull/5>`__
224224
:v1.6: CtrlP `bugfix <https://github.com/williamjameshandley/vimteractive/pull/4>`__

autoload/vimteractive.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ function! vimteractive#sendlines(lines)
8989

9090
mark`
9191
if get(g:vimteractive_bracketed_paste, l:term_type, 1)
92-
call term_sendkeys(b:vimteractive_connected_term,"[200~" . join(a:lines, "\n") . "[201~\n")
92+
call term_sendkeys(b:vimteractive_connected_term,"[200~" . a:lines . "[201~\n")
9393
else
94-
call term_sendkeys(b:vimteractive_connected_term, join(a:lines, "\n") . "\n")
94+
call term_sendkeys(b:vimteractive_connected_term, a:lines . "\n")
9595
endif
9696
endfunction
9797

doc/vimteractive.txt

+8-10
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ Vimteractive was inspired by the workflow of the vim-ipython plugin:
1919

2020
https://github.com/ivanov/vim-ipython
2121

22-
This plugin is designed to extend a subset of the functionality of vimteractive
23-
to other interpreters (including ipython). This plugin is designed to extend a
24-
subset of the functionality of vim-ipython to other interpreters (including
25-
ipython). It is based around the unix philosophy of "do one thing and do it
26-
well". It aims to provide a robust and simple link between text files and
27-
interactive interpreters. Vimteractive will never aim to do things like
28-
autocompletion, leaving that to other, more developed tools such as
29-
YouCompleteMe.
22+
This plugin is designed to extend a subset of the functionality of vim-ipython
23+
to other interpreters (including ipython). It is based around the unix
24+
philosophy of "do one thing and do it well". It aims to provide a robust and
25+
simple link between text files and interactive interpreters. Vimteractive will
26+
never aim to do things like autocompletion, leaving that to other, more
27+
developed tools such as YouCompleteMe.
3028

3129
The activating commands are
3230
- ipython |:Iipython|
@@ -121,7 +119,7 @@ the terminal.
121119
In |Insert-mode|, CTRL-S sends the line currently being edited, and then
122120
returns to insert mode at the same location.
123121

124-
In |Visual-mode|, CTRL-S sends all currently selected lines to the terminal.
122+
In |Visual-mode|, CTRL-S sends the current selection to the terminal.
125123

126124
ALT-S sends all lines from the start to the current line.
127125

@@ -132,7 +130,7 @@ create one for you using |:Iterm|.
132130
3. Connecting to existing REPLs *:Iconn* *vimteractive-connecting*
133131
:Iconn [{buffer}] Connect current buffer to REPL in {buffer}. You can
134132
connect any number of buffers to one REPL. {buffer}
135-
can be omited if there is only one terminal.
133+
can be omitted if there is only one terminal.
136134

137135
==============================================================================
138136
4. Extending functionality *vimteractive-extending*

plugin/vimteractive.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ endif
7272
" ===================
7373

7474
" Control-S in normal mode to send current line
75-
noremap <silent> <C-s> :call vimteractive#sendlines([getline('.')])<CR>
75+
noremap <silent> <C-s> :call vimteractive#sendlines(getline('.'))<CR>
7676
7777
" Control-S in insert mode to send current line
78-
inoremap <silent> <C-s> <Esc>:call vimteractive#sendlines([getline('.')])<CR>a
78+
inoremap <silent> <C-s> <Esc>:call vimteractive#sendlines(getline('.'))<CR>a
7979
8080
" Control-S in visual mode to send multiple lines
81-
vnoremap <silent> <C-s> <Esc>:call vimteractive#sendlines(getline("'<","'>"))<CR>
81+
vnoremap <silent> <C-s> <Esc>:call vimteractive#sendlines(getreg('*'))<CR>
8282
8383
" Alt-S in normal mode to send all lines up to this point
84-
noremap <silent> <A-s> :call vimteractive#sendlines(getline(1,'.'))<CR>
84+
noremap <silent> <A-s> :call vimteractive#sendlines(join(getline(1,'.'), "\n"))<CR>

0 commit comments

Comments
 (0)