mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibLine: Add support for ^X^E
This keybind opens the current buffer in an editor (determined by EDITOR from the env, or the default_text_editor key in the config file, and set to /bin/TextEditor by default), and later reads the file back into the buffer. Pretty handy :^)
This commit is contained in:
parent
258a49346d
commit
b58dbc29fc
3 changed files with 108 additions and 1 deletions
|
@ -62,6 +62,7 @@ Configuration Configuration::from_config(const StringView& libname)
|
|||
// Read behaviour options.
|
||||
auto refresh = config_file->read_entry("behaviour", "refresh", "lazy");
|
||||
auto operation = config_file->read_entry("behaviour", "operation_mode");
|
||||
auto default_text_editor = config_file->read_entry("behaviour", "default_text_editor");
|
||||
|
||||
if (refresh.equals_ignoring_case("lazy"))
|
||||
configuration.set(Configuration::Lazy);
|
||||
|
@ -77,6 +78,11 @@ Configuration Configuration::from_config(const StringView& libname)
|
|||
else
|
||||
configuration.set(Configuration::OperationMode::Unset);
|
||||
|
||||
if (!default_text_editor.is_empty())
|
||||
configuration.set(DefaultTextEditor { move(default_text_editor) });
|
||||
else
|
||||
configuration.set(DefaultTextEditor { "/bin/TextEditor" });
|
||||
|
||||
// Read keybinds.
|
||||
|
||||
for (auto& binding_key : config_file->keys("keybinds")) {
|
||||
|
@ -168,6 +174,9 @@ void Editor::set_default_keybinds()
|
|||
register_key_input_callback(ctrl('T'), EDITOR_INTERNAL_FUNCTION(transpose_characters));
|
||||
register_key_input_callback('\n', EDITOR_INTERNAL_FUNCTION(finish));
|
||||
|
||||
// ^X^E: Edit in external editor
|
||||
register_key_input_callback(Vector<Key> { ctrl('X'), ctrl('E') }, EDITOR_INTERNAL_FUNCTION(edit_in_external_editor));
|
||||
|
||||
// ^[.: alt-.: insert last arg of previous command (similar to `!$`)
|
||||
register_key_input_callback(Key { '.', Key::Alt }, EDITOR_INTERNAL_FUNCTION(insert_last_words));
|
||||
register_key_input_callback(Key { 'b', Key::Alt }, EDITOR_INTERNAL_FUNCTION(cursor_left_word));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue