-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some questions regarding usage #326
Comments
i) ii) iii) |
I don't want this particular behaviour. I want to be able to run a file inside an interactive shell. If the interactive shell is not opened then first open it and the run; otherwise (if it is already opened) then just run it. Can that be achieved in a better fashion than my rudimentary function approach?
Exactly what i needed :)
Yep that's what i'm after. Do you plan to implement it? Also can the object browser be always opened as a vertical split on the very left of the screen? Thanks for the quick reply! |
i) Wouldn't it work if you created another function calling |
Depending on what buffers you have open, it will not be on the very left, but you can start the Object Browser on the left of either the script being edited or the R console: let R_objbr_place = 'script,left'
let R_objbr_place = 'console,left' |
My use case is that I'm editing an R file and then I would like to press some mapping (for instance
So basically there is no way to always open it at the very far right? (I prefer it that way). Thanks for your help and patience! :) |
It might not work. "Starting R" really means more than starting R:
I can implement this. Currently, Nvim-R runs |
That would be perfect. Thanks
Ok. So can you suggest how should i write a funciton that actually checks that these steps finish and then runs the code? |
Also (continuing with my nvim-R questions), have you ever tried using deoplete for automatic omicompletions? I'd like to do something like similar to what you suggested here. I tried adding the following to use omnicompletions immediately after a call deoplete#custom#var('omni', 'input_patterns', {
\ 'r' : ['[^. *\t]\.\w*'],
\}
\) but whenever I type |
Please, look at the code of
No, because ncm-R is working fine, and I can't see any advantage of completing keywords only after a |
function! s:RunR(mode)
if g:rplugin_nvimcom_port == 0
call StartR("R")
while g:rplugin_nvimcom_port == 0
sleep 300m
endwhile
endif
if a:mode == 'file'
call SendFileToR("silent")
elseif a:mode == 'visual'
call SendSelectionToR("silent", "down")
endif
endfunction
au FileType r nmap <Leader>rf :call <SID>RunR('file')<CR>
au FileType r vmap <Leader>rf :call <SID>RunR('visual')<CR> however when i used the visual mapping the selection is send twice. Any ideas why?
Ok. I might give it a try. |
Probably you are sending two lines. Try this:
|
Excellent thanks! Feel free to close. Thanks for the awesome support. |
Sorry one last thing. Imagine that I close the console from within the console by using
Is it possible to add an option to restart the console if nvim-r doesn't find it? (instead of giving the warning message). I ask this because closing from within the console i something I do quite often and currently i need to restart vim if I want to reuse it. |
Note: it works only when running R within the built-in terminal emulator. See: #326
It should work now if running R inside Vim/Neovim built-in terminal. If running R in an external terminal emulator, you have to press |
Awesome. Best plugin support ever. Thanks.
I'm indeed using tmux. There is no way for nvim-r to actually run rq by itself with it doesn't find the pane? (instead of forcing the user to do it?) |
It actually does this if you try to send a line to R. The terminal emulator is run as a job, but it is detached because, otherwise, it would be killed if you closed Neovim. That's why Nvim-R cannot detect when the terminal has quitted. |
@petobens See this issue for deoplete/nvim-r completion support. Shougo/deoplete.nvim#745
This essentially causes deoplete to be a dumb pipe to nvim-r supplied omnicomplete. I lose ultisnips showing up in the completion menu, but I generally just type them out and manually expand them anyways. |
@Aenda the problem with this approach is that it is too slow and blocking. I actually read that issue and posted some comments there. |
Have you figured out a solution that fixed the issue in your comment above? I consider what I'm using more of a hack than a real solution, to be honest. Working looking into what it would take to implement better deoplete compatibility in nvim-r like in vimtex is on my to do list, but I don't think I'll get to it for a while. |
Nope. I asked (in that linked issue) if @jalvesaq and @gaalcaras have any ideas/pointers. |
@gaalcaras has done a great job with ncm-R, and I have made some adjustments in Nvim-R to ncm-R. So, if someone wants to develop integration with deoplete, it is better if the infrastructure created to ncm-R is used. |
@gaalcaras do you think it is possible for you to write a deoplete source? (since you already have the know how)? Mmm I want to avoid installing a new completion framework just for one specific language (and in fact this would be extra helpful for other people using deoplete) |
I think this is particularly relevant because nvim-completion-manager is no longer actively maintained (whereas deoplete is): roxma/nvim-completion-manager#12 (comment) |
@jalvesaq Consider the following GIF: What I would like is that instead of nvimr showing the |
I don't use advanced Tmux features... Can it hide a pane? Then what is the message when you try to send lines to a hidden pane? |
Sorry I don't follow. I actually quit the pane, that's why i get the |
I guess I can do what you requested. I did the following:
This makes the R Console disappear, but if I send lines to R they keep being evaluated. |
In my case, I use the space bar to send lines, and it is not impossible that I press the space bar by mistake after quitting R. So, I don't think it is a good idea to restart R when trying to send a command to it. Moreover, I have already commented that starting R means also waiting for nvimcom. |
Are you willing to consider to add an option to enable this behaviour? |
It's not easy to implement. The starting point is below, but it's buggy and I won't fix it: https://github.com/jalvesaq/Nvim-R/tree/auto_start If you want to implement it, you have to do it not only for R running in an external terminal emulator, but also for R running in a Vim buffer, in a Neovim buffer, and as the RGui.exe (on Windows). Please, don't ask me to do this. |
Wow, that's a lot of different scenarios. Mm I'm definitely not skilled enough to implement it myself :( |
Hi @jalvesaq . I believe this is no longer working. After running
Any pointers? Thanks! |
For cosmetic reasons (to avoid too many global variables), I turned g:rplugin into a dictionary. Please, try |
Thank you! |
First of all thanks for a great plugin :).
I've recently started using it and I find it really good. However I've read the docs, skimmed over the code and there are still a few things I can't actually get my head around so i''ll ask a few question about the usage.
i) I want to have a mapping (for instance
,rf
) that allows me to run a file (or a visual selection). Currently I have first to start R and then use eitherRSendFile
orRDSendSelection
. I want to avoid the manual start. I wrote the following function to do this:but a) don't know if it is the correct way of doing it and b) no idea how to extend it to handle a range.
ii) I know I can use the
RClearConsole
mapping to clear the console but this mapping doesn't clear the global namespace (in the sense that if I defined andx
variable then thex
variable assignment is still in memory). Therefore: is there someway to clear the namespace?iii) I didn't find a way to toggle the ObjectBrowser. I know I can open it with the
RUpdateObjBrowser
binding but I would a mapping to open and close it at will. Is that possible?Once again thanks for the plugin and the future help! :)
The text was updated successfully, but these errors were encountered: