Skip to content

nvim-orgmode/org-bullets.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Org-bullets.nvim

This plugin is a clone of org-bullets. It replaces the asterisks in org syntax with unicode characters.

This plugin is an extension intended for use with orgmode.nvim

This plugin works by using neovim extmarks, rather than conceal for a few reasons.

  • conceal can only have one global highlight see :help hl-Conceal.
  • conceal doesn't work when a block is folded.

see below for a simpler conceal-based solution

folded

Pre-requisites

  • This plugin requires the use of treesitter with tree-sitter-org installed
  • neovim 0.7+

Installation

With packer.nvim

use 'akinsho/org-bullets.nvim'

Usage

To use the defaults use:

use {'akinsho/org-bullets.nvim', config = function()
  require('org-bullets').setup()
end}

The full options available are:

NOTE: Do NOT copy and paste this block as it is not valid, it is just intended to show the available configuration options

use {"akinsho/org-bullets.nvim", config = function()
  require("org-bullets").setup {
    concealcursor = false, -- If false then when the cursor is on a line underlying characters are visible
    symbols = {
      -- list symbol
      list = "",
      -- headlines can be a list
      headlines = { "", "", "", "" },
      -- or a function that receives the defaults and returns a list
      headlines = function(default_list)
        table.insert(default_list, "")
        return default_list
      end,
      -- or false to disable the symbol. Works for all symbols
      headlines = false,
      -- or a table of tables that provide a name
      -- and (optional) highlight group for each headline level
      headlines = { 
        { "", "MyBulletL1" }
        { "", "MyBulletL2" },
        { "", "MyBulletL3" },
        { "", "MyBulletL4" },
      },
      checkboxes = {
        half = { "", "@org.checkbox.halfchecked" },
        done = { "", "@org.keyword.done" },
        todo = { "˟", "@org.keyword.todo" },
      },
    }
  }
end}

Conceal-based alternative

A simpler conceal based alternative is:

syntax match OrgHeadlineStar1 /^\*\ze\s/me=e-1 conceal cchar= containedin=OrgHeadlineLevel1 contained
syntax match OrgHeadlineStar2 /^\*\{2}\ze\s/me=e-1 conceal cchar= containedin=OrgHeadlineLevel2 contained
syntax match OrgHeadlineStar3 /^\*\{3}\ze\s/me=e-1 conceal cchar= containedin=OrgHeadlineLevel3 contained
syntax match OrgHeadlineStar4 /^\*{4}\ze\s/me=e-1 conceal cchar= containedin=OrgHeadlineLevel4 contained