A powerful multi-language REPL (Read-Eval-Print Loop) plugin for Neovim that allows you to execute code blocks in various programming languages directly from your editor.
- Current Language Support
- How It Works
- Features
- Requirements
- Quick Start
- Installation
- Usage
- Configuration
- Supported Languages
- Troubleshooting
- Contributing
- License
- π Multi-language support: Execute code in Python, JavaScript, Lua, Rust, Java, C, and more
- π Real-time output: View execution results in a floating window
- π History tracking: Keep track of all executed code and results
- β‘ Fast execution: Optimized for quick code testing and experimentation
- π‘οΈ Safe execution: Built-in safety measures for secure code execution
- Neovim 0.7.0 or higher
- Various language runtimes (Python, Node.js, etc.) depending on your needs
- Install the plugin using your preferred package manager (see Installation Guide)
- Configure Shifty in your Neovim config
- Open a file with code blocks (like
test_installation.md) - Use
:ShiftyToggleor your configured keymap to open the REPL window - Place your cursor in a code block and use
:ShiftyRunto execute it
For detailed installation instructions, see the Installation Guide.
Lazy.nvim:
{
"TuringProblem/shifty-vim",
config = function()
require("shifty").setup({
keymaps = {
toggle = "<leader>st",
run = "<leader>sr",
clear = "<leader>sc",
}
})
end,
}vim-plug:
Plug 'TuringProblem/shifty-vim'Packer:
use {
'TuringProblem/shifty-vim',
config = function()
require("shifty").setup({
keymaps = {
toggle = "<leader>st",
run = "<leader>sr",
clear = "<leader>sc",
}
})
end
}- Install the plugin using your preferred package manager
- Add the setup configuration to your Neovim config
- Open a file with code blocks (like a markdown file)
- Use
:ShiftyToggleor your configured keymap to open the REPL window - Place your cursor in a code block and use
:ShiftyRunto execute it
:Shiftyor:ShiftyToggle- Toggle the Shifty window:ShiftyRun- Run the code block at cursor position:ShiftyClear- Clear the output window:ShiftyClose- Close the Shifty window:ShiftyInfo- Show system information and available languages
The plugin will automatically set up keymaps if configured:
<leader>st- Toggle Shifty window<leader>sr- Run current code block<leader>sc- Clear output
Shifty automatically detects code blocks in various formats:
Markdown code blocks:
```python
print("Hello, World!")
```Fenced code blocks:
```javascript
console.log("Hello from JavaScript!");
```
Language-specific files: Just place your cursor anywhere in a Python, JavaScript, Lua, etc. file and run the command.
require("shifty").setup({
keymaps = {
toggle = "<leader>st",
run = "<leader>sr",
clear = "<leader>sc",
close = "<leader>sx",
},
languages = {
-- Language-specific configurations
python = {
command = "python3",
args = {"-u"},
timeout = 5000,
},
javascript = {
command = "node",
args = {},
timeout = 3000,
},
lua = {
command = "lua",
args = {},
timeout = 2000,
},
java = {
command = "javac",
args = {"-d", "/tmp"},
run_command = "java",
run_args = {"-cp", "/tmp"},
timeout = 10000,
},
rust = {
command = "rustc",
args = {"-o", "/tmp/rust_out", "-"},
run_command = "/tmp/rust_out",
timeout = 10000,
},
},
execution = {
timeout = 5000,
capture_print = true,
safe_mode = true,
},
ui = {
window_width = 80,
window_height = 20,
border = "rounded",
}
})- Python (
python,py) - JavaScript (
javascript,js,node) - Lua (
lua) - Rust (
rust,rs) - Java (
java,javac) - C (
c,cc,cpp) - Shell (
bash,sh,zsh)
If a language isn't working, check:
- The language runtime is installed and in your PATH
- The language configuration is correct
- Run
:ShiftyInfoto see available languages
If code execution times out:
- Increase the timeout in the language configuration
- Check if the code has infinite loops
- Verify the language runtime is working
For compiled languages, ensure:
- Write permissions in the temporary directory
- The compiler is properly installed
- The output directory is writable
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.



