summaryrefslogtreecommitdiffstats
path: root/src/key_command/impl_comment.rs
blob: b74da7a9a836246adb4e787781f9ce2e2f26b8f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
use crate::config::option::SortType;
use crate::io::FileOperationOptions;

use super::{Command, CommandComment};

impl CommandComment for Command {
    // These comments are displayed at the help page
    fn comment(&self) -> &'static str {
        match self {
            Self::Escape => "Escape from visual mode (cancel)",
            Self::BulkRename => "Bulk rename",

            Self::ToggleVisualMode => "Toggle visual mode",

            Self::ChangeDirectory { .. } => "Change directory",
            Self::ParentDirectory => "CD to parent directory",
            Self::PreviousDirectory => "CD to the last dir in history",

            Self::NewTab => "Open a new tab",
            Self::CloseTab => "Close current tab",
            Self::CommandLine { prefix, .. } => match prefix.trim() {
                "cd" => "Change directory",
                "search" => "Open a search prompt",
                "search_glob" => "Glob search",
                "rename" => "Rename selected file",
                "touch" => "Touch file",
                "mkdir" => "Make a new directory",
                _ => "Open a command line",
            },

            Self::CutFiles => "Cut selected files",
            Self::CopyFiles => "Copy selected files",
            Self::CopyFileName => "Copy filename",
            Self::CopyFileNameWithoutExtension => "Copy filename without extension",
            Self::CopyFilePath => "Copy path to file",
            Self::CopyDirPath => "Copy directory name",
            Self::SymlinkFiles { .. } => "Symlink selected files",

            Self::PasteFiles {
                options:
                    FileOperationOptions {
                        overwrite,
                        skip_exist,
                        ..
                    },
            } => match (overwrite, skip_exist) {
                (true, false) => "Paste, overwrite",
                (false, true) => "Paste, skip existing files",
                _ => "Paste",
            },
            Self::DeleteFiles { .. } => "Delete selected files",

            Self::CursorMoveUp { .. } => "Move cursor up",
            Self::CursorMoveDown { .. } => "Move cursor down",
            Self::CursorMoveHome => "Move cursor to the very top",
            Self::CursorMoveEnd => "Move cursor to the ver bottom",
            Self::CursorMovePageUp(_) => "Move cursor one page up",
            Self::CursorMovePageDown(_) => "Move cursor one page down",

            Self::CursorMovePageHome => "Move cursor to top of page",
            Self::CursorMovePageMiddle => "Move cursor to middle of page",
            Self::CursorMovePageEnd => "Move cursor to bottom of page",

            Self::ParentCursorMoveUp { .. } => "Cursor up in parent list",
            Self::ParentCursorMoveDown { .. } => "Cursor down in parent list",

            Self::PreviewCursorMoveUp { .. } => "Cursor up in file preview",
            Self::PreviewCursorMoveDown { .. } => "Cursor down in file preview",

            Self::NewDirectory { .. } => "Make a new directory",
            Self::OpenFile => "Open a file",
            Self::OpenFileWith { .. } => "Open using selected program",

            Self::Quit(_) => "Quit the program",
            Self::ReloadDirList => "Reload current dir listing",
            Self::RenameFile { .. } => "Rename file",
            Self::TouchFile { .. } => "Touch file",
            Self::RenameFileAppend => "Rename a file",
            Self::RenameFilePrepend => "Rename a file",

            Self::SearchString { .. } => "Search",
            Self::SearchIncremental { .. } => "Search as you type",
            Self::SearchGlob { .. } => "Search with globbing",
            Self::SearchNext => "Next search entry",
            Self::SearchPrev => "Previous search entry",

            Self::SelectFiles { .. } => "Select file",
            Self::SetMode => "Set file permissions",
            Self::SubProcess { spawn: false, .. } => "Run a shell command",
            Self::SubProcess { spawn: true, .. } => "Run commmand in background",
            Self::ShowTasks => "Show running background tasks",

            Self::ToggleHiddenFiles => "Toggle hidden files displaying",

            Self::SwitchLineNums(_) => "Switch line numbering",

            Self::Flat { .. } => "Flattern directory list",
            Self::NumberedCommand { .. } => "Jump via input number",

            Self::Sort(sort_type) => match sort_type {
                SortType::Lexical => "Sort lexically",
                SortType::Mtime => "Sort by modifiaction time",
                SortType::Natural => "Sort naturally",
                SortType::Size => "Sort by size",
                SortType::Ext => "Sort by extension",
            },
            Self::SortReverse => "Reverse sort order",

            Self::Filter { .. } => "Filter directory list",

            Self::TabSwitch { .. } => "Swith to the next tab",
            Self::TabSwitchIndex { .. } => "Swith to a given tab",
            Self::Help => "Open this help page",

            Self::SearchFzf => "Search via fzf",
            Self::SubdirFzf => "Switch to a child directory via fzf",
            Self::Zoxide(_) => "Zoxide",
            Self::ZoxideInteractive => "Zoxide interactive",
        }
    }
}