Edit permissions

pull/591/head
Arijit Basu 1 year ago
parent 71674fb482
commit 3b52eb2958

@ -49,109 +49,65 @@ of [modes][4] and the key mappings for each mode.
| ~ | | go home |
| [0-9] | | input |
### debug_error
| key | remaps | action |
| ----- | ------ | ------------------- |
| enter | | open logs in editor |
| q | | quit |
### sort
| key | remaps | action |
| --------- | ------ | --------------------------------- |
| ! | | reverse sorters |
| C | | by created reverse |
| E | | by canonical extension reverse |
| L | | by last modified reverse |
| M | | by canonical mime essence reverse |
| N | | by node type reverse |
| R | | by relative path reverse |
| S | | by size reverse |
| backspace | | remove last sorter |
| c | | by created |
| ctrl-r | | reset sorters |
| ctrl-u | | clear sorters |
| e | | by canonical extension |
| enter | | submit |
| l | | by last modified |
| m | | by canonical mime essence |
| n | | by node type |
| r | | by relative path |
| s | | by size |
### relative_path_does_not_match_regex
| key | remaps | action |
| ----- | ------ | ------ |
| enter | | submit |
### switch_layout
| key | remaps | action |
| --- | ------ | -------------------- |
| 1 | | default |
| 2 | | no help menu |
| 3 | | no selection panel |
| 4 | | no help or selection |
### recover
### filter
| key | remaps | action |
| --- | ------ | ------ |
| key | remaps | action |
| --------- | ------ | ---------------------------------- |
| R | | relative path does not match regex |
| backspace | | remove last filter |
| ctrl-r | | reset filters |
| ctrl-u | | clear filters |
| r | | relative path does match regex |
### vroot
### debug_error
| key | remaps | action |
| ------ | ------ | ------------ |
| . | | vroot $PWD |
| / | | vroot / |
| ctrl-r | | reset vroot |
| ctrl-u | | unset vroot |
| v | | toggle vroot |
| ~ | | vroot $HOME |
| key | remaps | action |
| ----- | ------ | ------------------- |
| enter | | open logs in editor |
| q | | quit |
### go_to_path
### number
| key | remaps | action |
| ----- | ------ | ------------ |
| enter | | submit |
| tab | | try complete |
| key | remaps | action |
| ----- | ------ | -------- |
| down | j | to down |
| enter | | to index |
| k | up | to up |
| [0-9] | | input |
### rename
### create_directory
| key | remaps | action |
| ----- | ------ | ------------ |
| enter | | submit |
| tab | | try complete |
### selection_ops
| key | remaps | action |
| --- | ------ | --------------- |
| c | | copy here |
| e | | edit selection |
| h | | hardlink here |
| l | | list selection |
| m | | move here |
| s | | softlink here |
| u | | clear selection |
### create_file
### go_to
| key | remaps | action |
| ----- | ------ | ------------ |
| enter | | submit |
| tab | | try complete |
| key | remaps | action |
| --- | ------ | -------------- |
| f | | follow symlink |
| g | | top |
| i | | initial $PWD |
| p | | path |
| x | | open in gui |
### delete
### switch_layout
| key | remaps | action |
| --- | ------ | ------------ |
| D | | force delete |
| d | | delete |
| key | remaps | action |
| --- | ------ | -------------------- |
| 1 | | default |
| 2 | | no help menu |
| 3 | | no selection panel |
| 4 | | no help or selection |
### create_directory
### rename
| key | remaps | action |
| ----- | ------ | ------------ |
@ -165,29 +121,12 @@ of [modes][4] and the key mappings for each mode.
| d | | create directory |
| f | | create file |
### action
| key | remaps | action |
| ----- | ------ | -------------------- |
| ! | | shell |
| c | | create |
| e | | open in editor |
| l | | logs |
| m | | toggle mouse |
| q | | quit options |
| s | | selection operations |
| v | | vroot |
| [0-9] | | go to index |
### filter
### duplicate_as
| key | remaps | action |
| --------- | ------ | ---------------------------------- |
| R | | relative path does not match regex |
| backspace | | remove last filter |
| ctrl-r | | reset filters |
| ctrl-u | | clear filters |
| r | | relative path does match regex |
| key | remaps | action |
| ----- | ------ | ------------ |
| enter | | submit |
| tab | | try complete |
### search
@ -206,28 +145,94 @@ of [modes][4] and the key mappings for each mode.
| right | | enter |
| tab | | toggle selection |
### duplicate_as
### action
| key | remaps | action |
| ----- | ------ | -------------------- |
| ! | | shell |
| c | | create |
| e | | open in editor |
| l | | logs |
| m | | toggle mouse |
| p | | edit permissions |
| q | | quit options |
| s | | selection operations |
| v | | vroot |
| [0-9] | | go to index |
### create_file
| key | remaps | action |
| ----- | ------ | ------------ |
| enter | | submit |
| tab | | try complete |
### go_to
| key | remaps | action |
| --- | ------ | -------------- |
| f | | follow symlink |
| g | | top |
| i | | initial $PWD |
| p | | path |
| x | | open in gui |
### relative_path_does_match_regex
### edit_permissions
| key | remaps | action |
| ----- | ------ | ------ |
| G | | -group |
| O | | -other |
| U | | -user |
| enter | | submit |
| g | | +group |
| o | | +other |
| u | | +user |
### sort
| key | remaps | action |
| --------- | ------ | --------------------------------- |
| ! | | reverse sorters |
| C | | by created reverse |
| E | | by canonical extension reverse |
| L | | by last modified reverse |
| M | | by canonical mime essence reverse |
| N | | by node type reverse |
| R | | by relative path reverse |
| S | | by size reverse |
| backspace | | remove last sorter |
| c | | by created |
| ctrl-r | | reset sorters |
| ctrl-u | | clear sorters |
| e | | by canonical extension |
| enter | | submit |
| l | | by last modified |
| m | | by canonical mime essence |
| n | | by node type |
| r | | by relative path |
| s | | by size |
### delete
| key | remaps | action |
| --- | ------ | ------------ |
| D | | force delete |
| d | | delete |
### selection_ops
| key | remaps | action |
| --- | ------ | --------------- |
| c | | copy here |
| e | | edit selection |
| h | | hardlink here |
| l | | list selection |
| m | | move here |
| s | | softlink here |
| u | | clear selection |
### go_to_path
| key | remaps | action |
| ----- | ------ | ------------ |
| enter | | submit |
| tab | | try complete |
### recover
| key | remaps | action |
| --- | ------ | ------ |
### quit
@ -239,11 +244,19 @@ of [modes][4] and the key mappings for each mode.
| r | | quit printing result |
| s | | quit printing selection |
### number
### relative_path_does_match_regex
| key | remaps | action |
| ----- | ------ | -------- |
| down | j | to down |
| enter | | to index |
| k | up | to up |
| [0-9] | | input |
| key | remaps | action |
| ----- | ------ | ------ |
| enter | | submit |
### vroot
| key | remaps | action |
| ------ | ------ | ------------ |
| . | | vroot $PWD |
| / | | vroot / |
| ctrl-r | | reset vroot |
| ctrl-u | | unset vroot |
| v | | toggle vroot |
| ~ | | vroot $HOME |

@ -143,6 +143,12 @@ The builtin vroot mode.
Type: [Mode](https://xplr.dev/en/mode)
#### xplr.config.modes.builtin.edit_permissions
The builtin edit permissions mode.
Type: [Mode](https://xplr.dev/en/mode)
#### xplr.config.modes.custom
This is where you define custom modes.

@ -481,7 +481,7 @@ xplr.config.general.sort_and_filter_ui.search_identifiers = {
--
-- Type: nullable string
xplr.config.general.sort_and_filter_ui.search_direction_identifiers.ordered.format =
""
""
-- The shape of unordered indicator for search ordering identifiers in Sort & filter panel.
--
@ -1288,19 +1288,19 @@ xplr.config.modes.builtin.default = {
}
xplr.config.modes.builtin.default.key_bindings.on_key["v"] =
xplr.config.modes.builtin.default.key_bindings.on_key["space"]
xplr.config.modes.builtin.default.key_bindings.on_key["space"]
xplr.config.modes.builtin.default.key_bindings.on_key["V"] =
xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-a"]
xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-a"]
xplr.config.modes.builtin.default.key_bindings.on_key["/"] =
xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-f"]
xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-f"]
xplr.config.modes.builtin.default.key_bindings.on_key["h"] =
xplr.config.modes.builtin.default.key_bindings.on_key["left"]
xplr.config.modes.builtin.default.key_bindings.on_key["left"]
xplr.config.modes.builtin.default.key_bindings.on_key["j"] =
xplr.config.modes.builtin.default.key_bindings.on_key["down"]
xplr.config.modes.builtin.default.key_bindings.on_key["down"]
xplr.config.modes.builtin.default.key_bindings.on_key["k"] =
xplr.config.modes.builtin.default.key_bindings.on_key["up"]
xplr.config.modes.builtin.default.key_bindings.on_key["up"]
xplr.config.modes.builtin.default.key_bindings.on_key["l"] =
xplr.config.modes.builtin.default.key_bindings.on_key["right"]
xplr.config.modes.builtin.default.key_bindings.on_key["right"]
-- The builtin debug error mode.
--
@ -1406,7 +1406,7 @@ xplr.config.modes.builtin.go_to_path = {
messages = {
{
BashExecSilently0 = [===[
PTH=${XPLR_INPUT_BUFFER}
PTH="$XPLR_INPUT_BUFFER"
PTH_ESC=$(printf %q "$PTH")
if [ -d "$PTH" ]; then
"$XPLR" -m 'ChangeDirectory: %q' "$PTH"
@ -1761,9 +1761,9 @@ xplr.config.modes.builtin.number = {
}
xplr.config.modes.builtin.number.key_bindings.on_key["j"] =
xplr.config.modes.builtin.number.key_bindings.on_key["down"]
xplr.config.modes.builtin.number.key_bindings.on_key["down"]
xplr.config.modes.builtin.number.key_bindings.on_key["k"] =
xplr.config.modes.builtin.number.key_bindings.on_key["up"]
xplr.config.modes.builtin.number.key_bindings.on_key["up"]
-- The builtin go to mode.
--
@ -2045,6 +2045,19 @@ xplr.config.modes.builtin.action = {
"ToggleMouse",
},
},
["p"] = {
help = "edit permissions",
messages = {
"PopMode",
{ SwitchModeBuiltin = "edit_permissions" },
{
BashExecSilently0 = [===[
PERM=$(stat -c '%a' -- "${XPLR_FOCUS_PATH:?}")
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["v"] = {
help = "vroot",
messages = {
@ -2216,9 +2229,9 @@ xplr.config.modes.builtin.search = {
}
xplr.config.modes.builtin.search.key_bindings.on_key["ctrl-n"] =
xplr.config.modes.builtin.search.key_bindings.on_key["down"]
xplr.config.modes.builtin.search.key_bindings.on_key["down"]
xplr.config.modes.builtin.search.key_bindings.on_key["ctrl-p"] =
xplr.config.modes.builtin.search.key_bindings.on_key["up"]
xplr.config.modes.builtin.search.key_bindings.on_key["up"]
-- The builtin filter mode.
--
@ -2594,6 +2607,100 @@ xplr.config.modes.builtin.vroot = {
},
}
-- The builtin edit permissions mode.
--
-- Type: [Mode](https://xplr.dev/en/mode)
xplr.config.modes.builtin.edit_permissions = {
name = "edit permissions",
key_bindings = {
on_key = {
["u"] = {
help = "+user",
messages = {
{
BashExecSilently0 = [===[
PERM=$(("${XPLR_INPUT_BUFFER:?}"+100))
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["U"] = {
help = "-user",
messages = {
{
BashExecSilently0 = [===[
PERM=$(("${XPLR_INPUT_BUFFER:?}"-100))
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["g"] = {
help = "+group",
messages = {
{
BashExecSilently0 = [===[
PERM=$(("${XPLR_INPUT_BUFFER:?}"+10))
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["G"] = {
help = "-group",
messages = {
{
BashExecSilently0 = [===[
PERM=$(("${XPLR_INPUT_BUFFER:?}"-10))
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["o"] = {
help = "+other",
messages = {
{
BashExecSilently0 = [===[
PERM=$(("${XPLR_INPUT_BUFFER:?}"+1))
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["O"] = {
help = "-other",
messages = {
{
BashExecSilently0 = [===[
PERM=$(("${XPLR_INPUT_BUFFER:?}"-1))
"$XPLR" -m 'SetInputBuffer: %q' "${PERM:?}"
]===],
},
},
},
["enter"] = {
help = "submit",
messages = {
{
BashExecSilently0 = [===[
chmod "${XPLR_INPUT_BUFFER:?}" -- "${XPLR_FOCUS_PATH:?}"
]===],
},
"PopMode",
"ExplorePwdAsync",
},
},
},
default = {
messages = {
"UpdateInputBufferFromKey",
},
},
},
}
-- This is where you define custom modes.
--
-- Type: mapping of the following key-value pairs:
@ -2768,14 +2875,14 @@ xplr.fn.builtin.fmt_general_table_row_cols_2 = function(m)
local T = xplr.util.paint("T", { fg = "Red" })
return xplr.util
.permissions_rwx(m.permissions)
:gsub("r", r)
:gsub("w", w)
:gsub("x", x)
:gsub("s", s)
:gsub("S", S)
:gsub("t", t)
:gsub("T", T)
.permissions_rwx(m.permissions)
:gsub("r", r)
:gsub("w", w)
:gsub("x", x)
:gsub("s", s)
:gsub("S", S)
:gsub("t", t)
:gsub("T", T)
end
-- Renders the fourth column in the table

Loading…
Cancel
Save