Skip to content

Commit

Permalink
Fixed pasting in ipython
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjameshandley committed Oct 12, 2018
1 parent 65d7bfe commit 955b5a2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ The activating commands are
Commands may be sent from a text file to the chosen terminal using `CTRL-S`.

## Installation
- Installation should be relatively painless via the usual routes such as [Vundle](https://github.com/VundleVim/Vundle.vim) or [Pathogen](https://github.com/tpope/vim-pathogen)
To use the key-bindings, you should first disable the `CTRL-S` default, which is a terminal command to freeze the output. You can disable this by putting
```bash
stty -ixon
```
into your `.bashrc`

Installation should be relatively painless via the usual routes such as [Vundle](https://github.com/VundleVim/Vundle.vim), [Pathogen](https://github.com/tpope/vim-pathogen) or the vim 8 native package manager (`:help packages`)

- If you're masochistic enough to use [Arch](https://wiki.archlinux.org/index.php/Arch_Linux)/[Manjaro](https://manjaro.org/), it is also installable via the [aur](https://aur.archlinux.org/packages/vim-vimteractive)
If you're masochistic enough to use [Arch](https://wiki.archlinux.org/index.php/Arch_Linux)/[Manjaro](https://manjaro.org/), it is also installable via the [aur](https://aur.archlinux.org/packages/vim-vimteractive)

- For old-school users, there is also a package on the [vim repo](https://www.vim.org/scripts/script.php?script_id=5687)
For old-school users, there is also a package on the [vim repo](https://www.vim.org/scripts/script.php?script_id=5687)


## Motivation
Expand Down Expand Up @@ -82,6 +88,8 @@ returns to insert mode at the same location.

In Visual mode, `CTRL-S` sends all currently selected lines to the terminal.

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

## Extending functionality
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](mailto:[email protected]).

Expand All @@ -97,3 +105,8 @@ If you want to add additional interpreters, in many cases, you simply need to ad

## To do
- [ ] shutdown & restart more cleanly

## Changelist
- v1.1 :
- [Bracketed paste](https://cirw.in/blog/bracketed-paste) seems to fix most of ipython issues.
- `ALT-S` sends all lines from start to current line.
1 change: 1 addition & 0 deletions doc/vimteractive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ returns to insert mode at the same location.

In |Visual-mode|, CTRL-S sends all currently selected lines to the terminal.

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

==============================================================================
3. Extending functionality *vimteractive-extending*
Expand Down
7 changes: 2 additions & 5 deletions plugin/vimteractive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ inoremap <silent> <C-s> <Esc>:call Vimteractive_sendline(getline('.'))<CR>a
vnoremap <silent> <C-s> <Esc>:call Vimteractive_sendlines(getline("'<","'>"))<CR>
" Alt-S in normal mode to send all lines up to this point
noremap <silent> <A-s> :call Vimteractive_sendlines(getline(1,"'>"))<CR>
noremap <silent> <A-s> :call Vimteractive_sendlines(getline(1,'.'))<CR>

" Plugin commands
Expand All @@ -51,10 +51,7 @@ endfunction

" Send list of lines one at a time to the terminal buffer
function! Vimteractive_sendlines(lines)
for l in a:lines
call Vimteractive_sendline(l)
call term_wait(g:vimteractive_buffer_name, "50m")
endfor
call term_sendkeys(g:vimteractive_buffer_name,"[200~" . join(a:lines, "\n") . "[201~\n")
endfunction

" Start a vimteractive session
Expand Down

0 comments on commit 955b5a2

Please sign in to comment.