Skip to content

Latest commit

 

History

History
87 lines (73 loc) · 1.97 KB

README.md

File metadata and controls

87 lines (73 loc) · 1.97 KB

Random compilation of functions that seem useful :D

Installation ↓

  • With lazy.nvim
{
  "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
vim.keymap.set("n", "<leader>;", function()
  require("random").put_at_end(";")
end)

vim.keymap.set("n", "<leader>}", function()
  require("random").put_at_end("}")
end)

vim.keymap.set("n", "<leader>-", function()
  require("random").put_at_beginning("- ")
end)
  • Increasing / decreasing current line Markdown header level
vim.keymap.set("n", "<leader>hi", function()
  require("random").increase_header()
end)

vim.keymap.set("n", "<leader>hd", function()
  require("random").decrease_header()
end)
  • Create Markdown codeblocks of the desired language via vim.ui.input and dropping you inside them
vim.keymap.set("n", "<leader>C", function()
  require("random").md_block()
end)
  • Swap current character under the cursor with the previous / next one
vim.keymap.set("n", "<leader>sb", function()
  require("random").swap_char_backwards()
end)

vim.keymap.set("n", "<leader>sf", function()
  require("random").swap_char_forwards()
end)