mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-26 19:33:30 +04:00
Add :theme <name>
command
This commit is contained in:
parent
b1a41c4cc8
commit
42e13bd542
@ -1269,6 +1269,17 @@ fn force_quit_all(editor: &mut Editor, args: &[&str], event: PromptEvent) {
|
|||||||
quit_all_impl(editor, args, event, true)
|
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] = &[
|
pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
|
||||||
TypableCommand {
|
TypableCommand {
|
||||||
name: "quit",
|
name: "quit",
|
||||||
@ -1382,6 +1393,13 @@ fn force_quit_all(editor: &mut Editor, args: &[&str], event: PromptEvent) {
|
|||||||
fun: force_quit_all,
|
fun: force_quit_all,
|
||||||
completer: None,
|
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
|
// 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);
|
let mut popup = Popup::new(contents);
|
||||||
compositor.push(Box::new(popup));
|
compositor.push(Box::new(popup));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user