From edc85dfe562c4d2328cfb64db5dba178c4abbef4 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 20 Sep 2023 09:05:41 -0700 Subject: [PATCH] Improve completion trigger pattern (#198) --- CHANGELOG.md | 1 + lua/obsidian/completion.lua | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bc95b430..aba5dd97b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed `ObsidianFollowLink` when the note path contains a block link (e.g. `[[foo#^Bar]]`). - Fixed `:ObsidianOpen` doesn't work in WSL2 - Use [wsl-open](https://gitlab.com/4U6U57/wsl-open) +- Improved completion start pattern to trigger anytime `[[` is typed. ## [v1.13.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v1.13.0) - 2023-08-24 diff --git a/lua/obsidian/completion.lua b/lua/obsidian/completion.lua index d661ab4f9..f260d8889 100644 --- a/lua/obsidian/completion.lua +++ b/lua/obsidian/completion.lua @@ -47,10 +47,10 @@ completion.get_trigger_characters = function() end completion.get_keyword_pattern = function() - -- See ':help pattern' - -- Note that the enclosing [=[ ... ]=] is just a way to mark the boundary of a + -- Note that this is a vim pattern, not a Lua pattern. See ':help pattern'. + -- The enclosing [=[ ... ]=] is just a way to mark the boundary of a -- string in Lua. - return [=[\%(\s\|^\|#\)\zs\[\{2}[^\]]\+\]\{,2}]=] + return [=[\%(^\|[^\[]\)\zs\[\{2}[^\]]\+\]\{,2}]=] end return completion