added keyd config with mapping altgr+oklm as navigation and other

This commit is contained in:
ohinh 2026-09-14 22:21:46 +02:00
parent f2f98d6fee
commit 64bbe514fb
203 changed files with 10630 additions and 3 deletions

View file

@ -0,0 +1,54 @@
-- ZETTLR ZETTELKASTEN-LINK FILTER
--
-- (c) 2025 (2021) Hendrik Erz
--
-- This Lua-filter can unlink or remove internal links as they are being used by
-- Zettlr based on preferences set in the program.
-- Two important notes for this file:
-- 1.) The corresponding wikilink extension MUST be active, as this filter only
-- looks for "Link" type inlines. Zettlr's exporter will already do this.
-- If you wish to use this filter elsewhere, ensure to enable the extension
-- manually.
-- 2.) This filter requires at least Pandoc 3.6.3, since it will distinguish
-- wikilinks from regular links by looking up the classes list, which before
-- 3.6.3 was in the title value of the Link.
-- 3.) You can programmatically steer this filter on a per-file basis (even
-- inside Zettlr) by setting the YAML frontmatter property
-- `zettlr.strip_links` to either "no", "full", or "unlink".
-- Prepare our setting variable
local strip_links = 'no' -- Can be 'full'|'unlink'|'no'
return {
{
Meta = function (meta)
-- Retrieve the option required for this filter if they exist.
if meta.zettlr then
if meta.zettlr.strip_links then
strip_links = meta.zettlr.strip_links
end
end
return meta
end
},
{
-- Zettelkasten/internal/wiki links are represent as Link nodes on Pandoc's
-- AST.
Link = function (elem)
-- NOTE: Wikilinks are distinguished from regular links by having the
-- class "wikilink" (cf. https://github.com/jgm/pandoc/commit/97b36ecb7703b434ed4325cc128402a9eb32418d)
if strip_links == 'no' or elem.classes[1] ~= "wikilink" then
-- nothing to do -> return `nil` as per the documentation
-- (cf. https://pandoc.org/lua-filters.html#lua-filter-structure)
return nil
elseif strip_links == 'unlink' then
-- Return the content for the link (a list of inlines), thereby
-- unlinking it.
return elem.content
elseif strip_links == 'full' then
-- Remove the link altogether by returning an empty list
return {}
end
end,
}
}

View file

@ -0,0 +1,60 @@
-- ZETTLR ZETTELKASTEN-TAG FILTER
--
-- (c) 2021 Hendrik Erz
--
-- This filter is able to remove tags based on the corresponding metadata value.
-- If the metadata value zettlr.strip_tags is set to true either in the YAML
-- frontmatter section of a file or the metadata section of a defaults file,
-- this filter will remove anything that looks like a tag. Since Lua does not
-- have a RegExp implementation, it will try its best, but it cannot be
-- guaranteed that anything will be removed or kept as it's visually indicated
-- in the editor. Notably, escaped tags such as \#this-is-not-a-tag will be
-- considered tags nevertheless because Pandoc removes backslashes in front of
-- the #-sign, so we cannot check for that.
-- Allowed characters before a hashtag (note we're not checking for whitespace
-- since that's already being removed by Pandoc)
local pattern_before = "([%(%[{]+)"
-- The actual tag pattern; a stripped-down version of the RegExp we're using
-- internally (see the getZknTagRE-property in regular-expressions.js).
local tag_pattern = "#(#?[^%s,.:;…!?\"'`»«“”‘’—–@%$%%&*#^+~÷\\/|<=>[%](){}]+#?)"
-- This variable will be set to true if the user has set the corresponding
-- option in the preferences.
local strip_tags = false
return {
{
-- First, extract our metadata property
Meta = function (meta)
if meta.zettlr and meta.zettlr.strip_tags == true then
strip_tags = true
end
return meta
end
},
{
-- Then, iterate over all Str elements and remove those that look like tags.
-- NOTE: Due to Pandoc stripping away escape characters, any \# will become
-- just # in the AST. If you use \\, then we will have \# here, *but* also
-- in the output. So it's best to avoid any situation where you have to
-- write (whitespace)#(non-whitespace) since that *will* also be removed.
Str = function (elem)
if not strip_tags then
-- Do not alter if we shouldn't remove tags.
return nil
end
-- I've asked Albert and he mentioned "Str" classes literally match
-- words separated by whitespace within Inlines (so the textual contents
-- of headings, paragraphs, links, etc ...)
if elem.text:match(pattern_before .. tag_pattern) then
-- The tag was preceeded by one or more allowed characters (opening brackets)
elem.text = elem.text:gsub(tag_pattern, "%1")
elseif elem.text:match("^" .. tag_pattern) then
-- The tag literally makes up the Str element
elem.text = elem.text:gsub(tag_pattern, "")
end
return elem
end,
}
}