Skip to content

Commit

Permalink
Improve completion trigger pattern (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh authored Sep 20, 2023
1 parent 256ca78 commit edc85df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions lua/obsidian/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit edc85df

Please sign in to comment.