https://github.com/krshrimali/nvim-utils.nvim
All my utilities of neovim in a single plugin
https://github.com/krshrimali/nvim-utils.nvim
Last synced: about 1 month ago
JSON representation
All my utilities of neovim in a single plugin
- Host: GitHub
- URL: https://github.com/krshrimali/nvim-utils.nvim
- Owner: krshrimali
- Created: 2025-04-02T15:55:20.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-10T12:25:54.000Z (6 months ago)
- Last Synced: 2025-05-07T12:27:04.690Z (5 months ago)
- Language: Lua
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ณ Universal Treesitter Utils (`nvim-utils.nvim`)
FYI: README generated by ChatGPT.
A Neovim plugin to explore, inspect, and extract structure from code using [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
### โจ Features
- ๐ง Extract current function or class under cursor.
- ๐ Copy parent function/class to clipboard.
- ๐ช Show multi-line function **signatures**.
- ๐งช Run `pytest` for Python functions (optional, customizable).
- ๐ Copy the test command for the current parent function to clipboard.
- ๐ Keymap-ready with LazyVim/which-key support.---
## ๐ฆ Installation (with LazyVim / `lazy.nvim`)
In your Lazy config (`~/.config/nvim/lua/plugins/tgkrsutil.lua`):
```lua
return {
"krshrimali/nvim-utils.nvim",
config = function()
require("tgkrsutil").setup({
enable_test_runner = true,
test_runner = function(file, func)
return string.format("pytest %s -k %s", file, func)
end,
})
end,
event = "VeryLazy",
}
```---
## ๐ Key Mappings
| Mapping | Description |
|----------------|----------------------------------------------|
| `rt` | Run test for function (Python only) |
| `rT` | Run test in a new terminal (_will be deleted soon_) |
| `rc` | Copy test command to the clipboard |
| `rif` | Copy parent function to clipboard |
| `ric` | Copy parent class to clipboard |
| `rsf` | Show full parent function **signature** |
| `rsc` | Show parent class signature (first line) |> These are registered automatically in `setup()` but can be overridden manually.
---
## ๐งช Test Runner
Test support is **Python-only by default**, via `pytest`.
You can override it:
```lua
require("tgkrsutil").setup({
test_runner = function(file, func)
return "go test -v -run ^" .. func .. "$ " .. file
end
})
```---
## โ Requirements
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- Supported Treesitter parser for your language (e.g. `:TSInstall python`)
- Optional: `pytest` if using the default test runner---
## ๐ชช License
MIT ยฉ Kushashwa Ravi Shrimali