Skip to content

sciccolella/cmacro.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

cmacro

Plugin to perform common operations on c/c++ macro editing: - Toggle linebreak at the end of line(s) - Toggle comments inline in in-macro lines

Installation

{
    "sciccolella/cmacro.nvim",
    config = function()
        require("cmacro").setup()
    end,
    ft = { "c", "cpp" },
    lazy = true,
}

Keymaps

  vim.keymap.set("n", "gm", M.cmacro_comment_toggle_single_line, { desc = "c[M]acro toggle in-macro comment" })
  vim.keymap.set("v", "gm", M.cmacro_comment_toggle_visual_line, { desc = "c[M]acro toggle in-macro comment" })
  vim.keymap.set(
    "n",
    "<leader>ml",
    M.cmacro_lineabreak_toggle_single_line,
    { desc = "c[M]acro toggle macro [L]inebreak" }
  )
  vim.keymap.set(
    "v",
    "<leader>ml",
    M.cmacro_linebreak_toggle_visual_line,
    { desc = "c[M]acro toggle macro [L]inebreak" }
  )

Examples

#define test(x, y)                                                             \
  do {                                                                         \
    int zx = 21;                                                               \
    typeof(y) yy = 0;                                                          \
    yy += x;                                                                   \
  } while (0)

// Inline in-macro comment on line 4 [gm] in either normal or visual mode

#define test(x, y)                                                             \
  do {                                                                         \
    int zx = 21;                                                               \
    typeof(y) yy = 0;                                                          \
    /* yy += x; */                                                             \
  } while (0)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages