Git Product home page Git Product logo

Comments (18)

songcai avatar songcai commented on August 13, 2024 1

Many thanks for your help, Jakson. I totally agree with your conclusion, and will bring this to the MacVim developer.

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024 1

Thanks!

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

Unless you have built MacVim yourself, it should not work. The last MacVim release includes Vim patches up to 1553, and Nvim-R requires 1579. However, you should have seen this error message:

Nvim-R requires either Neovim >= 0.1.2 or Vim >= 7.4.1579.
If using Vim, both +channel and +job features must be enabled.

from nvim-r.

songcai avatar songcai commented on August 13, 2024

Hi Jakson,

Thanks for the prompt reply.

I am using MacVim unstable 7.4.1589 (installed using brew install -HEAD macvim), and both +channel and +job features are enabled (I checked using :version command inside MacVim). I still get the above problem.

-Song

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

Unfortunately, in this case, I don't know what might be wrong because I don't have access to a Mac OS X.

from nvim-r.

songcai avatar songcai commented on August 13, 2024

I tried Vim unstable + Nvim-R on my Debian stable. The gui vim (gvim) can send R commands without any problem. It seems that the problem is specific to gui MacVim. Hope someone with a Mac OS can figure it out. I will try to solve the problem as well.

from nvim-r.

songcai avatar songcai commented on August 13, 2024

Hi Jakson,

Just more information about the same problem. I know that you do not have access to Mac OS, but this information may ring a bell to you or someone else.

(1) With Gui MacVim, after I call a R console using ",rf", I cannot send other commands like ",aa", ",rq" etc. And I also cannot use other plugins that use keyboard shortcuts. For example, I have vim-surround, and typing "yss)" is supposed to put () around a line, but now it does not work after I invoked R. I also have nerdcommenter, and typing ",cc" is supposed to comment the current line; it does not work either now.

(2) I have set the mapping "vmap RDSendSelection", and "nmap RDSendLine" in my .vimrc. Now the magic is that the space bar still works for sending commands to R, and if I send a command using space bar just once, everything goes back to normal: ",aa" works now, and all other plugins work again. This is a mystery.

I think it might be a bug in nvimcom.

Hopefully the above phenomena provide you with some useful information.

Cheers,
-Song

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

It looks like the channel is waiting for input, and somewhat blocking input from the keyboard. When the first command in the R Console is executed successfully, nvimcom sends a message to Vim telling Vim to update the syntax highlight of functions. You can see this if you put in your .Rprofile:

options(nvimcom.verbose = 4)

Then, after starting R, type in the R terminal any valid command, such as the number 1. The output here is:

> 1
[1] 1
nvimcom_nvimclient(FillRLibList()): '10101' (10101)

from nvim-r.

songcai avatar songcai commented on August 13, 2024

I tried that. With gui MacVim, I got

nvimcom 0.9.14 loaded
NVIMR_TMPDIR = /var/folders/mh/v1yyk3sx4nn831fqs_wsynch0000gn/T/Nvim-R-scai
NVIMR_ID = LffBOpXy6Mv8U0R5qZSg
nvimcom port: 10001

nvimcom_eval_expr: 'nvimcom:::nvim.buildomnils('nvimcom')'
nvimcom R: No need to build omnils: nvimcom 0.9-14
... ...
nvimcom_eval_expr: 'nvimcom:::nvim.buildomnils('base')'
nvimcom R: No need to build omnils: base 3.2.4

then it is stuck there. And Vim is using 160% of CPU. If I type 1 in R console, it gives me
1
[1] 1
I think this is not the supposed behaviour.

When using terminal MacVim I got

... ...
nvimcom_eval_expr: 'nvimcom:::nvim.buildomnils('base')'
nvimcom R: No need to build omnils: base 3.2.4
nvimcom Received: [1] 10101

If I type 1 in R console, I get
1
[1] 1
nvimcom_nvimclient(FillRLibList()): '10101' (10101)

This looks like the right behaviour.

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

The terminal MacVim seems to be OK. What is missing in gui MacVim is

nvimcom Received: [1] 10101

which means that the nclientserver (started by Nvim-R with job_start() function) is running, and Nvim-R has sent its port number to nvimcom. The message FillRLibList() is sent from nvimcom to Nvim-R only when nvimcom knows the clientserver port.
That is, it looks like the +channel and +job features are not working properly in the gui MacVim.

What is the output of

:echo rplugin_jobs

after R is started (in both terminal and gui MacVim)?

from nvim-r.

songcai avatar songcai commented on August 13, 2024

The output in terminal MacVim is

{'R': 'no', 'Terminal emulator': channel 0 closed, 'ClientServer': channel 1 open}

The output in gui MacVim is

{'R': 'no', 'Terminal emulator': channel 0 open, 'ClientServer': channel 1 open}

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

The clientserver application is running in both. The problem seems to be the Terminal emulator job. What happens if you put this in your vimrc?:

let R_silent_term = 1

This will switch to the old code that was already used in the Vim-R-plugin, but which I also don't know if works with gui MacVim.

from nvim-r.

songcai avatar songcai commented on August 13, 2024

If I do that, the problem persists and the output of :echo rplugin_jobs is

{'R': 'no', 'Terminal emulator': 'no', 'ClientServer': channel 0 open}

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

Conclusion: the problem is in the nclientserver running as a job. Since the code works on Linux and even on terminal MacVim, I guess the bug is some kind of undue interaction between the +channel feature and gui MacVim. Perhaps you should report the bug to the MacVim developer.

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

It seems the bugs in MacVim were fixed:
macvim-dev/macvim#281
macvim-dev/macvim#283
Can anyone check if Nvim-R is working on MacVim now, please?

from nvim-r.

songcai avatar songcai commented on August 13, 2024

I confirm that Nvim-R is working on MacVim 7.4.1831. However I sometimes (not always) get the following error message after I send some code to R:
"E119: Not enough arguments for function: ROnJobExit "

Cheers,
-Song

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

I believe it is fixed now: 3c76c67

from nvim-r.

songcai avatar songcai commented on August 13, 2024

Yes, Jakson. It fixes the issue. Many thanks.
If you need someone to test on a Mac in the future, I would be glad to help

from nvim-r.

Related Issues (20)

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.