Giter VIP home page Giter VIP logo

neoterm's People

Contributors

aitoratuin avatar alok avatar ararslan avatar bitboxer avatar dajvido avatar echasnovski avatar fokoid avatar hiberabyss avatar hituzi-no-sippo avatar icholy avatar jgreco avatar kassio avatar leonardt avatar majjoha avatar mbudde avatar mrichards42 avatar njichev avatar npbee avatar pcaneill avatar randy3k avatar richchurcher avatar stephanvd avatar stsewd avatar tdy avatar tokubara avatar tomasv avatar ukuloskit avatar vhakulinen avatar will avatar wodesuck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neoterm's Issues

Sending two commands in succession

Hi, I'm having a little issue with neoterm.
I just installed it, and tried running ":T ls". It worked ok, opening a split with a terminal and running "ls".
Then, I tried it again, with the terminal still open. It writes "ls", but the command doesn't run. It keeps waiting for a Enter keypress. Doing ":T ls" again only writes "ls" once again, resulting in "lsls".

I tried looking at the plugin code a little bit and found this call on the neoterm#do function:
call neoterm#exec([command, ""])
And this one on neoterm#exec function:
call jobsend(g:neoterm_terminal_jid, a:list)

I tried calling manually that funcion with a neoterm split open, like this:
:call jobsend(g:neoterm_terminal_jid, ["ls", ""])
And the same problem happened. I looked at jobsend docs and it says that:

        If {data} is a list, the items will be separated by newlines and
        any newlines in an item will be sent as a NUL. A final newline
        can be sent by adding a final empty string. For example: >
            :call jobsend(j, ["abc", "123\n456", ""])
        will send "abc<NL>123<NUL>456<NL>".

Which means it should work, right? But it doesn't :(
Trying to append \r doesn't work either.

Any ideas on what is happening?

Thanks!

E154: Duplicate tag is thrown when opening neovim

I tried neoterm today and after a

cd .vim/bundle
git clone neoterm
nvim toto

I have the following error:

E154: Duplicate tag "neoterm-commands" in file /home/caneill/.vim/bundle/neoterm/doc/neoterm.txt
E154: Duplicate tag "neoterm-functions" in file /home/caneill/.vim/bundle/neoterm/doc/neoterm.txt
E154: Duplicate tag "neoterm-intro" in file /home/caneill/.vim/bundle/neoterm/doc/neoterm.txt
E154: Duplicate tag "neoterm-options" in file /home/caneill/.vim/bundle/neoterm/doc/neoterm.txt
E154: Duplicate tag "neoterm-what-is-neoterm" in file /home/caneill/.vim/bundle/neoterm/doc/neoterm.txt

Do you have any ideas why I get the following errors?

Segmentation fault

Hi!

When I'm in a Rails project and I run :T bundle exec rake test Neovim dies with a segmentation fault.
[1] + 43166 segmentation fault nvim

Running latest Neovim and latest Neoterm.

Could this be an issue with Neoterm or is it more likeliy an issue with Neovim itself?

Maintain a seperate process for REPL

First off: been loving using Neoterm the last couple days, thanks!

It would be a good addition, in my opinion, to have the repl interaction commands spawn a separate shell process that runs the repl. This could behave in the same manner as the existing :T* commands, reusing the same process when it's referenced on different tabs. This would allow us to do things the maintain an open repl while still running tests in a different buffer. Perhaps a useful generalization would to be to have existing :T* commands, or a new command entirely, run the command on a named terminal process.
I.e.
:T 1 mix test
:T 2 iex -S mix
resulting in two splits, with separate shell processes, running the respective command.

How I can test status line feature?

let g:neoterm_size = '50'
let g:neoterm_position = 'vertical'
let g:neoterm_keep_term_open = 1
let g:neoterm_run_tests_bg = 1
let g:neoterm_raise_when_tests_fail = 1

This is my neoterm configuration.

I am trying to test statusline with command: :set statusline=%s but I am receiving an error: E539: Illegal character <s>: statusline=%s\

Error on startup

Started happening after upgrading today. This is against neovim/master.

Error detected while processing /Users/rgrinberg/.vim/plugged/neoterm/plugin/neoterm.vim:
line   28:
E216: No such group or event: TermOpen * let g:neoterm_terminal_jid = b:terminal_job_id
line   29:
E216: No such group or event: TermOpen * let g:neoterm_buffer_id = bufnr('%')
line   30:
E216: No such group or event: TermOpen * setlocal nonumber norelativenumber
Press ENTER or type command to continue

Issue with IPython's magic commands

IPython provides a set of useful magic commands such as % reset or % run. With these, I can keep the terminal buffer open, rerun my current script, and investigate the variables when I feel like it.

function! s:RunIPython()
  if g:neoterm.has_any()
    silent! T %reset -f
  else
    silent! T ipython -i --no-banner --no-confirm-exit --quick --quiet
  endif
  let cmd = '%run '.expand('%')
  silent! call neoterm#do(cmd)
endfunction

command! RunIPython call s:RunIPython()
autocmd FileType python nnoremap <Leader>r :RunIPython<cr>

Here I need to be able to forward the % character to IPython, however it is expanded in neoterm. Is there a way to avoid that expansion?

Unknown function: neoterm#rspec

When I call neoterm#test#run('file') the following errors are shown:

Error detected while processing function neoterm#test#run:
line 2:
E117: Unknown function: neoterm#rspec
E15: Invalid expression: g:neoterm_clear_cmd . ';' . Fn(a:scope)

I have the following in my .nvimrc:

nnoremap <silent> <f9> :call neoterm#repl#line()<cr>
vnoremap <silent> <f9> :call neoterm#repl#selection()<cr>

" run set test lib
nnoremap <silent> ,rt :call neoterm#test#run('all')<cr>
nnoremap <silent> ,rf :call neoterm#test#run('file')<cr>
nnoremap <silent> ,rn :call neoterm#test#run('current')<cr>
nnoremap <silent> ,rr :call neoterm#test#rerun()<cr>

" Useful maps
" closes the all terminal buffers
nnoremap <silent> ,tc :call neoterm#close_all()<cr>
" clear terminal
nnoremap <silent> ,tl :call neoterm#clear()<cr>

Any thoughts on what I'm missing?

Add option to specify buffer width / height

I would like to specify initial buffer width / height when new buffer is created.

It could be like:

let g:neoterm_vertical_size = 80

which would result into something like:

vertical resize 80

after creating vertical term buffer.

P.S.

I tried to change it myself and send PR but could not figure out where to make the change.
Probably my vimscript skills is too low yet ๐Ÿ˜ž

[Feature Request] Implement support for some python repl's

I really love neoterm, but I would love to be able to use the TREPL* commands with python files.

My attempts involved:
aug neoterm_python_repl
au VimEnter,BufRead,BufNewFile *.py,
\ if executable('python') |
\ call neoterm#repl#set('python') |
\ elseif executable('ipython') |
\ call neoterm#repl#set('ipython') |
\ end
aug END

in a file at ~/.nvim/plugged/neoterm/ftdetect/python_repl.vim

and setting let g:neoterm_repl_command = 'ipython'
within my .nvimrc. I'm still learning vimscript, but I'd love to get this as a full fledged feature.

Switching from/to Neoterm split

When there is a neoterm controlled terminal split open, switching to it and from it causes a new buffer to open up leading to a bunch of empty buffers.

Turn off IPython autoindent on submit

Currently the default Python REPL for neoterm is IPython. IPython has autoindentation turned on by default. The documentation even provides the following warning:

Autoindent is ON by default, but it can cause problems with the pasting of multi-line indented code (the pasted code gets re-indented on each line). A magic function %autoindent allows you to toggle it on/off at runtime. You can also disable it permanently on in your ipython_config.py file (set TerminalInteractiveShell.autoindent=False).
If you want to paste multiple lines in the terminal, it is recommended that you use %paste.

I've run into this problem with neoterm and IPython, where I get indentation errors due to IPython's autoindent. Perhaps it would be good to either

  1. Use %paste or %cpaste when sending Python code to IPython via neoterm, or
  2. Toggle %autoindent before sending any code.

I'm not sure how the former would work in practice, but I've done some testing with the latter and that solves the indentation errors that I've gotten.

Handling IPython's oddities gracefully like this might be a good enhancement to the plugin.

Option to override test command

I am using rspec with bundler and sometimes I want to run tests with spring, so it would be nice to have an option to change it.

Function test_runner doesnt exists

I am trying to add a test runner for rust, but the neoterm#test#runner function mentioned in the README doesn't seem to exists.
I don't know what I'm doing wrong but here's what vim says:

neoterm#test_runner('all')
E117: Unknown function: neoterm#test_runner

Allow setting shell

I personally use fish but many of the older vim plugins I use require me to use bash. So I do have the line

set shell=/bin/bash

but when I shell out to neoterm I would like to use fish. Is there a g:neoterm_shell variable somewhere?

Add cucumber

When I am in a .feature File I would love to see it running the cucumber command. What do I have to change to implement this?

Tests not running in background

I'm trying to copy the ability to display test results in the statusline from rspec to cargo.
I've written the following function (probably doesn't work as I couldn't test it yet):

function! neoterm#test#cargo#result_handler(line)
  let compile_errors = matchlist(
        \ a:line,
        \ 'error: aborting due to \(\d\+ \)\=previous errors\='
        \ )

  let test_failures = matchlist(
        \ a:line,
        \ 'test result: FAILED. \(\d\+\) passed; \(\d\+\) failed; \(\d\+\) ignored; \(\d\+\) measured'
        \ )

  if !empty(compile_errors) && !empty(test_failures)
    let g:neoterm_statusline = g:neoterm_test_status.failed
  else
    let g:neoterm_statusline = g:neoterm_test_status.success
  end
endfunction

But despite my settings (below) when I execute call neoterm#test#run('all'), neoterm opens a terminal (doesn't run the tests in background, doesn't show anything in the statusline).
What am I doing wrong?

My neoterm specific settings:

let g:neoterm_size = 15
let g:neoterm_keep_term_open = 1
let g:run_tests_bg = 1
let g:raise_when_tests_fail = 1
set statusline+=%#NeotermTestRunning#%{neoterm#test#status('running')}%*
set statusline+=%#NeotermTestSuccess#%{neoterm#test#status('success')}%*
set statusline+=%#NeotermTestFailed#%{neoterm#test#status('failed')}%*

Edit: Now I spottet an [running] and [success] once, but I can't reproduce it.

Undefined variable: g:neoterm_terminal_jid

After rebuilding neovim this morning from the latest version and updating neoterm, I'm getting the following error when I run call neoterm#test#run('current')

Error detected while processing function neoterm#test#run..<SNR>152_run..neoterm#exec:
line    4:
E121: Undefined variable: g:neoterm_terminal_jid
E116: Invalid arguments for function jobsend

neoterm does open the terminal window, but does nothing in it. If I leave the terminal window open and run the command again I get the same error and a second terminal window opens.

Neoterm IDs renumbering

Hi,

thanks for a great plugin. I've just noticed that Neoterm does not recalculate IDs after terminals have been :Tclosed. This is similar to what Tmux does with its windows, but it does provide an option to renumber (set-option -g renumber-windows on). Do you think it's feasible to have it implemented in Neoterm as well?

I could send a PR for this.

Thanks!

Setting Vertical Terminal

I added the command below to my nvimrc but I still get a horizontal split - How do I make a vertical split?

let g:neoterm_position='vertical'

Some oddities with FZF

So if I have just run a test and then I open a file using FZF it stops working as well. The error messaging is as follows

Error detected while processing function neoterm#test#rerun..neoterm#exec..<SNR>122_open_terminal_cmd:
line   10:
E86: Buffer 29 does not exist
Error detected while processing function neoterm#test#rerun..neoterm#exec:
line    3:
E900: Invalid job id

This is fixed if go into the test buffer, run exit in the terminal and then closing it out. I'm able to launch it again.

Not fails on not rspec errors

Hi, I just noticed that when my test fails because of error like below

cannot load such file -- ./lib/pull_down_links

Neoterm not trigger failure state but just stays on running.

Add toggle command

A command to toggle (open/close) term buffer that will be nice to have.

Expanding arguments to :T

I'm trying to cd to the current directory, but the path is not expanding correctly.

:T cd %:h:p
:T cd expand('%:h:p')

I've tried messing around with neoterm#expand_cmd but my VimScript chops aren't that good.

Edit: I added a special case to expand it

" Internal: Expands "%" in commands to current file full path.
function! neoterm#expand_cmd(command)
  let command = substitute(a:command, '%:p:h', expand('%:p:h'), 'g')
  return substitute(command, '%', expand('%:p'), 'g')
endfunction

I'm thinking there must be a cleaner way to do this.

Add option or change default to use relative paths

We run a virtualized setup for our development environment, mounting the repo dir inside the VM and running specs there, to be able to use neoterm to run the specs inside the vm I had to modify the path-generation to use only % instead of %:p, it would be nice if this was an option in the actual plugin.

no test lib set

Just updated to the latest version, but somehow I did something wrong. I get a No test lib set when using rspec. The ftdetect somehow fails to insert the the test lib. When I add it manually via :call neoterm#test#libs#add('rspec'), it works

What did I do wrong? What can I do to pinpoint the problem?

Running RSpec doesn't work unless `bundle exec rspec` is from root directory

I noticed an odd issue, when trying neoterm (in addition to #7). This doesn't really seem to be neoterm's fault, although I guess neoterm could try to accommodate for it.

With RSpec, bundle exec rspec must be ran from the Rails root directory, otherwise the command won't work as expected. I had tried this on an existing and new rails project (as I thought I had some odd absolute path hardcoded). I even had a another friend try it out with similar results. I could still be wrong, if there is a better way to have bundle exec rspec work from any sub-directory in a rails project. I'm curious on how other have gotten this to work for their own rails projects?


To set up a new Rails project to reproduce this:

ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
bundle Rails 4.2.0
Bundler version 1.9.6

Create new Rails application with no TestUnit
rails new my_awesome_app -T

Change Directory to Rails application
cd my_awesome_app

Add RSpec to Gemfile
gem 'rspec-rails'

Update gems (to include new RSpec gem)
bundle install

Setup/Install RSpec
rails g rspec:install

Create simple spec under touch ./spec/test_spec.rb

RSpec.describe "test" do
  it { expect(1).to eq(1) }
end

Run bundle exec rspec from Rails application root directory
1 example, 0 failures

Run bundle exec rspec from ./spec directory
0 examples, 0 failures

Plugin uses RSpec when Minitest is intended

First of all thank you for creating this plugin. It's a huge improvement to my workflow.

I have a project that uses Minitest for unit tests and RSpec for integration tests.

When I try to use this plugin, it always uses RSpec, even when I'm calling it from a Minitest buffer.

Is there a way to determine the test-runner command using the filetype of the current buffer?

neoterm#repl#selection sends lines instead of selection

Selecting a portion of a line in visual mode then invoking TREPLSend sends the whole line to the terminal instead of just the selection. Is this intended?

I was thinking that one could send lines with visual line mode, so having visual mode send only the selection might be more flexible. It would also allow better composition in mappings, e.g. nnoremap <leader>aa vib:TREPLSend<cr>.

Can no longer run tests after close_all

Steps to reproduce:

  1. Open up file and :call neoterm#test#run('file')
  2. call neoterm#close_all()
  3. call neoterm#test#run('file')

And I'm met with the following error

Error detected while processing function neoterm#test#run..neoterm#exec..<SNR>126_open_terminal_cmd:
line   10:
E16: Invalid range: botright 15 sbuffer 2 

Closing terminal gives error when I try to open it after

I open a term with :TREPLSendFile and then close it later with :q. When I try to run TREPLSendFile again, I get the following error:

Error detected while processing function neoterm#repl#selection[14]..<SNR>266_repl_exec:
line    6:
E716: Key not present in Dictionary: repl.instance().exec(add(a:command, ""))

close_all unknown function

I mapped the close_all() function to a mapping but when I try to run it, it claims that it is an unknown function.

Errors on close if :T exit was sent before :Tclose

If I go into NeoVim with neoterm loaded, enter :Tnew, then :T exit, followed by :Tclose, I get the following error:

screen shot 2016-03-04 at 5 16 33 pm

From here, it seems the terminal refuses to close; the split remains open after pressing enter. To close it, I have to manually <C-w>ji<cr>.

Using termopen

I have noticed in neoterm that all commands when they are first run initiate a new shell then send the command text to the shell. This leaves extra output in the shell, and spawns an unneccesary process which you also have to quit when finished.

Do you this it would be possible to use termopen() with the command instead? This would avoid starting a shell everytime, and is a rather clean way of doing things IMO.

Here is how I am currently accomplishing what I am referring to.

autocmd FileType python
      \ let b:termy = executable('ipython') ? 'ipython -i %' : 'python -i %'
autocmd FileType ruby
      \ let b:termy = executable('pry') ? 'pry -r %:p' : 'irb -r %:p"'
autocmd FileType scala
      \ let b:termy = 'sbt console'
autocmd FileType javascript
      \ let b:termy = 'node'

function! Termy(cmd)
  let command = substitute(command, '%', expand('%:p'), 'g')
  :vnew | call termopen(command) | startinsert
endfunction

[question] issue when closing split/terminal

Hi,

when I run a test (rspec) with neoterm#test#run('file'), a new split is created and the test runs in this new split. If I close this split and rerun the test nothing happens, I would expect a new split with a new term. I have to relaunch nvim to get the test run again. Is this the desired behavior?

thanks

Teo

test go package using 'file' scope

'all' and 'current' work well, but 'file' scope arguably doesn't make sense in the go world. It would be nice to hijack 'file' scope and make it mean 'package' scope in a go project. I would expect something like

(cd $(dirname $current_buffer); go test)

my VimL skills are non-existent unfortunately :(, so for the time being I can only make requests.

Why I can't hide neoterm pane as default?

let g:neoterm_size = '50'
let g:neoterm_position = 'vertical'
let g:neoterm_keep_term_open = 0
let g:neoterm_run_tests_bg = 1
let g:neoterm_raise_when_tests_fail = 1

This is my neoterm configuration.

When I tried to run tests :T % neoterm pane has been opened but I thought with g:neoterm_run_tests_bg = 1 It will be hided and shows only when tests fail ?

Autoclose successful tests

Hi and thanks for this plugin โœจ
I'm wondering if it makes sense for you to change the default behavior of Neoterm.

When the tests are failing, the terminal should be left open. A key press or enter should close/hide it.

When the test command has a successful exit code, the terminal should be hidden/closed. This should internally call neoterm#close(). If the test suite is successful, there is "nothing to see" and we can move on.

What do you think?

If this doesn't makes sense for you, is there anything that I can do on my local setup to achieve this behavior? I tried with let g:neoterm_keep_term_open = 0 but it only gives the focus to the shell prompt instead of closing the terminal.

Thank you in advance for your time. ๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.