Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/9999years/batteries.nvim
Ergonomic Neovim Lua bindings for mappings and commands
https://github.com/9999years/batteries.nvim
neovim
Last synced: 23 days ago
JSON representation
Ergonomic Neovim Lua bindings for mappings and commands
- Host: GitHub
- URL: https://github.com/9999years/batteries.nvim
- Owner: 9999years
- Created: 2022-06-04T01:54:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-24T16:38:29.000Z (4 months ago)
- Last Synced: 2024-10-09T09:43:54.939Z (about 1 month ago)
- Topics: neovim
- Language: Lua
- Homepage: https://9999years.github.io/batteries.nvim/
- Size: 19.5 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# batteries.nvim
Ergonomic Neovim Lua bindings.
See `:h batteries` or [9999years.github.io/batteries.nvim][docs] for thorough
documentation.[docs]: https://9999years.github.io/batteries.nvim/
# batteries.map()
Define key mappings:
```lua
-- :nnoremap og Browse
require("batteries").map {
-- When I hit `\og`...
"og",
-- Execute the `:Browse` command.
"Browse",
-- Set a description:
"Open file on GitHub",
}-- Define multiple mappings with a common prefix together:
require("batteries").map {
prefix = "",
{ "t", "Telescope", "Telescope" },
-- Buffer local mapping:
{ "f", "Telescope find_files", "Find files", buffer = 3 },
}
```The following definitions are equivalent:
```lua
require("batteries").map {
prefix = "f",
name = "+file",
{ "f", "Telescope find_files", "Find file" },
{ "r", "Telescope oldfiles", "Open recent file" },
{ "n", "enew", "New file" },
}require("batteries").map {
{ prefix = "f", name = "+file" },
{ "ff", "Telescope find_files", "Find file" },
{ "fr", "Telescope oldfiles", "Open recent file" },
{ "fn", "enew", "New file" },
}
```# batteries.cmd()
Define a command:
```lua
require("batteries").cmd {
range = true,
nargs = 0,
"Browse",
",OpenGithubFile",
}require("batteries").cmd {
nargs = "?",
complete = "filetype",
"EditFtplugin",
"call misc#EditFtplugin()",
}
```