aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/denote-fzf-lua.lua4
-rwxr-xr-xlua/denote-fzf-lua/scripts/fallback_search_files.sh2
-rwxr-xr-xlua/denote-fzf-lua/scripts/search_files.sh4
3 files changed, 5 insertions, 5 deletions
diff --git a/lua/denote-fzf-lua.lua b/lua/denote-fzf-lua.lua
index 167ecb3..977bb23 100644
--- a/lua/denote-fzf-lua.lua
+++ b/lua/denote-fzf-lua.lua
@@ -90,7 +90,7 @@ function M.search_files(options)
vim.api.nvim_command("edit " .. vim.fn.fnameescape(filename))
end,
}
- local dir = vim.fn.expand(options.dir)
+ local dir = vim.fn.expand(vim.g.denote_dir or options.dir)
fzflua.fzf_exec(script .. " " .. dir, opts)
end
@@ -100,7 +100,7 @@ function M.search_contents(options)
return
end
local opts = {}
- opts.cwd = vim.fn.expand(options.dir)
+ opts.cwd = vim.fn.expand(vim.g.denote_dir or options.dir)
opts.previewer = "builtin"
opts.fzf_opts = options.fzf_lua_opts.fzf_opts
opts.actions = fzflua.defaults.actions.files
diff --git a/lua/denote-fzf-lua/scripts/fallback_search_files.sh b/lua/denote-fzf-lua/scripts/fallback_search_files.sh
index f6ee4fc..34fc1b1 100755
--- a/lua/denote-fzf-lua/scripts/fallback_search_files.sh
+++ b/lua/denote-fzf-lua/scripts/fallback_search_files.sh
@@ -2,7 +2,7 @@
find "$1" -not -path '*/.*' |\
sed -E "/^(.*\/)?([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])(==[^_\.\-]+)?(--[^_\.]+)?(__[^\.]+)?(\.[a-z0-9]+)$/!d" |\
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])(==([^_\.\-]+))?(--([^_\.]+))?(__([^\.]+))?(\.[a-z0-9]+)$/\1,\2,\4,\6,\8,\9/" |\
-tr '\=\-_' ' ' |\
+awk 'BEGIN{FS=OFS=","}{for(i=2;i<=NF;i++)gsub(/[=_-]/," ",$i)}1' |\
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,Keywords,Ext
diff --git a/lua/denote-fzf-lua/scripts/search_files.sh b/lua/denote-fzf-lua/scripts/search_files.sh
index 4367049..0050552 100755
--- a/lua/denote-fzf-lua/scripts/search_files.sh
+++ b/lua/denote-fzf-lua/scripts/search_files.sh
@@ -1,8 +1,8 @@
#!/bin/sh
(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<keywords>[a-z0-9_]+))?(?P<ext>\.\w+)' '$path,$datetime,$sig,$title,$keywords,$ext' |\
-tr '\=\-_' ' ' |\
+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' |\
+awk 'BEGIN{FS=OFS=","}{for(i=2;i<=NF;i++)gsub(/[=_-]/," ",$i)}1' |\
sd '(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})' '$1-$2-$3,$4:$5:$6') |\
sd ',,' ',.,' |\
qsv table