aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorDefaultGen <gravel.justness270@slmail.me>2024-06-20 19:56:55 -0400
committerDefaultGen <gravel.justness270@slmail.me>2024-06-20 19:56:55 -0400
commit600c9c7bb626c23938ffed1ab74492394f3e28df (patch)
treed0e0d351a00c2668ee9179752f2abbaa96c4dbbe /lua
parent7287c24b0b9370da70d8dbb1a6fb98c76e2cfb11 (diff)
downloaddenote-fzf-lua-600c9c7bb626c23938ffed1ab74492394f3e28df.tar.gz
Changed tags to keywords
Diffstat (limited to 'lua')
-rw-r--r--lua/denote-fzf-lua.lua12
-rw-r--r--lua/denote-fzf-lua/config.lua14
-rwxr-xr-xlua/denote-fzf-lua/scripts/fallback_search_files.sh4
-rwxr-xr-xlua/denote-fzf-lua/scripts/search_files.sh6
4 files changed, 18 insertions, 18 deletions
diff --git a/lua/denote-fzf-lua.lua b/lua/denote-fzf-lua.lua
index 846361d..180de4a 100644
--- a/lua/denote-fzf-lua.lua
+++ b/lua/denote-fzf-lua.lua
@@ -63,7 +63,7 @@ end
---Format the --with-nth argument for fzf (which fields are shown)
function M.format_fzf_with_nth(options)
local fzf_with_nth = ""
- local fields = {"path", "date", "time", "sig", "title", "tags", "ext" }
+ local fields = {"path", "date", "time", "sig", "title", "keywords", "ext" }
for i, v in ipairs(fields) do
if options.search_fields[v] then
fzf_with_nth = fzf_with_nth .. i .. ','
@@ -88,12 +88,12 @@ function M.recombine_filename(filename)
vim.print(filename)
local t = {}
filename = filename:gsub("%s%s+", "|")
- t.path, t.year, t.month, t.day, t.hour, t.min, t.sec, t.sig, t.title, t.tags, t.ext =
+ t.path, t.year, t.month, t.day, t.hour, t.min, t.sec, t.sig, t.title, t.keywords, t.ext =
filename:match("^(.*/)|(%d%d%d%d)%-(%d%d)%-(%d%d)|(%d%d):(%d%d):(%d%d)|([^|]+)|([^|]+)|([^|]+)|(%..+)")
- t.sig = M.repopulate_field(t.sig,"=")
- t.title = M.repopulate_field(t.title,"-")
- t.tags = M.repopulate_field(t.tags,"_")
- return t.path .. t.year .. t.month .. t.day .. "T" .. t.hour .. t.min .. t.sec .. t.sig .. t.title .. t.tags .. t.ext
+ t.sig = M.repopulate_field(t.sig,"=")
+ t.title = M.repopulate_field(t.title,"-")
+ t.keywords = M.repopulate_field(t.keywords,"_")
+ return t.path .. t.year .. t.month .. t.day .. "T" .. t.hour .. t.min .. t.sec .. t.sig .. t.title .. t.keywords .. t.ext
end
---@param options table of user options
diff --git a/lua/denote-fzf-lua/config.lua b/lua/denote-fzf-lua/config.lua
index fa878ce..7fba4dc 100644
--- a/lua/denote-fzf-lua/config.lua
+++ b/lua/denote-fzf-lua/config.lua
@@ -6,13 +6,13 @@ M.defaults = {
-- Choose which fields appear in search results
search_fields = {
- path = false,
- date = true,
- time = false,
- sig = false,
- title = true,
- tags = true,
- ext = false,
+ path = false,
+ date = true,
+ time = false,
+ sig = false,
+ title = true,
+ keywords = true,
+ ext = false,
},
-- Settings for fzf-lua. See fzf-lua doc for full list of options
diff --git a/lua/denote-fzf-lua/scripts/fallback_search_files.sh b/lua/denote-fzf-lua/scripts/fallback_search_files.sh
index 430d058..0c07d87 100755
--- a/lua/denote-fzf-lua/scripts/fallback_search_files.sh
+++ b/lua/denote-fzf-lua/scripts/fallback_search_files.sh
@@ -5,12 +5,12 @@ sed -E "s/^(.*\/)?([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]T[0-9][0-9][0-9][0-9]
tr '\=\-_' ' ' |\
sed -E 's/([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])T([0-9][0-9])([0-9][0-9])([0-9][0-9])/\1-\2-\3,\4:\5:\6/' |\
sed 's/,,/,.,/g' |\
-column -t -s "," -N Path,Date,Time,Sig,Title,Tags,Ext
+column -t -s "," -N Path,Date,Time,Sig,Title,Keywords,Ext
# 1. find everything in directory
# 2. sed deletes every line that isn't a Denote note (can't do this with find alone because -regex can't match optional capture groups)
# 3. sed splits the Denote filename into , delimited fields (pa
-# 4. tr replaces sig, title, tags special characters with spaces
+# 4. tr replaces sig, title, keywords special characters with spaces
# 5. sed splits the date and time nicely
# 6. sed replaces blank fields with a period
# 7. column pretty prints the filenames in a table
diff --git a/lua/denote-fzf-lua/scripts/search_files.sh b/lua/denote-fzf-lua/scripts/search_files.sh
index 3b0379c..cc64eba 100755
--- a/lua/denote-fzf-lua/scripts/search_files.sh
+++ b/lua/denote-fzf-lua/scripts/search_files.sh
@@ -1,7 +1,7 @@
#/usr/bin/sh
-(echo "Path,Date,Time,Sig,Title,Tags,Ext";
+(echo "Path,Date,Time,Sig,Title,Keywords,Ext";
fd '^\d{8}T\d{6}(==[a-z0-9=]+)?(\-\-[a-z0-9-]+)?(__[a-z0-9_]+)?\.\w+$' $1 |\
-sd '(?P<path>\/.*\/)?(?P<datetime>\d{8}T\d{6})(==(?P<sig>[a-z0-9=]+))?(--(?P<title>[a-z0-9-]+))(__(?P<tags>[a-z0-9_]+))?(?P<ext>\.\w+)' '$path,$datetime,$sig,$title,$tags,$ext' |\
+sd '(?P<path>\/.*\/)?(?P<datetime>\d{8}T\d{6})(==(?P<sig>[a-z0-9=]+))?(--(?P<title>[a-z0-9-]+))(__(?P<keywords>[a-z0-9_]+))?(?P<ext>\.\w+)' '$path,$datetime,$sig,$title,$keywords,$ext' |\
tr '\=\-_' ' ' |\
sd '(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})' '$1-$2-$3,$4:$5:$6') |\
sd ',,' ',.,' |\
@@ -10,7 +10,7 @@ qsv table
# 1. echo the table headers
# 2. fd only Denote files in $1 directory (and subdirectories)
# 3. sd chops the Denote filename fields into a CSV
-# 4. tr replaces special characters in sig, title, and tags with spaces
+# 4. tr replaces special characters in sig, title, and keywords with spaces
# 5. sd formats the date and time as YYYY-MM-DD HH:MM:SS
# 6. sd replaces blank fields with . (fzf can't handle blank fields)
# 7. qsv to print the fields in tabular format