Struct fm::event_exec::EventExec
source · pub struct EventExec {}Expand description
Every kind of mutation of the application is defined here.
It mutates Status or its children Tab.
Implementations§
source§impl EventExec
impl EventExec
sourcepub fn refresh_status(status: &mut Status) -> FmResult<()>
pub fn refresh_status(status: &mut Status) -> FmResult<()>
Reset the selected tab view to the default.
sourcepub fn resize(status: &mut Status, width: usize, height: usize) -> FmResult<()>
pub fn resize(status: &mut Status, width: usize, height: usize) -> FmResult<()>
When a rezise event occurs, we may hide the second panel if the width isn’t sufficiant to display enough information. We also need to know the new height of the terminal to start scrolling up or down.
sourcepub fn event_clear_flags(status: &mut Status) -> FmResult<()>
pub fn event_clear_flags(status: &mut Status) -> FmResult<()>
Remove every flag on files in this directory and others.
sourcepub fn event_flag_all(status: &mut Status) -> FmResult<()>
pub fn event_flag_all(status: &mut Status) -> FmResult<()>
Flag all files in the current directory.
sourcepub fn event_reverse_flags(status: &mut Status) -> FmResult<()>
pub fn event_reverse_flags(status: &mut Status) -> FmResult<()>
Reverse every flag in current directory. Flagged files in other directory aren’t affected.
sourcepub fn event_toggle_flag(status: &mut Status) -> FmResult<()>
pub fn event_toggle_flag(status: &mut Status) -> FmResult<()>
Toggle a single flag and move down one row.
sourcepub fn event_jumplist_next(status: &mut Status)
pub fn event_jumplist_next(status: &mut Status)
Move to the next file in the jump list.
sourcepub fn event_jumplist_prev(status: &mut Status)
pub fn event_jumplist_prev(status: &mut Status)
Move to the previous file in the jump list.
sourcepub fn event_chmod(status: &mut Status) -> FmResult<()>
pub fn event_chmod(status: &mut Status) -> FmResult<()>
Change to CHMOD mode allowing to edit permissions of a file.
sourcepub fn event_jump(status: &mut Status) -> FmResult<()>
pub fn event_jump(status: &mut Status) -> FmResult<()>
Enter JUMP mode, allowing to jump to any flagged file. Does nothing if no file is flagged.
sourcepub fn event_marks_new(tab: &mut Tab) -> FmResult<()>
pub fn event_marks_new(tab: &mut Tab) -> FmResult<()>
Enter Marks new mode, allowing to bind a char to a path.
sourcepub fn event_marks_jump(status: &mut Status) -> FmResult<()>
pub fn event_marks_jump(status: &mut Status) -> FmResult<()>
Enter Marks jump mode, allowing to jump to a marked file.
sourcepub fn exec_marks_new(status: &mut Status, c: char) -> FmResult<()>
pub fn exec_marks_new(status: &mut Status, c: char) -> FmResult<()>
Execute a new mark, saving it to a config file for futher use.
sourcepub fn exec_marks_jump(status: &mut Status, c: char) -> FmResult<()>
pub fn exec_marks_jump(status: &mut Status, c: char) -> FmResult<()>
Execute a jump to a mark, moving to a valid path. If the saved path is invalid, it does nothing but reset the view.
sourcepub fn event_symlink(status: &mut Status) -> FmResult<()>
pub fn event_symlink(status: &mut Status) -> FmResult<()>
Creates a symlink of every flagged file to the current directory.
sourcepub fn event_bulkrename(status: &mut Status) -> FmResult<()>
pub fn event_bulkrename(status: &mut Status) -> FmResult<()>
Enter bulkrename mode, opening a random temp file where the user can edit the selected filenames. Once the temp file is saved, those file names are changed.
sourcepub fn exec_copy_paste(status: &mut Status) -> FmResult<()>
pub fn exec_copy_paste(status: &mut Status) -> FmResult<()>
Copy the flagged file to current directory. A progress bar is displayed and a notification is sent once it’s done.
sourcepub fn exec_cut_paste(status: &mut Status) -> FmResult<()>
pub fn exec_cut_paste(status: &mut Status) -> FmResult<()>
Move the flagged file to current directory. A progress bar is displayed and a notification is sent once it’s done.
sourcepub fn exec_delete_files(status: &mut Status) -> FmResult<()>
pub fn exec_delete_files(status: &mut Status) -> FmResult<()>
Recursively delete all flagged files.
sourcepub fn exec_chmod(status: &mut Status) -> FmResult<()>
pub fn exec_chmod(status: &mut Status) -> FmResult<()>
Change permission of the flagged files. Once the user has typed an octal permission like 754, it’s applied to the file. Nothing is done if the user typed nothing or an invalid permission like 955.
sourcepub fn exec_jump(status: &mut Status) -> FmResult<()>
pub fn exec_jump(status: &mut Status) -> FmResult<()>
Execute a jump to the selected flagged file. If the user selected a directory, we jump inside it. Otherwise, we jump to the parent and select the file.
sourcepub fn exec_confirmed_action(
status: &mut Status,
confirmed_action: NeedConfirmation
) -> FmResult<()>
pub fn exec_confirmed_action(
status: &mut Status,
confirmed_action: NeedConfirmation
) -> FmResult<()>
Execute a command requiring a confirmation (Delete, Move or Copy).
sourcepub fn exec_regex(status: &mut Status) -> Result<(), Error>
pub fn exec_regex(status: &mut Status) -> Result<(), Error>
Select the first file matching the typed regex in current dir.
sourcepub fn event_normal(tab: &mut Tab) -> FmResult<()>
pub fn event_normal(tab: &mut Tab) -> FmResult<()>
Leave current mode to normal mode. Reset the inputs and completion, reset the window, exit the preview.
sourcepub fn event_up_one_row(tab: &mut Tab)
pub fn event_up_one_row(tab: &mut Tab)
Move up one row if possible.
sourcepub fn event_down_one_row(tab: &mut Tab)
pub fn event_down_one_row(tab: &mut Tab)
Move down one row if possible.
sourcepub fn event_go_top(tab: &mut Tab)
pub fn event_go_top(tab: &mut Tab)
Move to the top of the current directory.
sourcepub fn event_page_up(tab: &mut Tab)
pub fn event_page_up(tab: &mut Tab)
Move up 10 rows in normal mode. In other modes where vertical scrolling is possible (atm Preview), if moves up one page.
sourcepub fn event_page_down(tab: &mut Tab)
pub fn event_page_down(tab: &mut Tab)
Move down 10 rows in normal mode. In other modes where vertical scrolling is possible (atm Preview), if moves down one page.
sourcepub fn event_go_bottom(tab: &mut Tab)
pub fn event_go_bottom(tab: &mut Tab)
Move to the bottom of current view.
sourcepub fn event_cursor_home(tab: &mut Tab)
pub fn event_cursor_home(tab: &mut Tab)
Move the cursor to the start of line.
sourcepub fn event_cursor_end(tab: &mut Tab)
pub fn event_cursor_end(tab: &mut Tab)
Move the cursor to the end of line.
sourcepub fn event_select_row(status: &mut Status, row: u16) -> FmResult<()>
pub fn event_select_row(status: &mut Status, row: u16) -> FmResult<()>
Select a given row, if there’s something in it.
sourcepub fn event_shortcut_next(tab: &mut Tab)
pub fn event_shortcut_next(tab: &mut Tab)
Select the next shortcut.
sourcepub fn event_shortcut_prev(tab: &mut Tab)
pub fn event_shortcut_prev(tab: &mut Tab)
Select the previous shortcut.
sourcepub fn event_history_next(tab: &mut Tab)
pub fn event_history_next(tab: &mut Tab)
Select the next element in history of visited files.
Watchout! Since the history is displayed in reverse order,
we call the “prev” method of the History instance instead.
sourcepub fn event_history_prev(tab: &mut Tab)
pub fn event_history_prev(tab: &mut Tab)
Select the previous element in history of visited files.
Watchout! Since the history is displayed in reverse order,
we call the “next” method of the History instance instead.
sourcepub fn event_move_to_parent(tab: &mut Tab) -> FmResult<()>
pub fn event_move_to_parent(tab: &mut Tab) -> FmResult<()>
Move to parent directory if there’s one. Does Add the starting directory to history.
sourcepub fn event_move_cursor_left(tab: &mut Tab)
pub fn event_move_cursor_left(tab: &mut Tab)
Move the cursor left one block.
sourcepub fn exec_file(status: &mut Status) -> FmResult<()>
pub fn exec_file(status: &mut Status) -> FmResult<()>
Open the file with configured opener or enter the directory.
sourcepub fn event_move_cursor_right(tab: &mut Tab)
pub fn event_move_cursor_right(tab: &mut Tab)
Move the cursor to the right in input string.
sourcepub fn event_delete_char_left(tab: &mut Tab)
pub fn event_delete_char_left(tab: &mut Tab)
Delete the char to the left in input string.
sourcepub fn event_delete_chars_right(tab: &mut Tab)
pub fn event_delete_chars_right(tab: &mut Tab)
Delete all chars right of the cursor in input string.
sourcepub fn event_text_insert_and_complete(tab: &mut Tab, c: char) -> FmResult<()>
pub fn event_text_insert_and_complete(tab: &mut Tab, c: char) -> FmResult<()>
Add a char to input string, look for a possible completion.
sourcepub fn event_copy_paste(status: &mut Status) -> FmResult<()>
pub fn event_copy_paste(status: &mut Status) -> FmResult<()>
Enter a copy paste mode. A confirmation is asked before copying all flagged files to the current directory. Does nothing if no file is flagged.
sourcepub fn event_cut_paste(status: &mut Status) -> FmResult<()>
pub fn event_cut_paste(status: &mut Status) -> FmResult<()>
Enter the ‘move’ mode. A confirmation is asked before moving all flagged files to the current directory. Does nothing if no file is flagged.
sourcepub fn event_new_dir(tab: &mut Tab) -> FmResult<()>
pub fn event_new_dir(tab: &mut Tab) -> FmResult<()>
Enter the new dir mode.
sourcepub fn event_new_file(tab: &mut Tab) -> FmResult<()>
pub fn event_new_file(tab: &mut Tab) -> FmResult<()>
Enter the new file mode.
sourcepub fn event_exec(tab: &mut Tab) -> FmResult<()>
pub fn event_exec(tab: &mut Tab) -> FmResult<()>
Enter the execute mode. Most commands must be executed to allow for a confirmation.
sourcepub fn event_preview(tab: &mut Tab) -> FmResult<()>
pub fn event_preview(tab: &mut Tab) -> FmResult<()>
Preview the selected file.
Every file can be previewed. See the crate::enum::Preview for
more details on previewinga file.
Does nothing if the directory is empty.
sourcepub fn event_delete_file(status: &mut Status) -> FmResult<()>
pub fn event_delete_file(status: &mut Status) -> FmResult<()>
Enter the delete mode. A confirmation is then asked before deleting all the flagged files. Does nothing is no file is flagged.
sourcepub fn event_help(status: &mut Status) -> FmResult<()>
pub fn event_help(status: &mut Status) -> FmResult<()>
Display the help which can be navigated and displays the configrable binds.
sourcepub fn event_search(tab: &mut Tab) -> FmResult<()>
pub fn event_search(tab: &mut Tab) -> FmResult<()>
Enter the search mode. Matching items are displayed as you type them.
sourcepub fn event_regex_match(tab: &mut Tab) -> FmResult<()>
pub fn event_regex_match(tab: &mut Tab) -> FmResult<()>
Enter the regex mode. Every file matching the typed regex will be flagged.
sourcepub fn event_sort(tab: &mut Tab) -> FmResult<()>
pub fn event_sort(tab: &mut Tab) -> FmResult<()>
Enter the sort mode, allowing the user to select a sort method.
sourcepub fn event_quit(tab: &mut Tab) -> FmResult<()>
pub fn event_quit(tab: &mut Tab) -> FmResult<()>
Once a quit event is received, we change a flag and break the main loop. It’s usefull to reset the cursor before leaving the application.
sourcepub fn event_leave_need_confirmation(tab: &mut Tab)
pub fn event_leave_need_confirmation(tab: &mut Tab)
Reset the mode to normal.
sourcepub fn event_leave_sort(tab: &mut Tab, c: char)
pub fn event_leave_sort(tab: &mut Tab, c: char)
Sort the file with given criteria Valid kind of sorts are : by kind : directory first, files next, in alphanumeric order by filename, by date of modification, by size, by extension. The first letter is used to identify the method. If the user types an uppercase char, the sort is reverse.
sourcepub fn event_text_insertion(tab: &mut Tab, c: char)
pub fn event_text_insertion(tab: &mut Tab, c: char)
Insert a char in the input string.
Toggle the display of hidden files.
sourcepub fn event_open_file(status: &mut Status) -> FmResult<()>
pub fn event_open_file(status: &mut Status) -> FmResult<()>
Open a file with custom opener.
sourcepub fn event_rename(tab: &mut Tab) -> FmResult<()>
pub fn event_rename(tab: &mut Tab) -> FmResult<()>
Enter the rename mode.
sourcepub fn event_goto(tab: &mut Tab) -> FmResult<()>
pub fn event_goto(tab: &mut Tab) -> FmResult<()>
Enter the goto mode where an user can type a path to jump to.
sourcepub fn event_shell(status: &mut Status) -> FmResult<()>
pub fn event_shell(status: &mut Status) -> FmResult<()>
Open a new terminal in current directory. The shell is a fork of current process and will exit if the application is terminated first.
sourcepub fn event_history(tab: &mut Tab) -> FmResult<()>
pub fn event_history(tab: &mut Tab) -> FmResult<()>
Enter the history mode, allowing to navigate to previously visited directory.
sourcepub fn event_shortcut(tab: &mut Tab) -> FmResult<()>
pub fn event_shortcut(tab: &mut Tab) -> FmResult<()>
Enter the shortcut mode, allowing to visit predefined shortcuts. Basic folders (/, /dev… $HOME) and mount points (even impossible to visit ones) are proposed.
sourcepub fn event_right_click(status: &mut Status, row: u16) -> FmResult<()>
pub fn event_right_click(status: &mut Status, row: u16) -> FmResult<()>
A right click opens a file or a directory.
sourcepub fn event_replace_input_with_completion(tab: &mut Tab)
pub fn event_replace_input_with_completion(tab: &mut Tab)
Replace the input string by the selected completion.
sourcepub fn event_nvim_filepicker(tab: &mut Tab) -> FmResult<()>
pub fn event_nvim_filepicker(tab: &mut Tab) -> FmResult<()>
Send a signal to parent NVIM process, picking the selected file. If no RPC server were provided at launch time - which may happen for reasons unknow to me - it does nothing. It requires the “nvim-send” application to be in $PATH.
sourcepub fn event_filename_to_clipboard(tab: &Tab) -> FmResult<()>
pub fn event_filename_to_clipboard(tab: &Tab) -> FmResult<()>
Copy the selected filename to the clipboard. Only the filename.
sourcepub fn event_filepath_to_clipboard(tab: &Tab) -> FmResult<()>
pub fn event_filepath_to_clipboard(tab: &Tab) -> FmResult<()>
Copy the selected filepath to the clipboard. The absolute path.
sourcepub fn event_filter(tab: &mut Tab) -> FmResult<()>
pub fn event_filter(tab: &mut Tab) -> FmResult<()>
Enter the filter mode, where you can filter.
See crate::filter::Filter for more details.
sourcepub fn event_back(tab: &mut Tab) -> FmResult<()>
pub fn event_back(tab: &mut Tab) -> FmResult<()>
Move back in history to the last visited directory.
sourcepub fn event_home(tab: &mut Tab) -> FmResult<()>
pub fn event_home(tab: &mut Tab) -> FmResult<()>
Move to $HOME aka ~.
sourcepub fn exec_rename(tab: &mut Tab) -> FmResult<()>
pub fn exec_rename(tab: &mut Tab) -> FmResult<()>
Execute a rename of the selected file.
It uses the fs::rename function and has the same limitations.
We only tries to rename in the same directory, so it shouldn’t be a problem.
Filename is sanitized before processing.
sourcepub fn exec_newfile(tab: &mut Tab) -> FmResult<()>
pub fn exec_newfile(tab: &mut Tab) -> FmResult<()>
Creates a new file with input string as name.
We use fs::File::create internally, so if the file already exists,
it will be overwritten.
Filename is sanitized before processing.
sourcepub fn exec_newdir(tab: &mut Tab) -> FmResult<()>
pub fn exec_newdir(tab: &mut Tab) -> FmResult<()>
Creates a new directory with input string as name.
We use fs::create_dir internally so it will fail if the input string
is not an end point in the file system.
ie. the user can create newdir but not newdir/newfolder.
It will also fail if the directory already exists.
Directory name is sanitized before processing.
sourcepub fn exec_exec(tab: &mut Tab) -> FmResult<()>
pub fn exec_exec(tab: &mut Tab) -> FmResult<()>
Tries to execute the selected file with an executable which is read
from the input string. It will fail silently if the executable can’t
be found.
Optional parameters can be passed normally. ie. "ls -lah"
sourcepub fn event_drag_n_drop(status: &mut Status) -> FmResult<()>
pub fn event_drag_n_drop(status: &mut Status) -> FmResult<()>
Executes a dragon-drop command on the selected file.
It obviously requires the dragon-drop command to be installed.
sourcepub fn exec_search(tab: &mut Tab)
pub fn exec_search(tab: &mut Tab)
Executes a search in current folder, selecting the first file matching
the current completion proposition.
ie. If you typed "jpg" before, it will move to the first file
whose filename contains "jpg".
The current order of files is used.
pub fn event_search_next(tab: &mut Tab) -> FmResult<()>
sourcepub fn exec_goto(tab: &mut Tab) -> FmResult<()>
pub fn exec_goto(tab: &mut Tab) -> FmResult<()>
Move to the folder typed by the user.
The first completion proposition is used, ~ expansion is done.
If no result were found, no cd is done and we go back to normal mode
silently.
sourcepub fn exec_shortcut(tab: &mut Tab) -> FmResult<()>
pub fn exec_shortcut(tab: &mut Tab) -> FmResult<()>
Move to the selected shortcut. It may fail if the user has no permission to visit the path.
sourcepub fn exec_history(tab: &mut Tab) -> FmResult<()>
pub fn exec_history(tab: &mut Tab) -> FmResult<()>
Move back to a previously visited path. It may fail if the user has no permission to visit the path
sourcepub fn exec_filter(tab: &mut Tab) -> FmResult<()>
pub fn exec_filter(tab: &mut Tab) -> FmResult<()>
Apply a filter to the displayed files.
See crate::filter for more details.
sourcepub fn event_move_up(status: &mut Status) -> FmResult<()>
pub fn event_move_up(status: &mut Status) -> FmResult<()>
Move up one row in modes allowing movement. Does nothing if the selected item is already the first in list.
sourcepub fn event_move_down(status: &mut Status) -> FmResult<()>
pub fn event_move_down(status: &mut Status) -> FmResult<()>
Move down one row in modes allowing movements. Does nothing if the user is already at the bottom.
sourcepub fn event_move_left(status: &mut Status) -> FmResult<()>
pub fn event_move_left(status: &mut Status) -> FmResult<()>
Move to parent in normal mode, move left one char in mode requiring text input.
sourcepub fn event_move_right(status: &mut Status) -> FmResult<()>
pub fn event_move_right(status: &mut Status) -> FmResult<()>
Move to child if any or open a regular file in normal mode. Move the cursor one char to right in mode requiring text input.
sourcepub fn event_backspace(status: &mut Status) -> FmResult<()>
pub fn event_backspace(status: &mut Status) -> FmResult<()>
Delete a char to the left in modes allowing edition.
sourcepub fn event_delete(status: &mut Status) -> FmResult<()>
pub fn event_delete(status: &mut Status) -> FmResult<()>
Delete all chars to the right in mode allowing edition.
sourcepub fn event_key_home(status: &mut Status) -> FmResult<()>
pub fn event_key_home(status: &mut Status) -> FmResult<()>
Move to leftmost char in mode allowing edition.
sourcepub fn page_up(status: &mut Status) -> FmResult<()>
pub fn page_up(status: &mut Status) -> FmResult<()>
Move up 10 lines in normal mode and preview.
sourcepub fn page_down(status: &mut Status) -> FmResult<()>
pub fn page_down(status: &mut Status) -> FmResult<()>
Move down 10 lines in normal & preview mode.
sourcepub fn enter(status: &mut Status) -> FmResult<()>
pub fn enter(status: &mut Status) -> FmResult<()>
Execute the mode. In modes requiring confirmation or text input, it will execute the related action. In normal mode, it will open the file. Reset to normal mode afterwards.
sourcepub fn tab(status: &mut Status) -> FmResult<()>
pub fn tab(status: &mut Status) -> FmResult<()>
Change tab in normal mode with dual pane displayed, insert a completion in modes allowing completion.
sourcepub fn event_fuzzyfind(status: &mut Status) -> FmResult<()>
pub fn event_fuzzyfind(status: &mut Status) -> FmResult<()>
Start a fuzzy find with skim. ATM idk how to avoid using the whole screen.
sourcepub fn event_copy_filename(status: &mut Status) -> FmResult<()>
pub fn event_copy_filename(status: &mut Status) -> FmResult<()>
Copy the filename of the selected file in normal mode.
sourcepub fn event_copy_filepath(status: &mut Status) -> FmResult<()>
pub fn event_copy_filepath(status: &mut Status) -> FmResult<()>
Copy the filepath of the selected file in normal mode.
sourcepub fn event_refreshview(status: &mut Status) -> FmResult<()>
pub fn event_refreshview(status: &mut Status) -> FmResult<()>
Refresh the current view, reloading the files. Move the selection to top.
sourcepub fn event_thumbnail(tab: &mut Tab) -> FmResult<()>
pub fn event_thumbnail(tab: &mut Tab) -> FmResult<()>
Open a thumbnail of an image, scaled up to the whole window.
sourcepub fn event_toggle_display_full(status: &mut Status) -> FmResult<()>
pub fn event_toggle_display_full(status: &mut Status) -> FmResult<()>
Toggle between a full display (aka ls -lah) or a simple mode (only the filenames).
sourcepub fn event_toggle_dualpane(status: &mut Status) -> FmResult<()>
pub fn event_toggle_dualpane(status: &mut Status) -> FmResult<()>
Toggle between dualpane and single pane. Does nothing if the width is too low to display both panes.
sourcepub fn event_trash_move_file(status: &mut Status) -> FmResult<()>
pub fn event_trash_move_file(status: &mut Status) -> FmResult<()>
Move flagged files to the trash directory. More information in the trash crate itself. If the file is mounted on the $topdir of the trash (aka the $HOME mount point), it is moved there. Else, nothing is done.
sourcepub fn event_trash_restore_file(status: &mut Status) -> FmResult<()>
pub fn event_trash_restore_file(status: &mut Status) -> FmResult<()>
Restore a file from the trash if possible. Parent folders are created on the file if needed.
sourcepub fn event_trash_empty(status: &mut Status) -> FmResult<()>
pub fn event_trash_empty(status: &mut Status) -> FmResult<()>
Ask the user if he wants to empty the trash. It requires a confimation before doing anything
sourcepub fn exec_trash_empty(status: &mut Status) -> FmResult<()>
pub fn exec_trash_empty(status: &mut Status) -> FmResult<()>
Empty the trash folder permanently.
sourcepub fn event_trash_open(status: &mut Status) -> FmResult<()>
pub fn event_trash_open(status: &mut Status) -> FmResult<()>
Open the trash. Displays a navigable content of the trash. Each item can be restored or deleted. Each opening refresh the trash content.
sourcepub fn event_trash_next(status: &mut Status)
pub fn event_trash_next(status: &mut Status)
Select the next element in the trash folder
sourcepub fn event_trash_prev(status: &mut Status)
pub fn event_trash_prev(status: &mut Status)
Select the previous element in the trash folder
sourcepub fn event_trash_remove_file(status: &mut Status) -> FmResult<()>
pub fn event_trash_remove_file(status: &mut Status) -> FmResult<()>
Remove the selected element in the trash folder.