I have the nim-mode and smart-compile packages installed, and I have bound F9 to compile the nim code in the current buffer, and run it in the emacs-inbuilt eshell.
I have configured so that the point and buffer switching 'does the right thing'.
- If the compilation fails, show the compilation buffer in the other window, and do not execute the binary, and keep the point in the code window.
- If the compilation passes, execute the binary in the other window.
- Now if the binary execution ends with showing the eshell prompt, move the point back to the other window (code window).
- If not, that is, if the eshell prompt does not show up, keep the point in the eshell buffer, because that most likely means that some user input is expected.
---
So my nim learning process goes as: type a code snippet, F9, type more, probably cause error, F9, fix that, F9, etc.
Config: [1] [2]
[1]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-fi...
[2]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-fi...
It's a very simple feature that I'm sure can be implemented as a plugin in any IDE/Text editor. The Nim VS Code plugin sort of supports it, but the feature could be improved. (Nowadays, I wouldn't recommend using Aporia for various reasons).
1 - Aporia - https://github.com/nim-lang/Aporia
On https://nim-lang.org/faq.html under "What about editor support?", Aporia is mentioned as the first option. Should it be moved lower in the list?
Anyways I use nim-mode in emacs, and it works great!
Admittedly I'm still doing super basic stuff at the moment.
(Similar to http://play.rust-lang.org or https://play.go-lang.org).