mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Merge pull request #274 from cnshsliu/main
Allow Chinese characters in tags
This commit is contained in:
@@ -2081,29 +2081,24 @@ local function FollowLink(opts)
|
||||
local filename_part = ""
|
||||
|
||||
-- first: check if we're in a tag or a link
|
||||
local kind, atcol, tag
|
||||
local kind
|
||||
local globArg = ""
|
||||
|
||||
if opts.follow_tag ~= nil then
|
||||
kind = "tag"
|
||||
tag = opts.follow_tag
|
||||
if opts.templateDir ~= nil then
|
||||
globArg = "--glob=!" .. "**/" .. opts.templateDir .. "/*.md"
|
||||
end
|
||||
else
|
||||
kind, atcol = check_for_link_or_tag()
|
||||
kind, _ = check_for_link_or_tag()
|
||||
end
|
||||
|
||||
if kind == "tag" then
|
||||
if atcol ~= nil then
|
||||
tag = taglinks.get_tag_at(
|
||||
vim.api.nvim_get_current_line(),
|
||||
atcol,
|
||||
M.Cfg
|
||||
)
|
||||
end
|
||||
search_mode = "tag"
|
||||
title = tag
|
||||
local saved_reg = vim.fn.getreg('"0')
|
||||
vim.cmd("normal yiw")
|
||||
title = vim.fn.getreg('"0')
|
||||
vim.fn.setreg('"0', saved_reg)
|
||||
else
|
||||
local saved_reg = vim.fn.getreg('"0')
|
||||
if kind == "link" then
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
local Job = require("plenary.job")
|
||||
|
||||
local M = {}
|
||||
local hashtag_re = "(^|\\s|'|\")#[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\\-_]*"
|
||||
-- PCRE hashtag allows to remove the hex color codes from hastags
|
||||
local hashtag_re_pcre =
|
||||
"(^|\\s|'|\")((?!(#[a-fA-F0-9]{3})(\\W|$)|(#[a-fA-F0-9]{6})(\\W|$))#[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\\-_]*)"
|
||||
local atsign_re = "(^|\\s|'|\")@[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\\-_]*"
|
||||
local atsign_re_pcre =
|
||||
"(^|\\s|'|\")((?!(@[a-fA-F0-9]{3})(\\W|$)|(@[a-fA-F0-9]{6})(\\W|$))@[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\\-_]*)"
|
||||
local colon_re = "(^|\\s):[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\\-_]*:"
|
||||
local yaml_re =
|
||||
"(^|\\s)tags:\\s*\\[\\s*([a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\\-_]*(,\\s*)*)*\\s*]"
|
||||
|
||||
local hashtag_re =
|
||||
"(^|\\s|'|\")#[a-zA-ZÀ-ÿ\\p{Script=Han}]+[a-zA-ZÀ-ÿ0-9/\\-_\\p{Script=Han}]*"
|
||||
-- PCRE hashtag allows to remove the hex color codes from hastags
|
||||
local hashtag_re_pcre = "(^|\\s|'|\")((?!(#[a-fA-F0-9]{3})(\\W|$)|(#[a-fA-F0-9]{6})(\\W|$))"
|
||||
.. "#[a-zA-ZÀ-ÿ\\p{Script=Han}]+[a-zA-ZÀ-ÿ0-9/\\-_\\p{Script=Han}]*)"
|
||||
local atsign_re =
|
||||
"(^|\\s|'|\")@[a-zA-ZÀ-ÿ\\p{Script=Han}]+[a-zA-ZÀ-ÿ0-9/\\-_\\p{Script=Han}]*"
|
||||
local atsign_re_pcre = "(^|\\s|'|\")((?!(@[a-fA-F0-9]{3})(\\W|$)|(@[a-fA-F0-9]{6})(\\W|$))"
|
||||
.. "@[a-zA-ZÀ-ÿ\\p{Script=Han}]+[a-zA-ZÀ-ÿ0-9/\\-_\\p{Script=Han}]*)"
|
||||
local colon_re =
|
||||
"(^|\\s):[a-zA-ZÀ-ÿ\\p{Script=Han}]+[a-zA-ZÀ-ÿ0-9/\\-_\\p{Script=Han}]*:"
|
||||
local yaml_re =
|
||||
"(^|\\s)tags:\\s*\\[\\s*([a-zA-ZÀ-ÿ\\p{Script=Han}]+[a-zA-ZÀ-ÿ0-9/\\-_\\p{Script=Han}]*(,\\s*)*)*\\s*]"
|
||||
local function command_find_all_tags(opts)
|
||||
opts = opts or {}
|
||||
opts.cwd = opts.cwd or "."
|
||||
|
||||
Reference in New Issue
Block a user