Skip to content

Random functions I use in my config joined as a plugin for easy access

License

Notifications You must be signed in to change notification settings

mrs4ndman/random.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Random functions I use in my config joined as a plugin for easy access

Resources

License

Stars

Watchers

Forks

Languages