summaryrefslogtreecommitdiff
path: root/lua/blink/cmp/sources/path/regex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/blink/cmp/sources/path/regex.lua')
-rw-r--r--lua/blink/cmp/sources/path/regex.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/lua/blink/cmp/sources/path/regex.lua b/lua/blink/cmp/sources/path/regex.lua
new file mode 100644
index 0000000..af27d25
--- /dev/null
+++ b/lua/blink/cmp/sources/path/regex.lua
@@ -0,0 +1,10 @@
+local NAME_REGEX = '\\%([^/\\\\:\\*?<>\'"`\\|]\\)'
+local PATH_REGEX =
+ assert(vim.regex(([[\%(\%(/PAT*[^/\\\\:\\*?<>\'"`\\| .~]\)\|\%(/\.\.\)\)*/\zePAT*$]]):gsub('PAT', NAME_REGEX)))
+
+return {
+ --- Lua pattern for matching file names
+ NAME = '[^/\\:*?<>\'"`|]',
+ --- Vim regex for matching file paths
+ PATH = PATH_REGEX,
+}