This file is for mapping keyboard keys to commands.
# keymapping for default view
[default_view]
keymap = [
{ keys = [ "T" ], command = "new_tab" },
# ...
]
# keymapping for task view
[task_view]
keymap = [
# ...
]
# keymapping for help view
[help_view]
keymap = [
# ...
]For more examples, take a look at config/keymap.toml
To combine keys with Ctrl and Alt, simply have ctrl+key/alt+key
where key is a valid key.
In addition to the standard alphabet, Joshuto currently also support the following keys.
backspace
backtab # this is shift+tab
arrow_left
arrow_right
arrow_up
arrow_down
home
end
page_up
page_down
delete
insert
escape
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12- will not quit if there are pending IO work (paste jobs)
quit- exit code 0
quit --force: does NOT wait for pending IO work- exit code 100
quit --output-current-directory: if--output-fileargument is set, output the current directory to it- exit code 101
quit --output-selected-files: if--output-fileargument is set, output the selected files to it- exit code 102
To exit into the current directory you need to add a snippet to your preferred shell's init script to integrate with quit.
POSIX-compliant shells (bash, zsh, dash, ...)
joshuto() {
ID="$$"
mkdir -p "/tmp/$USER"
OUTPUT_FILE="/tmp/$USER/joshuto-cwd-$ID"
env joshuto --output-file "$OUTPUT_FILE" "$@"
exit_code="$?"
case "$exit_code" in
# regular exit
0)
;;
# output contains current directory
101)
JOSHUTO_CWD=$(cat "$OUTPUT_FILE")
cd "$JOSHUTO_CWD" || return
;;
# output selected files
102)
;;
*)
echo "Exit code: $exit_code"
;;
esac
}Fish
function joshuto
set ID %self
set -l output_file /tmp/$USER/joshuto-cwd-$ID
mkdir -p /tmp/$USER
env joshuto --output-file "$output_file" $argv
set exit_code $status
switch $exit_code
case 0
# Regular exit, do nothing
case 101
set JOSHUTO_CWD (cat "$output_file")
cd "$JOSHUTO_CWD" || return
case 102
# Output selected files, no action
case '*'
echo "Exit code: $exit_code"
end
end- this does not execute the command, but merely sets the text to it
- Example:
:cd /will open up the command prompt withcd /already written
%sand%pare substituted by a list of all selected files or by the file under the cursor, if none is selected%dis substituted with the current directory's absolute path- When running the external program, the directory shown in Joshuto is set as “working directory”,
the file names substituted for
%sare given without path. If you want the absolute path, use%p. - Example:
:shell touch file.txtwill create a file calledfile.txt - Example for
keymap.toml: To open all selected files withnvim, one can add a keybinding like this:keymap = [ //.. { keys = [ "e", "v" ], commands = ["shell nvim %s"] } ]
- To set a wallpaper on sway using the absolute path of an image file:
keymap = [ //.. { keys = ["m", "w"], commands = ["shell swaymsg output * bg %p fit"] } ]
- Supports
%s,%pand%d, just like theshellcommand. - Example for
keymap.toml: To open all selected files or directories withsxiv, one can add a keybinding like this:keymap = [ //.. { keys = [ "i" ], commands = ["spawn sxiv -t %s"] } ]
- To open a new alacritty terminal in the current folder:
keymap = [ // .. { keys = [ "O" ], commands = ["spawn alacritty --working-directory %d"] } ]
can be mapped to Ctrl+z to behave similarly to other programs
sort lexical: sort lexically (10.txtcomes before2.txt)sort natural: sort naturally (2.txtcomes before10.txt)sort mtime: sort via last modified timesort size: sort by file sizesort ext: sort by extensionsort reverse: reverse the sorting
All methods (except reverse) support the --reverse flag:
--reverse=trueapplies sort method and sets reverse totrue--reverse=falseapplies sort method and sets reverse tofalse
linemode: change the line-mode (textual representation of files and directories in the “current view”)
linemode size: show the entry’s size (bytes for files, number of entries for directories) (default) ✻linemode mtime: show the entry’s modified time (aka. “mtime”) ✻linemode sizemtime: show the entry’s size and modified time ✻
✻: file- or directory-name is shown on left, the respective meta-data is shown on the right, preceded by a symlink indicator
- press
escapeto exit view
toggle_hidden: toggle hidden files
line_nums 0orline_nums none: disable displayingline_nums 1orline_nums absolute: enable absolute numbers for each entryline_nums 2orline_nums relative: enable numbers relative to selected entry
flat 3: flatten directory up to 3 directories deep. depth of 0 corresponds to the current directory. its direct descendents have depth 1, and their descendents have depth 2, and so on.
cursor_move_up: moves the cursor up by 1cursor_move_up x: moves the cursor up byxwherexis a non-negative number
cursor_move_down: moves the cursor down by 1cursor_move_down x: moves the cursor down byxwherexis a non-negative number
- where
xis the number of items that can be seen on the screen
- where
xis the number of items that can be seen on the screen
cd ..: go to parent directorycd ~: go to home directorycd -: go to previous directory in history (If it exists)
- if joshuto does not know how to open the file format (via extension currently),
it will prompt
:open_withto open with a specific command - if
xdg_openistruein joshuto.toml, joshuto will try to open it via xdg settings
numbered_command: opens a new mode where user can input numbers and jump to the specified location via hard-coded keybindings
numbered_command 3: initial input is 3
new_tab, without any argument, opens a new tab with the default directory.
(Note: the default directory for new tabs is specified in joshuto.toml in the tab section.)
new_tab some-diropens new tab with directorysome-dirnew_tab --currentopens new tab with the same directory as the current tabnew_tab --cursoropens new tab with the directory which is currently marked by the cursornew_tab --lastnew tab will be placed at the end of the stack. This is the only flag that can be combined with the others described above.
- where
xis an integer tab_switch 1: go to next tabtab_switch -1: go to previous tab
tab_switch_index 3: go to third tab if it exists, create one if it does not exist and there is already 3 - 1 = 2 tabs open
--relative=true: relative symlink paths--relative=false: absolute symlink paths
--foreground=true: will delete files in the foreground--permanently: force permanent deletion regardless ofuse_trashvalue.--noconfirm: files will be deleted without asking for confirmation (can be dangerous whenuse_trashisfalse)- will permanently delete files if
use_trashisfalsein joshuto.toml/wiki/Configuration#joshutotoml) - if
use_trashistrue,joshutowill try to use the following command-line tools to try to put the files in the trash can instead of permanently deleting themgio trashtrash-put: https://github.com/andreafrancia/trash-clitrashgtrash put
:rename new_name
rename_append: opens the command prompt with the rename command and the current file name filled in.
- cursor will be set to the end of the file name
rename_append_base: opens the command prompt with the rename command and the current file name filled in.
- cursor will be set right after the base name of the file. (beginning of the file name if no base name)
rename_prepend: opens the command prompt with the rename command and the current file name filled in.
- cursor will be set to the beginning of the file name
rename_keep_ext: opens the command prompt with the rename command and the extension of the current file filled in.
- cursor will be set right before the extension of the file
- clipboard support requires xsel, xclip, or wl-copy
:search_glob *.png
:search_regex .+\.(jpg|png|gif)
--toggle=true: toggle the selected state rather than selecting the entry (default)--toggle=false: select the current file (doesn't change anything if the current file is already selected)--deselect=true: deselect rather than select the entry--all=true: select/deselect/toggle all visible files in the current view. (Files not visible due to a set filter are not affected.)- when a pattern is given, joshuto selects files whose names contain the pattern
select png
This example keybinding can be used for deselecting all files:
keymap = [ //..
{keys = [ "x" ], command = "select --all=true --deselect=true"}
]:select_glob --toggle=false '*.png'
This command has the same options for select. Notice that it's necessary to quote the pattern when spaces are contained.
:select_regex --toggle=false '.+\.(jpg|png|gif)'
This command has the same options for select. Notice that it's necessary to quote the pattern when spaces and \ are contained.
This command has the same options for select. Use tab to select or deselect files in fzf.
:filter ca: filter the current directory and show only items withcain the name
:filter_glob *.png
:filter_regex .+\.(jpg|png|gif)
When disabling, the current “visual mode selection” is turned into normal selection. (See also Visual Mode.)
(See also Visual Mode.)
- Options
--type=string: change configurations of operations using substring matching--type=glob: change configurations of operations using glob matching--type=regex: change configurations of operations using regex--type=fzf: change configurations of operations using fzf- when no option is added, type is set to
stringby default
- Value
insensitivesensitivesmart
An example:
:set_case_sensitivity --type=fzf sensitiveDefine search command using custom_command
Similar to select and custom_search. Allows user to execute custom_command and
then interactively operate on the results.
- this will create a file inside
$TMP_DIR(or/tmpif$TMP_DIRis not set) and open up your text editor of choice via$EDITORenvironment variable - once you've made your changes to the file, saved and quit, it will use the
mvcommand to rename everything