epwalsh / obsidian.nvim

Obsidian 🤝 Neovim
Apache License 2.0
3.3k stars 150 forks source link

conceallevel warning with conceallevel=2 #617

Open Isos9 opened 1 month ago

Isos9 commented 1 month ago

🐛 Describe the bug

Hi,

I get warnings for the conceallevel even though it's set at 2: "Obsidian additional syntax features require 'conceallevel' to be set to 1 or 2, but you have 'conceallevel' set to '3'. "

my way of reproducing is restart nvim and open an md file :vsp my_file.md. And I always check before with :set conceallevel? to see if maybe there is something that changes the conceallevel but I don't see it. I believe there is a command to check if a plugin or a line code in the config that changes it but I don't remember it.

Thanks

Config

require('obsidian').setup {
    workspaces = {
        {
            name = 'work',
            path = '~/Documents/Brain',
        },
        {
            name = 'no-vault',
            path = function()
                -- alternatively use the CWD:
                -- return assert(vim.fn.getcwd())
                return assert(vim.fs.dirname(vim.api.nvim_buf_get_name(0)))
            end,
            overrides = {
                notes_subdir = vim.NIL, -- have to use 'vim.NIL' instead of 'nil'
                new_notes_location = 'current_dir',
                templates = {
                    folder = vim.NIL,
                },
                disable_frontmatter = true,
            },
        },
    },
    daily_notes = {
        -- Optional, if you keep daily notes in a separate directory.
        folder = 'dailies',
        -- Optional, if you want to change the date format for the ID of daily notes.
        date_format = '%Y-%m-%d',
        -- Optional, if you want to change the date format of the default alias of daily notes.
        alias_format = '%B %-d, %Y',
        -- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
        template = nil,
    },
    -- Optional, customize how note IDs are generated given an optional title.
    ---@param title string|?
    ---@return string
    note_id_func = function(title)
        -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
        -- In this case a note with the title 'My new note' will be given an ID that looks
        -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
        local prefix = ''
        if title ~= nil then
            -- If title is given, transform it into valid file name.
            prefix = title:gsub(' ', '-'):gsub('[^A-Za-z0-9-]', ''):lower()
        else
            -- If title is nil, just add 4 random uppercase letters to the suffix.
            for _ = 1, 4 do
                prefix = prefix .. string.char(math.random(65, 90))
            end
        end
        return prefix .. '-' .. tostring(os.time())
    end,
    -- URL it will be ignored but you can customize this behavior here.
    ---@param url string
    follow_url_func = function(url)
        -- Open the URL in the default web browser.
        vim.fn.jobstart { 'xdg-open', url } -- linux
    end,
    mappings = {
        ['<leader>oy'] = {
            action = function()
                return vim.cmd 'ObsidianYesterday'
            end,
            opts = { buffer = true },
        },
        ['<leader>ot'] = {
            action = function()
                return vim.cmd 'ObsidianTomorrow'
            end,
            opts = { buffer = true },
        },
        ['<leader>oo'] = {
            action = function()
                return vim.cmd 'ObsidianToday'
            end,
            opts = { buffer = true },
        },
        ['<C-f>'] = {
            action = function()
                return vim.cmd 'ObsidianQuickSwitch'
            end,
            opts = { buffer = true },
        },
    },
}

Environment

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1692716794

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info Obsidian.nvim v3.7.6 (d70f3289399c25153b7f503b838afbf981124a37) Status: • buffer directory: nil • working directory: /home/isos9 Workspaces: ✓ active workspace: Workspace(name='no-vault', path='/home/isos9', root='/home/isos9') ✗ inactive workspace: Workspace(name='work', path='/home/isos9/Documents/Brain', root='/home/isos9/Documents/Brain') Dependencies: ✓ plenary.nvim: 253d34830709d690f013daf2853a9d21ad7accab ✓ nvim-cmp: d3a2833c118843859c667f64b6169e22bffe13d0 ✓ telescope.nvim: 4522d7e3ea75ffddabdc39957168a8a7060b5df0 Integrations: ✓ picker: TelescopePicker() ✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new all sources: • luasnip • nvim_lsp • path • nvim_lua • buffer Tools: ✓ rg: ripgrep 14.1.0 Environment: • operating system: Linux Config: • notes_subdir: nil

epwalsh commented 1 month ago

Hey @Isos9, :verbose set conceallevel? might tell you. Otherwise you could just grep for conceallevel in your plugin directory. I realize this must be annoying so I made sure this message will only pop up once, at most in b8ca513.

Isos9 commented 1 month ago

Hi @epwalsh, I tested the verbose, and the conceallevel is set at 2 from my config with my line vim.opt.conceallevel = 2.

which is why it's strange that I have this warning every time (I open a new instance of neovim) even though it's set at 2.

when I open an .md, I have the vimwiki plugin that reset it at 2, but that's it, looking at the code of vimwiki, nowhere it's set at 0 or 3 before