epwalsh / epwalsh/obsidian.nvim

Slowdown when closing a window

Open
#768 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
6.2k
Forks
250
PR merge metrics
No merged PRs in 30d

Description

### 🐛 Describe the bug

Hi, and thanks for the wonderful plugin!

I've noticed that closing a window with .md document in it exhibits some slowdown. It takes approximately a second between the keypress and the window actually closing. I'm not sure what is this related to.

I tried disabling nvim-treesitter for a start, but it didn't help. However, disabling `obsidian.nvim` plugin helps.

Can you please advise on what could the possible culprits be, or how to debug this?

### Config

```
require("obsidian").setup({
workspaces = {
{
name = "default",
path = "$NOTES",
},
},
picker = {
-- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'.
name = "fzf-lua", --"mini.pick",
-- Optional, configure key mappings for the picker. These are the defaults.
-- Not all pickers support all mappings.
note_mappings = {
-- Create a new note from your query.
new = "",
-- Insert a link to the selected note.
insert_link = "",
},
tag_mappings = {
-- Add tag(s) to current note.
tag_note = "",
-- Insert a tag at the current location.
insert_tag = "",
},
},
-- 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 suffix = ""
if title ~= nil then
-- If title is given, transform it into valid file name.
suffix = 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
suffix = suffix .. string.char(math.random(65, 90))
end
end
return os.date('%y%m%d%H%M') .. "-" .. suffix
end,
preferred_link_style = "markdown"
})
```

### Environment

```
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
Run "nvim -V1 -v" for more info

Obsidian.nvim v3.9.0 (14e0427bef6c55da0d63f9a313fd9941be3a2479)
Status:
• buffer directory: nil
• working directory: /Users/vitvly/notes
Workspaces:
✓ active workspace: Workspace(name='default', path='/Users/vitvly/notes', root='/Users/vitvly/notes')
Dependencies:
✓ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
✓ nvim-cmp: f17d9b4394027ff4442b298398dfcaab97e40c4f
✓ fzf-lua: ce1e24f2a48089b65deefcb0a71a9856839002b5
Integrations:
✓ picker: FzfPicker()
✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
all sources:
Tools:
✓ rg: ripgrep 14.1.1
Environment:
• operating system: Darwin
Config:
• notes_subdir: nil%

Contributor guide

Open the contributing guide

Research direction

Reproduce the roughly one-second delay when closing a window containing a .md document with the reported Obsidian.nvim configuration. Compare the behavior with obsidian.nvim disabled and use Neovim profiling or logging to identify the plugin work occurring during close. Done means the closing delay is removed or its cause is isolated and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.