If you have all the files in the same vscode workspace folder,

then you could name your 'main' nim file you want to always run, main.nim

and set a global coderunner custom command (Ctrl-Alt-K)) in settings.json.

My pc with nim on it is dead atm so I can't check or test it, but my laptop has 
this lua setting with which you should be able to tweak the path and file 
extension to work on nim:
    
    
    "code-runner.customCommand": "/usr/local/bin/lua ${workspaceFolder} 
main.lua"
    
    Run

I mapped the normal command (Ctrl-Alt-N) to F8 and the custom command to F9, so 
I can be editing a non-main file and still run either it or the main.lua file.

The variables reference for vscode is here if you need further tweaking: 
[https://code.visualstudio.com/docs/editor/variables-reference](https://code.visualstudio.com/docs/editor/variables-reference)

You can also set up multiple commented-out custom commands for different 
languages and uncomment them to switch language. 

Reply via email to