Minor fixes

pull/556/head
Arijit Basu 1 year ago
parent ac958c9532
commit 0cd5a9163d
No known key found for this signature in database
GPG Key ID: 0F8EF5258DC38077

@ -135,7 +135,14 @@ bookmark can be added, deleted, or jumped to.
- Tested on: MacOS
```lua
-- With `export XPLR_BOOKMARK_FILE="$HOME/bookmarks"`
-- Bookmark: mode binding
xplr.config.modes.builtin.default.key_bindings.on_key["b"] = {
help = "bookmark mode",
messages = {
{ SwitchModeCustom = "bookmark" },
},
}
xplr.config.modes.custom.bookmark = {
name = "bookmark",
key_bindings = {
@ -143,12 +150,13 @@ xplr.config.modes.custom.bookmark = {
m = {
help = "bookmark dir",
messages = {
{ BashExecSilently0 = [[
{
BashExecSilently0 = [[
PTH="${XPLR_FOCUS_PATH:?}"
if [ -d "${PTH}" ]; then
PTH="${PTH}"
elif [ -f "${PTH}" ]; then
PTH="$(dirname "${PTH}")"
PTH=$(dirname "${PTH}")
fi
PTH_ESC=$(printf %q "$PTH")
if echo "${PTH:?}" >> "${XPLR_BOOKMARK_FILE:?}"; then
@ -156,8 +164,9 @@ xplr.config.modes.custom.bookmark = {
else
"$XPLR" -m 'LogError: %q' "Failed to bookmark $PTH_ESC"
fi
]]
]],
},
"PopMode",
},
},
g = {
@ -169,18 +178,21 @@ xplr.config.modes.custom.bookmark = {
if [ "$PTH" ]; then
"$XPLR" -m 'FocusPath: %q' "$PTH"
fi
]===]
]===],
},
"PopMode",
},
},
d = {
help = "delete bookmark",
messages = {
{ BashExec0 = [[
{
BashExec0 = [[
PTH=$(cat "${XPLR_BOOKMARK_FILE:?}" | fzf --no-sort)
sd "$PTH\n" "" "${XPLR_BOOKMARK_FILE:?}"
]]
]],
},
"PopMode",
},
},
esc = {
@ -192,6 +204,7 @@ xplr.config.modes.custom.bookmark = {
},
},
}
```
</details>

@ -276,7 +276,7 @@ impl App {
.unwrap_or_else(env::temp_dir)
.join("xplr")
.join("session")
.join(&pid.to_string())
.join(pid.to_string())
.to_string_lossy()
.to_string();
@ -284,7 +284,7 @@ impl App {
session_path = env::temp_dir()
.join("xplr")
.join("session")
.join(&pid.to_string())
.join(pid.to_string())
.to_string_lossy()
.to_string();
fs::create_dir_all(&session_path)?;

@ -1673,7 +1673,7 @@ xplr.config.modes.builtin.go_to = {
if [ -z "$OPENER" ]; then
if command -v xdg-open; then
OPENER=xdg-open
elif command -v open; then
elif command -v open; then
OPENER=open
else
"$XPLR" -m 'LogError: "$OPENER not found"'

@ -393,7 +393,7 @@ impl Runner {
}
Debug(path) => {
fs::write(&path, yaml::to_string(&app)?)?;
fs::write(path, yaml::to_string(&app)?)?;
}
ClearScreen => {

Loading…
Cancel
Save