[feedback] Rappel REPLs for NeoVim

I realised that I had a lot of duplicate code for running programs that I was working on in various different interpreters/compilers so I refactored it into a plugin. I'd love your thoughts. https://github.com/Cypher1/nvim-rappel

I'd plan to add proper REPL style send-to-repl bindings but at the moment I just use it to load the code into the interpreter (or to compile and run).

Posted Mar 18, 2017, 7:13 AM UTC

1216
Specht08•

I wrote something similar a while ago. The plugin opens a REPL based on the filetype or searches for an existing one. When opened you can send lines or selections to the attached REPL. Yours looks a bit more mature on coping with different filetypes but maybe you find something you can use from my plugin. term-repl

3
anotherturingmachineOP•

Thanks, I'll have a look

1
anotherturingmachineOP•

Thanks u/Specht08. Would you mind if I borrow from this work and attribute the feature to you?

1
Specht08•

That's fine for me, take what you need.

3
justinmkNeovim contributor•

This is looks simple, which is good. I hope that good conventions emerge from plugins like this and https://github.com/jalvesaq/vimcmdline/ , https://github.com/kassio/neoterm , etc.

2
Wes_0•

I am using iron nvim for python, very responsive development.

2
anotherturingmachineOP•

I should have another look at Iron but it felt over complicated when I looked at it last.

Then again, some of the features, like calling python functions, are pretty cool and I would like to support more flexibility in sending code to the Term. I'll play around with it in the next few days and see what I come up with.

Thanks

1
ingvij•

I'm the author of iron.nvim and it'd be great if you could explain help me make it better.

My idea is to have simple bindings and to be easy to add new REPLs/features to existing REPLs. I know that the core is quite complicated, but that is a reasonable price for making everything else simpler.

If that is not currently true, please let me know!

Cheers

2
anotherturingmachineOP•

Okay, looking back over Iron.nvim I can see why it didn't fit into my development cycle. I really wanted something that was clear and simple to configure so that I could run any code I was working on with one command. The main reason is that I need pure vimscript as some of the places I've worked have had machines that were very locked down and so I want to be able to support normal vim [esp. without python] as much as possible (the configuration should allow a run method other than :terminal) I also wanted users to be able to configure their own setup for languages that I hadn't added or for usage that differed from what the current default was. For Iron.nvim it looks like they would have to write python definitions inside the plugin to do this. It's really important to me that people can trust the code and that means that they should be able to follow it and predict the outcome of any mods they want to add.

I'm probably not the only one with these views but I totally understand that they do not represent everyone. Iron's pretty nice overall.

1
ingvij•

Thanks for answering. It is important that I know the reasons people use/don't use iron.nvim.

Iron is designed from ground up to use neovims terminal. The idea of having its definitions in Python is that it enforces standards and pushes customizations to all users.

I can understand your reasons and I believe that there's space for multiple implementations over there.

Once again, thanks for the answer

Cheers!

2
jsuth•

Love it. I like the easy customization. It seems to be a nice time saver to be able to quickly poke around in c with:

\ 'c': {
\   'compiler': 'gcc % -Wall -g',
\   'run': 'make debug && make cgdb || cgdb a.out',
\ }

It'd be cool to be able to use vim-tmux-runner over neovim term. I tried setting let g:rappel#term = 'VtrOpenRunner' but it seems to error in vim-tmux-runner.

Cheers for the cool plugin.

2
anotherturingmachineOP•

I'll have a look at the syntax of VtrOpenRunner, I think there's just more escaping to be done :)

Could you pass me the error message at some point? If you can't find it that's okay. I'll install it and play around

2
anotherturingmachineOP•

Thanks u/jsuth. I think I've worked out the issue. It looks like you want to run VtrSendCommandToRunner to run a command as VtrOpenRunner doesn't accept arguments.

Another confusing issue is that VtrSendCommandToRunner doesn't expand % to the filename. I've added a little patch to Rappel to expand the % and %:p automatically but it might cause problems if people need the % character.

Hopefully you can now use

let g:rappel#term='VtrSendCommandToRunner cd $(dirname %:p); '

This will send the command as well as moving so that the files are accessible relative to the current file (which the defaults were set up to assume). You will have to have to use VtrAttachToPane or VtrOpenRunner to make it work.

Hopefully this lets you get started.

2
tassulin•

So it compiles different codes?

1
anotherturingmachineOP•

Depends, if it has configuration for the language it can compile and run in a split, open an interactive interpreter in a split with your file loaded or just launch an external program. It is pretty configurable but if there's a language that I haven't put settings in for I'm happy to put in a minimal default.

1