diff options
author | wojciechkepka | 2021-06-19 11:27:32 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-19 15:07:13 +0000 |
commit | 42e13bd5424581ec7ad299319e7f2f98a9832052 (patch) | |
tree | fc0093ef800bfee31307fdf6a4960cec2fda849c | |
parent | b1a41c4cc8c00287e60a0d847742e98636af1d2d (diff) |
Add `:theme <name>` command
-rw-r--r-- | helix-term/src/commands.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a8610223..3223b14f 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1269,6 +1269,17 @@ mod cmd { quit_all_impl(editor, args, event, true) } + fn theme(editor: &mut Editor, args: &[&str], event: PromptEvent) { + let theme = if let Some(theme) = args.first() { + theme + } else { + editor.set_error("theme name not provided".into()); + return; + }; + + editor.set_theme_from_name(theme); + } + pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit", @@ -1382,6 +1393,13 @@ mod cmd { fun: force_quit_all, completer: None, }, + TypableCommand { + name: "theme", + alias: None, + doc: "Change the theme of current view. Requires theme name as argument (:theme <name>)", + fun: theme, + completer: Some(completers::theme), + }, ]; @@ -2804,7 +2822,7 @@ fn hover(cx: &mut Context) { // skip if contents empty - let contents = ui::Markdown::new(contents); + let contents = ui::Markdown::new(contents, editor.syn_loader.clone()); let mut popup = Popup::new(contents); compositor.push(Box::new(popup)); } |