Skip to content

The front matter is automatically replaced when saved using obsidian.nvim. #826

Open
@tadsn3w

Description

@tadsn3w

🐛 Describe the bug

If a file has frontmatter and it’s saved in Neovim, the front matter changes. It doesn’t matter if it’s an old file with front matter or if I just added a new template when it’s saved; the changes occur.

This is originally in Obsidian:
Image

After saving the file:
Image

Config

 return {
	"epwalsh/obsidian.nvim",
	version = "*",
	lazy = true,
	disable_frontmatter = true,
	ft = { "markdown", "markdown.obsidian" }, -- Ensures it only loads for Obsidian-specific Markdown files
	dependencies = {
		"nvim-lua/plenary.nvim",
	},
	opts = {
		workspaces = {
			{
				name = "mind",
				path = "/Users/Developer/vaults/My_mind",
			},
		},

		notes_subdir = "notes",

	completion = {
			nvim_cmp = true,
			min_chars = 2,
		},

		new_notes_location = "notes_subdir",
		preferred_link_style = "wiki",

		templates = {
			folder = "Templates",
			date_format = "%Y-%m-%d",
			time_format = "%H:%M",
		},

		picker = {
			name = "telescope.nvim",
		},

		sort_by = "modified",
		sort_reversed = true,

		attachments = {
			img_folder = "assets/imgs",
		},
	},

	config = function(_, opts)
		vim.opt.conceallevel = 1


		opts.mappings = opts.mappings or {} -- ✅ Ensure mappings exist
		opts.mappings["<CR>"] = nil -- ✅ Correct way to disable Enter remap

		-- Ensure Obsidian is set up correctly
		require("obsidian").setup(opts)

	end,
}
	

Environment

nvim --version

NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1734355927

nvim --headless -c 'lua require("obsidian").info()' -c q

Obsidian.nvim v3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
  • buffer directory: nil
  • working directory: /Volumes/S-980-1TB/Developer/.config/zellij
Workspaces:
  ✓ active workspace: Workspace(name='mind', path='/Users/Developer/vaults/My_mind', root='/Users/Developer/vaults/My_mind')
Dependencies:
  ✓ plenary.nvim: 857c5ac632080dba10aae49dba902ce3abf91b35
  ✓ nvim-cmp: 12509903a5723a876abd65953109f926f4634c30
  ✓ telescope.nvim: a0bbec21143c7bc5f8bb02e0005fa0b982edc026
  ✓ fzf-lua: 562593abac4f2796d0cf622876527cfb8d274639
Integrations:
  ✓ picker: TelescopePicker()
  ✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
    all sources:
      • lazydev
      • nvim_lsp
      • luasnip
      • path
      • tabnine
Tools:
  ✓ rg: ripgrep 14.1.1
Environment:
  • operating system: Darwin
Config:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions