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

Undoing changes requires pressing u twice to undo pre_write_note first #736

Open
Oneechan69 opened this issue Oct 1, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Oneechan69
Copy link

Oneechan69 commented Oct 1, 2024

🐛 Describe the bug

I applied this config from #595 to add a date modified frontmatter value to my notes after writing changes to them. After doing so, I may want to undo the change I just made, but pressing u once doesn't work as that seems to undo the frontmatter change, so I have to press it again.

Reproduction: Add and following the following config option in obsidian.nvim, then write to a note, watch the frontmatter value get updated, then try to undo the change by pressing u in normal mode.

Config

  {
    "epwalsh/obsidian.nvim",
      callbacks = {
        -- Runs right before writing the buffer for a note.
        ---@param client obsidian.Client
        ---@param note obsidian.Note
        ---@diagnostic disable-next-line: unused-local
        pre_write_note = function(client, note)
          note:add_field("Date Modified", os.date())
        end,
      },
    },
  },

Environment

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1725453128
E247: No server specified with --server. Editing locallyObsidian.nvim v3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
  • buffer directory: nil
  • working directory: /Users/username
Workspaces:
  ✓ active workspace: Workspace(name='Personal Vault', path='/Users/username/Desktop/Personal-Vault', root='/Users/username/Desktop/Personal-Vault')
Dependencies:
  ✓ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
  ✓ nvim-cmp: ae644feb7b67bf1ce4260c231d1d4300b19c6f30
  ✓ telescope.nvim: a0bbec21143c7bc5f8bb02e0005fa0b982edc026
  ✓ fzf-lua: fb00a0dec19ad03140f26b56fa76973c921147dc
Integrations:
  ✓ picker: TelescopePicker()
  ✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
    all sources:
      • nvim_lsp
      • luasnip
      • buffer
Tools:
  ✓ rg: ripgrep 14.1.1
Environment:
  • operating system: Darwin
Config:
  • notes_subdir: nil⏎
@Oneechan69 Oneechan69 added the bug Something isn't working label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant