pimentel / atom-r-exec

Send R code to various R consoles from the Atom editor
https://atom.io/packages/r-exec
MIT License
19 stars 8 forks source link

resend same command #35

Closed dschneiderch closed 7 years ago

dschneiderch commented 7 years ago

Nice work on this. reminds me of r-box from Sublime. it's super useful in my case because I have to run a lot of things on a cluster and can't stand being handcuffed by emacs/vim etc.

i've slowly added some keymappings to resemble rstudio but one feature I'd love to see is "resend last command", e.g. when you're working on a block of code and need to constantly rerun something. Thanks!

pimentel commented 7 years ago

Thanks for the kind words, @dschneiderch !

Are you talking about the behavior in RStudio when you type cmd-shift-P? That should be pretty easy.

Any ideas on what we should bind it to? Unfortunately, cmd-shift-P is already bound to something in Atom.

pimentel commented 7 years ago

and just to be clear, I imagine you are using advancePosition? because otherwise the highlighted block will remain highlighted. (or at least it should -- if it is not, please file a bug report)

dschneiderch commented 7 years ago

Yes, cmd+shift+p. I'm using advancePosition=TRUE (this is a major benefit over rstudio IMO) how about alt-shift-p ? alt-shift-? seem to be good candidates for r things.

I'm also using: 'atom-text-editor': 'shift-alt-m': 'rstudio:insert-pipe' 'alt--': 'rstudio:insert-assign'

with init.coffee: atom.commands.add 'atom-text-editor', 'rstudio:insert-pipe': -> atom.workspace.getActiveTextEditor()?.insertText(' %>% ') 'rstudio:insert-assign': -> atom.workspace.getActiveTextEditor()?.insertText(' <- ')

Thanks!

On Tue, Sep 27, 2016 at 4:38 PM, Harold Pimentel notifications@github.com wrote:

and just to be clear, I imagine you are using advancePosition? because otherwise the highlighted block will remain highlighted. (or at least it should -- if it is not, please file a bug report)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pimentel/atom-r-exec/issues/35#issuecomment-250019792, or mute the thread https://github.com/notifications/unsubscribe-auth/AHHZZVlPDdNeqvMw19xMtD5AOFB7sFitks5quZragaJpZM4KHHAQ .

pimentel commented 7 years ago

Cool, thanks for the response. I will probably implement run previous command at the end of this week and make a new release with a few bug fixes early next week.

I've been meaning to add those key bindings as well (for assign and pipe).

Thanks,

Harold

pimentel commented 7 years ago

Hey there @dschneiderch. Sorry this took so long...

Anyway, it is now in the latest version (I just pushed so please update your package). It currently has a 'smart' insert mode which detects if there is whitespace to the left or right of the cursor and inserts whitespace accordingly. This behave strangely when there is a selection (I can't tell if there is a way to check if there is a current selection in Atom) I suppose the easiest workflow is simply to delete what is under the cursor then use the insert operator.

I used your suggested mappings as well.

Thanks for the suggestions and let me know if you like/dislike any of the new features/behavior.