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: 3 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 (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T16:32:33.000Z (almost 2 years ago)
- Last Synced: 2024-08-07T18:45:49.711Z (7 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.

## 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
```
### 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
```
### 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
```
> **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
```
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
```
## 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'
```