Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superDross/run-with-me.vim
Runs current buffer code
https://github.com/superDross/run-with-me.vim
Last synced: 4 months ago
JSON representation
Runs current buffer code
- Host: GitHub
- URL: https://github.com/superDross/run-with-me.vim
- Owner: superDross
- License: gpl-3.0
- Created: 2021-05-06T19:34:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T16:32:33.000Z (over 1 year ago)
- Last Synced: 2024-06-10T01:38:35.475Z (5 months ago)
- Language: Vim Script
- Size: 396 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Run With Me
A simple script runner plugin with a pompous name.
Runs the current buffers code or tests in a separate terminal window.
![](https://user-images.githubusercontent.com/16519378/186270965-38799bd8-86b4-442a-a6ab-65b1006f8f3f.gif)
## Installation
Supports both vim >= version 8.2 and neovim.
In your vimrc file;
```vim
Plug 'superDross/run-with-me.vim'
```## Usage
### Script Execution
Execute `:RunCode` to run your current windows code in a terminal.
You can also parse commandline arguments, for example if your script accepts a `--file` argument you can execute the following `:RunCode --file test.txt`.
Alternatively, you can map the command to a key. Place the below snippet into your vimrc to map the command to Leader 9:
```vim
nmap 9 :RunCode
" run in vertical terminal window instead
nmap 9 :RunCodeVert
```![runcode](https://user-images.githubusercontent.com/16519378/199552946-f8362b1d-940d-4587-8f4f-36779f9ebd90.gif)
### Execute to Cursor
Execute `:RunToCursor` to run your current windows code from the start of the file to the line in which the cursor is sitting upon in a terminal.
You can also parse commandline arguments, for example if your script accepts a `--file` argument you can execute the following `:RunToCursor --file test.txt`.
Alternatively, you can map the command to a key. Place the below snippet into your vimrc to map the command to Leader 9:
```vim
nmap 9 :RunToCursor
" run in vertical terminal window instead
nmap 9 :RunToCursorVert
```### Visual Execution
Execute `:RunSelectedCode` to run code selected in visual mode.
You can also parse commandline arguments, for example if your script accepts a `--file` argument you can execute the following `:RunSelectedCode --file test.txt`.
Alternatively, you can map the command to a key. Place the below snippet into your vimrc to map the command to Leader 9:
```vim
nmap 9 :RunSelectedCode
" run in vertical terminal window instead
nmap 9 :RunSelectedCodeVert
```![runselectedcode](https://user-images.githubusercontent.com/16519378/199552991-10a08db6-d428-4aa4-99e7-87af4218dad1.gif)
### Tests Execution
Execute `:RunTests` to run your testing command in the current directory.
Testing command to run will be dependant upon the current windows filetype. Setting `g:default_testing_cmd` will run the same testing command regardless of filetype.
Mappings can be set like so:
```vim
nmap 1 :RunTests
" run in vertical terminal window instead
nmap 1 :RunTestsVert
```![runtests](https://user-images.githubusercontent.com/16519378/199553067-12de03fe-f6e2-4901-8e7b-e73a1f3245b3.gif)
> **Warning**
>
> The following test commands only work with _Python_ tests.Execute `:RunModuleTests` to run *only* the tests in the current file.
Mappings can be set like so:
```vim
nmap 1 :RunModuleTest
" run in vertical terminal window instead
nmap 1 :RunModuleTestVert
```![runmoduletests](https://user-images.githubusercontent.com/16519378/199553163-6a90ead5-3d5c-4f43-bfa1-add7c87c8457.gif)
Execute `:RunNearestTest` to run *only* the test nearest above the cursor.
Mappings can be set like so:
```vim
nmap 1 :RunNearestTest
" run in vertical terminal window instead
nmap 1 :RunNearestTestVert
```![runnearesttest](https://user-images.githubusercontent.com/16519378/199553227-20816336-d8b6-4473-802c-34fa1ecc6388.gif)
## Configuration
Change row size of the horizontal terminal output:
```vim
let g:runner_rowsize = 15
```Overwrite base commands for a give language e.g. use python3.9 for all python script executions:
```vim
let g:runner_cmds['python'] = 'python3.9'
```Overwrite base testing command for a given language e.g. use nosetests instead of pytest for python:
```vim
let g:testing_cmds['python'] = 'nosetests'
```The below config will run the given test command regardless of filetype:
```vim
let g:default_testing_cmd = 'make test'
```