kassio / neoterm

Wrapper of some vim/neovim's :terminal functions.
Other
1.32k stars 117 forks source link

auto-scroll to the bottom when running command #134

Closed petobens closed 7 years ago

petobens commented 7 years ago

Consider the following init.vim file:

set nocompatible

let $DOTVIM = expand('$HOME/.vim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/kassio/neoterm
filetype plugin indent on

let g:neoterm_size = 10
let g:neoterm_autoinsert = 0

now open vim and edit the following foo.py file:

for i in range(100):
    print(i)

Once in the file run :T python3 foo.py. You will see that the terminal only shows numbers until 7, ideally i would expect it to scroll the bottom (i.e updating the terminal buffer as new numbers are printed until the last number is reached). Thanks in advance!

petobens commented 7 years ago

@kassio thanks! However when I use let g:neoterm_autoscroll = 1 I get the following error

Error detected while processing function <SNR>150_RunPython[70]..neoterm#do[2]..neoterm#exec[2]..118[3]..115:
line    3:
E490: No fold found
justinmk commented 7 years ago

Note that :term in Nvim 0.2 (unreleased, current master) should do this automatically if the most-recent cursor position in the buffer was the last line.

kassio commented 7 years ago

@justinmk thank's for the update, that's great news!

kassio commented 7 years ago

@petobens have you tried this with that init.vim? I tried on my machine and wasn't able to replicate this error.

petobens commented 7 years ago

@kassio I can reproduce it with:

set nocompatible

let $DOTVIM = expand('$HOME/.vim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/kassio/neoterm
filetype plugin indent on

let g:neoterm_size = 10
let g:neoterm_autoinsert = 0
let g:neoterm_autoscroll = 1

nnoremap <silent> G Gzo$

I believe that adding a something similar to normal!G in your commit will fix my issue.

kassio commented 7 years ago

neoterm

petobens commented 7 years ago

@kassio please add nnoremap <silent> G Gzo$ to your init.vim file. BTW: what do you use to record such a great gif?

kassio commented 7 years ago

@petobens got it now, it's fixed. I used Licecap for the gif recording. 😄

petobens commented 7 years ago

Great. Thank you!