Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Makdown notes support #580

Closed
Zeioth opened this issue Sep 3, 2023 · 1 comment · Fixed by #575
Closed

Proposal: Makdown notes support #580

Zeioth opened this issue Sep 3, 2023 · 1 comment · Fixed by #575
Labels
enhancement New feature or request

Comments

@Zeioth
Copy link

Zeioth commented Sep 3, 2023

I've coded these highlights for taking personal notes for NormalNvim which ships with Tokyonight, but if you are interested in adding it too to catppuccin, I leave you the code here. Cheers!

screenshot_2023-09-03_21-38-40_953209353

  -- Markdown notes highlights
  vim.api.nvim_create_autocmd({ "BufReadPost", "InsertLeave" }, {
    desc = "Highligh markdown notes.",
    group = vim.api.nvim_create_augroup("markdown_notes_hl", { clear = true }),
    callback = function()
      if vim.bo.filetype == "markdown" then
        vim.defer_fn(function()
          -- TASK:
          vim.cmd(":silent! highlight clear MarkdownTask")
          vim.cmd(":highlight MarkdownTask guifg=" .. c.teal .. " gui=bold")
          vim.cmd(":syntax match MarkdownTask /\\cTask:/")

          -- TODO:
          vim.cmd(":silent! highlight clear MarkdownTodo")
          vim.cmd(":highlight MarkdownTodo guifg=" .. c.yellow .. " gui=bold")
          vim.cmd(":syntax match MarkdownTodo /\\cTODO:/")

          -- NOTE:
          vim.cmd(":silent! highlight clear MarkdownNote")
          vim.cmd(":highlight MarkdownNote guifg=" .. c.red .. " gui=bold")
          vim.cmd(":syntax match MarkdownNote /\\cNOTE:/")

          -- SEE:
          vim.cmd(":silent! highlight clear MarkdownSee")
          vim.cmd(":highlight MarkdownSee guifg=" .. c.blue .. " gui=bold")
          vim.cmd(":syntax match MarkdownSee /\\cSEE:/")

          -- CHECK:
          vim.cmd(":silent! highlight clear MarkdownCheck")
          vim.cmd(":highlight MarkdownCheck guifg=" .. c.green .. " gui=bold")
          vim.cmd(":syntax match MarkdownCheck /\\cCHECK:/")

          -- URL:
          vim.cmd(":silent! highlight clear MarkdownURL")
          vim.cmd(":highlight MarkdownURL guifg=" .. c.purple .. " gui=bold")
          vim.cmd(":syntax match MarkdownURL /\\cURL:/")

          -- EXAMPLE:
          vim.cmd(":silent! highlight clear MarkdownExample")
          vim.cmd(":highlight MarkdownExample guifg=" .. c.magenta .. " gui=bold")
          vim.cmd(":syntax match MarkdownExample /\\cExample:/")
        end, 100)
      end
    end,
  })

The only required change is writing the actual colors used by catppuccin C.somecolor.

@Zeioth Zeioth added the enhancement New feature or request label Sep 3, 2023
@nullchilly
Copy link
Contributor

nullchilly commented Sep 4, 2023

The only required change is writing the actual colors used by catppuccin C.somecolor.

This isn't true at the moment because your markdown note support code is inside your own tokyonight fork. Furthermore, catppuccin doesn't and never will define a custom autocmd as it's not a colorscheme's business to cause side effects to users.

Here's my best effort for your neovim distribution: integrations/NormalNvim.lua

{
    "catppuccin/nvim",
    name = "catppuccin",
    event = "User LoadColorSchemes",
    config = function()
      require("catppuccin").setup { integrations = { NormalNvim = true } }
      -- Markdown notes highlights
      vim.api.nvim_create_autocmd({ "BufReadPost", "InsertLeave" }, {
        desc = "Highligh markdown notes.",
        group = vim.api.nvim_create_augroup("markdown_notes_hl", { clear = true }),
        callback = function()
          if vim.bo.filetype == "markdown" then
            vim.defer_fn(
              function()
                vim.cmd [[ syntax match MarkdownTask /\cTask:/ | syntax match MarkdownTodo /\cTODO:/ | syntax match MarkdownNote /\cNOTE:/ | syntax match MarkdownSee /\cSEE:/ | syntax match MarkdownCheck /\cCHECK:/ | syntax match MarkdownURL /\cURL:/ | syntax match MarkdownExample /\cExample:/ ]]
              end,
              100
            )
          end
        end,
      })
    end,
  }

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants