Assistant.nvim is a neovim plugin which provide various features related to sample data testing in competitive programming scenarios
- ⚡ Blazingly fast.
- 🔓 Highly customizable.
- 🔆 Supports both environment and custom themes.
- 😃 Easy to use.
One important factor in competitive programming is Speed, make sure you don't compromise with that, while using some fancy plugin or software.
- Neovim version >=
0.9.5
- Competitive companion Browser extension
Setup with Lazy.nvim
{
"A7lavinraj/assistant.nvim",
dependencies = { "stevearc/dressing.nvim" }, -- optional but recommended
keys = {
{ "<leader>a", "<cmd>AssistantToggle<cr>", desc = "Toggle Assistant.nvim window" }
},
opts = {}
}
{
commands = {
python = {
extension = "py",
compile = nil,
execute = {
main = "python3",
args = { "$FILENAME_WITH_EXTENSION" },
},
},
cpp = {
extension = "cpp",
compile = {
main = "g++",
args = { "$FILENAME_WITH_EXTENSION", "-o", "$FILENAME_WITHOUT_EXTENSION" },
},
execute = {
main = "./$FILENAME_WITHOUT_EXTENSION",
args = nil,
},
},
},
ui = {
icons = {
success = "",
failure = "",
unknown = "",
loading = { "", "", "", "", "" },
},
},
core = {
process_budget = 5000,
},
}
- First line points to github repository from where the plugin is get installed.
- Second line is the dependency array for the plugin, In this case its Dressing.nvim
- Third line contains the options table to customize plugin:
g++ example.cpp -o example # {main} {arg1} {args2} {arg3}
Above code snippet is a command to compile a C++ file, If you take a closure look on the comment right infront of command you can guess main = g++
, arg1 = example.cpp
, arg2 = -o
and arg3 = example
, So if i want to extend the configuration for Python
, I just need to add following code snippet to commands table.
python = {
extension = "py", -- your preferred file extension for python file
compile = nil, -- since python code doesn't get compiled so pass a nil
execute = { -- {main} command and array of {args} as we saw earlier.
main = "python3",
args = { "$FILENAME_WITH_EXTENSION" }
},
},
key to the new table is type of file you want to run. In this case is
python
, you can get the correct filetype of file by just open that file inside neovim and type the following command.
:lua print(vim.bo.filetype)
There is only one command to interact with plugin AssistantToggle which toggle the UI window of plugin and rest operations are done by key-mappings.
-- command to open and close plugin window
:AssistantToggle
Key | Operation |
---|---|
q |
Close UI |
r |
Run testcase on which the cursor is holded |
R |
Run all available testcases |
c |
Create an empty testcase |
d |
Delete testcase on which the cursor is holded |
e |
Open prompt window for updating expect |
i |
Open prompt window for updating input |
<enter> |
Confirm changes in prompt |
<c-l> |
Navigate to available right window otherwise close the UI |
<c-k> |
Navigate to available up window otherwise close the UI |
<c-h> |
Navigate to available left window otherwise close the UI |
<c-j> |
Navigate to available down window otherwise close the UI |