curlpipe / ox

An independent Rust text editor that runs in your terminal!
GNU General Public License v2.0
3.3k stars 106 forks source link

show Key Binding Cheat Sheet instead of default help #147

Open kurokirasama opened 1 day ago

kurokirasama commented 1 day ago

Is your feature request related to a problem? Please describe. is there a way to show the Key Binding Cheat Sheet instead of default help with ctrl + h?

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

curlpipe commented 1 day ago

I'm not quite sure what you mean Do you mean adding a key binding ctrl h in the default configuration to open the help message (shown below in green)?

image

If so, you can use the following code in your configuration file (in the event mapping part) to toggle the help message when pressing ctrl_h

    ["ctrl_h"] = function()
        if editor.help_visible then
            editor:hide_help_message()
        else
            editor:show_help_message()
        end
    end,

I can add this into the default config in future, as it makes sense

kurokirasama commented 19 hours ago

Hey,

the config file use to have this (I added a few more):

Key Binding Cheat Sheet
{highlight_start}
Ctrl + N:   New         
Ctrl + O:   Open        
Ctrl + Q:   Quit        
Ctrl + S:   Save        
Ctrl + A:   Save all    
Ctrl + Z:   Undo        
Ctrl + Y:   Redo        
Ctrl + F:   Find        
Ctrl + R:   Replace     
Ctrl + D:   Delete Line 
Ctrl + L:   Clear file
Ctrl + J:   Join the current line with the next one
Ctrl + G:   Go to line
Ctrl + K:   Comment line
Ctrl + B:   Compile md via Pandoc
Alt + D:    Duplicate current line 
Alt + S:    Save all
Alt + K:    Command line 
Alt + W:    Remove previous word
Alt + L:    Toggle line numbers
Alt + O:    Open current file in default system app
Shift + up: Move line up 
Shift + dn: Move line down 
Shift + ->: Next Tab    
Shift + <-: Previous Tab
{highlight_end}
]]

I have that ctrl_h function, but it only shows the default, not what I added...

curlpipe commented 17 hours ago

I think I understand. The above part of the configuration file is the "greeting message" which shows when you start the editor. You want the help message (which is different) that is shown to match the greeting message you have there in the configuration file.

I might change the greeting message to be simpler but have the help message will be more detailed and can be changed in the config file.