Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrs4ndman/random.nvim
Random functions I use in my config joined as a plugin for easy access
https://github.com/mrs4ndman/random.nvim
Last synced: 3 days ago
JSON representation
Random functions I use in my config joined as a plugin for easy access
- Host: GitHub
- URL: https://github.com/mrs4ndman/random.nvim
- Owner: mrs4ndman
- License: mit
- Created: 2023-12-26T16:49:20.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-26T15:31:09.000Z (10 months ago)
- Last Synced: 2024-01-26T16:39:56.014Z (10 months ago)
- Language: Lua
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Random compilation of functions that seem useful :D
### Installation ↓
- With `lazy.nvim`
```lua
{
"mrs4ndman/random.nvim",
lazy = false,
config = function()
require("random")
end,
}
```- Putting strings like `;`, `}` and any other (with spaces) at the beginning / end of a line:
- Takes strings as arguments
- It doesn't work well with multiple of the same string at the beginning / end```lua
vim.keymap.set("n", ";", function()
require("random").put_at_end(";")
end)vim.keymap.set("n", "}", function()
require("random").put_at_end("}")
end)vim.keymap.set("n", "-", function()
require("random").put_at_beginning("- ")
end)
```- Increasing / decreasing current line Markdown header level
```lua
vim.keymap.set("n", "hi", function()
require("random").increase_header()
end)vim.keymap.set("n", "hd", function()
require("random").decrease_header()
end)
```- Create Markdown codeblocks of the desired language via `vim.ui.input` and dropping you inside them
```lua
vim.keymap.set("n", "C", function()
require("random").md_block()
end)
```- Swap current character under the cursor with the previous / next one
```lua
vim.keymap.set("n", "sb", function()
require("random").swap_char_backwards()
end)vim.keymap.set("n", "sf", function()
require("random").swap_char_forwards()
end)
```