Giter Site home page Giter Site logo

vimcmdline's People

Contributors

ahovgaard avatar alok avatar ayroblu avatar chee avatar dominik-schwabe avatar epwalsh avatar forbesmyester avatar gnebbia avatar ianliu avatar jalvesaq avatar kprimice avatar kudzuyu avatar memo33 avatar mizudera avatar nad2000 avatar petrushka avatar statquant 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

vimcmdline's Issues

unknown function chansend

I did a 'apt upgrade' and both my ubuntu 18.04 machine stop to work.
Showing error:

"Error detected while processing fuction RonJobStout[7].. SetNvimcomInfo[77]..JobStdin: line 1:
unknown function: chansend"

Would that be possible to have several cmdline_app per filetype and start interpreter differently per repl

Hello this is more a question

  1. Several cmdline_app per filetype

On some ft I'd like to be able to start different interpreters, would that be able to do ?
I was thinking about something like

let cmdline_ft['python-2'] = 'python' " python-2 will use everything python uses
let cmdline_app = {}
let cmdline_app['python'] = 'ptipython3'
let cmdline_app['python-2'] = 'somestuff'

  1. Can we start interpreter differently per repl (I guess that equivalent of cmdline_app for cmdline_map_start)

Kind regards

Discussion: `custom_app` branch

@jalvesaq @1o0ko

Feel free to close this/move to a more appropriate section, but I figured this would be the best place to discuss the commit to allow different REPLs.

It works for haskell, but (i)python support is broken. I suspect you will have to use paste mode (%cpaste), and you may want to see how vim-slime does it.

They have good handling for python but don't open the repl for you.

Line sent to Python REPL on Windows is not evaluated

When I send a line to the Python REPL (either plain python or ipython), the contents of the line is entered in the REPL, but they are not evaluated. In order to execute the command I have to go to the REPL and hit Enter.

This issue does not arise with the Julia REPL, which works as expected.

I'm using Neovim 0.3 on Windows 10.

Mapping colon to semi-colon causing vimcmdline commands to not work

I installed vimcmdline using Plug by placing the following line into my ~/.config/nvim/init.vim:

call plug#begin('~/.config/nvim/plugged')

Plug 'jalvesaq/vimcmdline'

call plug#end()

I was able to install the plugin. Loading up a test.sh file and then pressing <LocalLeader>s starts up my interpreter. But if add the following mapping:

call plug#begin('~/.config/nvim/plugged')

Plug 'jalvesaq/vimcmdline'

call plug#end()

" Swap ; and :
" Avoid needing to use <SHIFT> for Ex commands
" Only applies in 'normal' mode
" E.g. ;w! - Will save the file
nnoremap ; :
nnoremap : ;

The interpreter no longer starts. Clearly, the mapping of the colon to semicolon is having an adverse effect on starting the interpreter and other vimcmdline arguments. Is there a way to get around this? Interestingly, when I use Nvim-R I don't have this problem.

Support for Scala REPL?

While adding new supported languages/REPLs is known not to be a priority, are there any chances you could add support for the Scala REPL? (scala or amm)

The Scala REPLs have multi-line output, which is not handled that great by similar vim/nvim plug-ins, but as vimcmdline already supports Shells, it might be easier to add here?

Not an issue, but a question about this repo

Jakson, your Nvim-R and Colorout repos have been so valuable to me: thank you! Have been using both for a year+. I literally use both for 12+ hours a day. thank you

I was just poking around in the interior of colorout: wow, I had no idea how tricky that probably was...then I noticed this new repo....

My question is this: are you going to merge the Nvim-R behavior into vimcmdline in order to unify this neovim + terminal + REPL "pattern"? Just wondering if I should keep an eye on this, and also test it.

VIM 8 terminal

Is it possible to convert this plugin to work with vim 8 like NvimR does?

Matlab and source

call VimCmdLineSendCmd('source ("' . g:cmdline_tmp_dir . '/lines.m");')

I think source is an Octave only function. The equivalent Matlab function is run.
Changing source to run allows sending multiple lines in Matlab. Without this change it does not work for me.

Does vimcmdline supports multiple buffers ?

Hello, would that be easy to add multiple buffer support like for vim-r-plugin ?
When I open anyfile in tmux, then get a terminal then open another buffer the second buffer cannot send lines to the console (we can do that in vim-r-plugin)

Cannot start external terminal for python

Hi, I'm using Vim 8.1 with tmux. I have been using Nvim-R for a long while and found it very useful. Now hoping to make it work for Python, I installed and set up vimcmdline as instructed, by adding this line to my .vimrc:

let cmdline_external_term_cmd = "xterm -e '%s' &"

Then I opened an example.py file and pressed s (in my case it's \s), but there's no reaction and an external terminal was not opened.

:echo cmdline_tmuxsname has some value of 'vcl' plus a string of numbers assigned to 'python'; :echo cmdline_job has everything with 0 value. I'm not sure how to further debug this.

Could you please help with this? Thanks in advance.

[prolog] consult/1 file when opening REPL

Hi!

It would be nice to automatically consult the current file in the prolog REPL for testing the written code. You have to type consult('file.pl'). now everytime you want to open the repl for testing.

This option would be nice for every language, by the way.

Inheriting environment variable PATH from vim for conda virtual environment

I tried to use vimcmdline with conda, however it doesn't work due to the fact that the newly created python interpreter does not inherit the environment variable PATH from vim.

It works by appending /shared/conda/envs/environ_name to environment variable PATH.

So adding 'env PATH=' . $PATH when launching python through tmux should work.

ipython: only first line is sent

This issue occurs only with ipython.

When I select multiple lines with shift + v and send them to the Terminal with < space >, only the first line is pasted and executed.

Problems tmux and kitty as terminal

I use kitty as my terminal emulator, with Neovim as my editor. I typically use NVim-R for R code, which works perfectly. I just tried to get vimcmdline working to let me have a similar setup to play with Julia, but I'm running into errors.

vimcmdline works fine if I set my terminal to, say, xterm, but for some reason I'm getting errors (apparently related to the tmux configuration file) when I try the same in ktty.

With let cmdline_external_term_cmd = "kitty '%s' &" I get:

Failed to launch child: tmux -2 -f "/tmp/cmdline_1573890709_joss/tmux.conf" -L VimCmdLine new-session -s vcl1573890710 julia
With error: No such file or directory
Press Enter to exit.

For convenience, I often use a wrapper command terminal to run kitty, which just contains kitty $* at the moment. When I set let cmdline_external_term_cmd = "terminal '%s' &" I instead get:

"/tmp/cmdline_1573890503_joss/tmux.conf": No such file or directory 

In the second case, the REPL does then appear, and I can send code to it from Neovim, but the tmux configuration file is clearly not being read, and causes an error. I've checked, and the tmux configuration file is being created.

Thinking it might be some kind of timing issue, I changed my terminal command to sleep 1; kitty $*, but that had no effect.

On that note, under NVim-R I much prefer to use my own .tmux.conf, and so have the let R_notmuxconf = 1 option set. Is there something similar available for vimcmdline? If not, would it be possible to have it?

Thank you.

vimcmdline sending an extra newline to Julia REPL from neovim

Hi there, I'm having a small problem with using vimcmdline with Julia. I'm currently on an UbuntuMATE 18.04 system which is currently fully updated. Running NVIM v0.3.0-dev in MATE Terminal 1.20. With a blank .vimrc file and only the vimcmdline and julia-vim plugin's installed, using space to send a line to the REPL results in what looks like two newlines being sent.

This is the result of pressing the spacebar twice:

screenshot at 2018-05-23 20-37-25

I can't remove julia-vim plugin because nvim doesn't seem to recognise the .jl as a julia file, which stops me opening the REPL.

Happy to provide / do further info or tests to try to pin this down. I've only discovered this plugin today and enjoying it so far (the extra newline doesn't seem to cause too many problems). TIA.

VIM help for plugin is missed

Having a comprehensive help pages seems to be VIM/NVIM standard for VIM plugins.

It is also very convenient to have all help in one place and not to switch to browser when you need some information about some particular features.

Please, add VIM help pages.

Indentation is lost (ipython)

Hi,

Thank you for this plugin, I am already an heavy Nvim-R user. Wanted to try this one for python.

My problem is when I try to send this code:
2017-03-09-07 49 39

It fails because of the indentation:
2017-03-09-07 49 46

I tried to use an external terminal (with tmux) or the nvim buffer. But it fails everytime.

Thank you for you help

sending file in node.js doens't work

After sending a js file with several vars and functions defined in that file, I see those vars and functions undefined in node repl.

Sending lines using space works though.

b:cmdline_source_fun doesn't work for node

For some reason VimCmdLineSendLine() works but VimCmdLineSendSelection() and b:cmdline_source_fun(...) actually put

delete require.cache[require.resolve('/tmp/cmdline_1586888699_${user}/lines.js')]; require('/tmp/cmdline_1586888699_${user}/lines.js')
into the console and doesn't run the code in selection. I'm using nvim 0.4.3 with node 10.19.0 in debian testing.

Does VCL allows me to use ssh?

I tried this command.

let cmdline_app = {}
let cmdline_app['python'] = 'ssh [[email protected]](mailto:[email protected]) python'

This command run well.
As image tells us, VCL could connect external session ( ssh )

image

but if ssh needs password to enter, vimcmdline seems not to allow me enter it
VCM allows me to do these?
1, to use ssh public key connection? if ok, we don't need password
2, to enter password to .vimrc or init.vim? if ok, we don't have to enter it manually, but danger to security
3, to prepare making neovim's terminal mode be logged in already? as write next, I tried preparing neovim's terminal logged in before start vimcmdline, but it seems to be not good

What I want is to connect ssh session because ssh session has good machine resource.
But I don't want to run NeoVim in ssh because of overhead.
I want to run neovim ( session A, I'm here ) and want only to send code to ssh ( external session B ) for talking with interpreter .
So, I'm happy if VCL can send codes unit|block to external session like ssh.

execute the whole python class

Hi, what should I do if I do not want to use space to execute each line of a python class but instead the whole class?

variable "vim" undefined in python_cmdline.vim

Variable "vim" throws error when I try to execute in visual mode (v+). I commented out the lines where it calls for "vim.eval..." without dire consequence. May need definition for / removal of "vim" here
vimcmdline_error
.

Sending multiple lines freezes IPython with "%cpaste -q"

When I send multiple lines of Python (e.g. a paragraph or function) to IPython running in a Neovim terminal buffer, "%cpaste -q" appears at the console and nothing happens. If I then switch to the console and hit CTRL-C I get a long traceback related to the keyboard interrupt and then one by one the sent lines are evaluated at the normal IPython prompt (not the one expected to be invoked by %cpaste) and also "--" is evaluated raising an error.

This happens most of the time but not always. The expected behaviour also occurs.

How can I fix this?

I'm using NVIM v0.2.2, Python 3.6.8 and IPython 7.8.0 all running in tmux in Windows Subsystem for Linux with Ubuntu 18.04.

Toggle interpreter

This is a great project! I love it!

I just have a minor usability issue:
I was wondering if there's a way to toggle the interpreter?
Because when I start a session after having a session already open, it starts a second session, then when I close it, I can't close the first session.
Another way would be that when I start a session, to try and close a previous session

Launch inside docker container

I am a huge fan of docker, and I'd like to use vimcmdline to debug my scripts that are running inside a container.

It is actually simple to change init.vim to make it work:
let cmdline_app["python"] = "docker exec -it container /usr/python3"

But I don't want to have to edit my config file every time I want to attach to a different container. What would you suggest? I am willing to do a pull request.

Could we imagine a new shortcut? That would query the user for a custom command line?

Question: Connect to R or Python kernel running in jypyter?

I just posted the follow feature request to vimpyter (szymonmaszke/vimpyter#17 (comment)) which I thought might also interest you. I'm primarily an R user and just found Nvim-R (and spacevim) and am very excited about both! However, I'm also using more python these days and having access to jupyter kernels (in docker containers) is super useful for reproducible research and a consistent computing environment. In case you are interested, below a link to install instructions to a docker container I use with my students.

https://github.com/radiant-rstats/docker/tree/master/install

===========================================================
Copied the issue posted to vimpyter below for your convenience:

You may be interested in "https://github.com/mwouts/jupytext" which makes it possible to "link", e.g., a python or R(markdown) script to a jypyter notebook. You can edit the notebook and the linked file will be auto-updated. You can also edit the linked file, e.g., in (space)vim, and the notebook will be updated as well. Very nice!

I also saw the follow issue posted on 'spacevim' (SpaceVim/SpaceVim#1854) but I don't think this has happened yet but it is listed as a "milestone".

One thing that would be fantastic in vimpyter (and spacevim) would be to send Python (or R) code to a running jupyter kernel. This is something that atom + hydrogen currently does a fantastic job at. See link below

https://nteract.gitbooks.io/hydrogen/docs/Usage/GettingStarted.html

You can even connect to jupyter kernels (e.g., R and Python) running in local or remote docker containers which is something I use all the time. Works really great ... from atom ... but I would love to have this work form (space)vim.

https://github.com/nteract/hydrogen/blob/master/docs/Usage/RemoteKernelConnection.md

This is not an issue, but I think open the bash terminal whatever the filetype is be a good idea.

Hi Jakson,

First of all, I would like to thank you for this great Plugin.

The suggestion is when you are working on a large projects it would be very stressful and confused to leave the workspace and open a new Terminal to do some related work like updating or installing a some components etc. In most popular IDEs like Atom and VSCode you can open a Terminal in the workspace to accomplish these tasks without leaving the workspace. So I think it would be a great addition to this Plugin if it was applied. For example when working on a Django project, what I suggest is something like that:
Screenshot for the suggestion

could we add the stata do files

this seems to work

function StataSourceLines(lines)
call writefile(a:lines, g:cmdline_tmp_dir . "/lines.do")
call VimCmdLineSendCmd('do ' . g:cmdline_tmp_dir . '/lines.do')
endfunction

let b:cmdline_nl = "\r\n"
let b:cmdline_app = "stata"
let b:cmdline_quit_cmd = "exit"
let b:cmdline_source_fun = function("StataSourceLines")
let b:cmdline_send_empty = 0

nmap s :call VimCmdLineStartApp()

exe 'autocmd VimLeave * call delete(g:cmdline_tmp_dir . "/lines.do")'

error reported when import a module, but actually it works

if I use space to excute a line like "import bla", then there will be long stacktraces like below, although in fact the import actually works.

this is not an urgent issue since it indeed sucessfully completed the import and everything else works just seemingly something is wrong:

Python 3.7.1 (default, Dec 14 2018, 19:28:38)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from main import embed_cluster
Exception in default exception handler
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/eventloop/posix.py", line 154, in _run_task
    t()
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/eventloop/context.py", line 115, in new_func
    return func(*a, **kw)
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 716, in cpr_not_supported_callback
    run_in_terminal(in_terminal)
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/application/run_in_terminal.py", line 41, in run_in_terminal
    return run_coroutine_in_terminal(async_func, render_cli_done=render_cli_done)
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/application/run_in_terminal.py", line 62, in run_coroutine_in_terminal
    assert app._is_running
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/eventloop/base.py", line 129, in call_exception_handler
    self._exception_handler(context)
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 692, in handle_exception
    run_coroutine_in_terminal(print_exception)
  File "/home/user/anaconda3/lib/python3.7/site-packages/prompt_toolkit/application/run_in_terminal.py", line 62, in run_coroutine_in_terminal
    assert app._is_running
AssertionError
from main import embed_cluster

In [2]: from main import embed_cluster

In [3]:

access console from different tabs of vim-nerdtree

I use both vimcmdline and nvim-R, in nvim-R i could swich between different tabs in vim-nerdtree and send lines to the same R console, but in vimcmdline, when i switch tabs, the python console also disappears.

Issue in neovim terminal but not tmux

Hello when I try to use the kdb interpreter in neovim I get the following

image

image
after I press enter line is correctly copied
when I use tmux all is fine

Feature Request: Allow custom mappings

This way, users can set their own maps and not worry about the plugin clobbering existing mappings (for example, <space> is my leader and it gets remapped by starting vimcmdline).

Add q (kdb) support

I am running a similar functionality that I mostly derived from your notes in vim-r-plugin. With the help of tmux/screen I send selection from my vim buffer to another tmux/screen session. This looks very similar to what your plugin seems to be doing.
Is there a possibility for the user to specify any program (would be q for me) and leverage on your plugin ?

Settings for line ending character

As you know, I've been trying to figure out how to get line endings to work correctly on Windows. To experiment with this, I can set cmdline_nl to different values in Neovim interactively. But whenever I try to change this setting in my settings files, it seems to get overridden by the plugin settings.

Would it be possible to expose per-filetype line ending settings to the user in a similar way as with the cmdline_app option? This would make it easier to customize my setup.

colorize output in tmux pane

I'm using the following command in .vimrc to run a terminal in tmux pane:
let cmdline_external_term_cmd = "tmux split-window '%s'"

Is it possible to colorize for example python output (using vimcmdline
) in a tmux pane similar to nvim-R tmux pane ?

python sendfile that have functions with blank line insides does not work

I am using vim 8.1 and tmux 2.3 on debian 9.8, my vimcmdline configuration is as follows:

" vimcmdline mappings
let cmdline_map_start          = '\s'
let cmdline_map_send_and_stay  = '\l'
" Send file
let cmdline_map_source_fun     = '\f'
let cmdline_map_send_paragraph = '\p'
let cmdline_map_send_block     = '\b'
let cmdline_map_quit           = '\q'

" vimcmdline options
let cmdline_vsplit      = 1      " Split the window vertically
let cmdline_in_buffer   = 0      " Start the interpreter in tmux since vimcmdline doesn't support vim term

I also use pylint through pymode which strip all trailing space, including the empty lines inside functions.

And when I was sending split.py that have functions with blank lines inside:

# split.py
def find(s, start, predictor):
    for i in range(start, len(s)):
        if predictor(s[i]):
            return i
    return -1

def find_all(s, sep=" \t\n"):
    beg_of_nonsep = 0
    while beg_of_nonsep < len(s):
        beg_of_nonsep = find(s, beg_of_nonsep, lambda ch, sep_chs=sep: ch not in sep_chs)
        if beg_of_nonsep == -1:
            break

        end_of_nonsep = find(s, beg_of_nonsep + 1, lambda ch, sep_chs=sep: ch in sep_chs)
        if end_of_nonsep == -1:
            end_of_nonsep = len(s)

        yield (beg_of_nonsep, end_of_nonsep)

        beg_of_nonsep = end_of_nonsep + 1

split = lambda s: [s[beg: end] for (beg, end) in find_all(s)]

print(split(""))
print(split("     \t\n"))
print(split("     \tssss\n"))

it did not work:

Type "help", "copyright", "credits" or "license" for more information.
>>> def find(s, start, predictor):
...     for i in range(start, len(s)):
...         if predictor(s[i]):
...             return i
...     return -1
...
>>> def find_all(s, sep=" \t\n"):
...     beg_of_nonsep = 0
...     while beg_of_nonsep < len(s):
...         beg_of_nonsep = find(s, beg_of_nonsep, lambda ch, sep_chs=sep: ch not in sep_chs)
...         if beg_of_nonsep == -1:
...             break
...
>>>         end_of_nonsep = find(s, beg_of_nonsep + 1, lambda ch, sep_chs=sep: ch in sep_chs)
  File "<stdin>", line 1
    end_of_nonsep = find(s, beg_of_nonsep + 1, lambda ch, sep_chs=sep: ch in sep_chs)
    ^
IndentationError: unexpected indent
>>>         if end_of_nonsep == -1:
  File "<stdin>", line 1
    if end_of_nonsep == -1:
    ^
IndentationError: unexpected indent
>>>             end_of_nonsep = len(s)
  File "<stdin>", line 1
    end_of_nonsep = len(s)
    ^
IndentationError: unexpected indent
>>>
>>>         yield (beg_of_nonsep, end_of_nonsep)
  File "<stdin>", line 1
    yield (beg_of_nonsep, end_of_nonsep)
    ^
IndentationError: unexpected indent
>>>
>>>         beg_of_nonsep = end_of_nonsep + 1
  File "<stdin>", line 1
    beg_of_nonsep = end_of_nonsep + 1
    ^
IndentationError: unexpected indent
>>>
>>> split = lambda s: [s[beg: end] for (beg, end) in find_all(s)]
>>>
>>> print(split(""))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <lambda>
TypeError: 'NoneType' object is not iterable
>>> print(split("     \t\n"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <lambda>
TypeError: 'NoneType' object is not iterable
>>> print(split("     \tssss\n"))


It ignores much of the function find_all, so the code is completely broken. (The third print actually never returned until I killed it with <ctrl + c>.

However, when I use python3 ./split.py to run the code, nothing went wrong:

[]
[]
['ssss']

It gave me exactly what I want.

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.