Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)
```