add #edit_mode_default #edit_mode_vi directives
This commit is contained in:
parent
fd5bd4f665
commit
cea5509294
|
@ -467,6 +467,8 @@ let default_prompt =
|
||||||
|
|
||||||
let prompt = ref default_prompt
|
let prompt = ref default_prompt
|
||||||
|
|
||||||
|
let edit_mode= ref LTerm_editor.Default
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
Hashtbl.add Toploop.directive_table "utop_prompt_simple"
|
Hashtbl.add Toploop.directive_table "utop_prompt_simple"
|
||||||
(Toploop.Directive_none
|
(Toploop.Directive_none
|
||||||
|
@ -488,7 +490,17 @@ let () =
|
||||||
(Toploop.Directive_none
|
(Toploop.Directive_none
|
||||||
(fun () ->
|
(fun () ->
|
||||||
set_profile Dark;
|
set_profile Dark;
|
||||||
prompt := default_prompt))
|
prompt := default_prompt));
|
||||||
|
|
||||||
|
Hashtbl.add Toploop.directive_table "edit_mode_default"
|
||||||
|
(Toploop.Directive_none
|
||||||
|
(fun () ->
|
||||||
|
edit_mode:= LTerm_editor.Default));
|
||||||
|
|
||||||
|
Hashtbl.add Toploop.directive_table "edit_mode_vi"
|
||||||
|
(Toploop.Directive_none
|
||||||
|
(fun () ->
|
||||||
|
edit_mode:= LTerm_editor.Vi))
|
||||||
|
|
||||||
(* +-----------------------------------------------------------------+
|
(* +-----------------------------------------------------------------+
|
||||||
| Help |
|
| Help |
|
||||||
|
|
|
@ -234,6 +234,11 @@ val time : float ref
|
||||||
val prompt : LTerm_text.t React.signal ref
|
val prompt : LTerm_text.t React.signal ref
|
||||||
(** The prompt. *)
|
(** The prompt. *)
|
||||||
|
|
||||||
|
(** {6 Edit mode configuration} *)
|
||||||
|
|
||||||
|
val edit_mode : LTerm_editor.mode ref
|
||||||
|
(** The edit mode. *)
|
||||||
|
|
||||||
(** {6 Hooks} *)
|
(** {6 Hooks} *)
|
||||||
|
|
||||||
val new_command_hooks : (unit -> unit) LTerm_dlist.t
|
val new_command_hooks : (unit -> unit) LTerm_dlist.t
|
||||||
|
|
|
@ -712,7 +712,12 @@ let execute_phrase = Toploop.execute_phrase
|
||||||
|
|
||||||
let rec read_phrase term =
|
let rec read_phrase term =
|
||||||
Lwt.catch
|
Lwt.catch
|
||||||
(fun () -> (new read_phrase ~term)#run)
|
(fun () ->
|
||||||
|
let read_line= new read_phrase ~term in
|
||||||
|
(match !UTop.edit_mode with
|
||||||
|
| LTerm_editor.Default-> ()
|
||||||
|
| LTerm_editor.Vi as mode-> read_line#set_editor_mode mode);
|
||||||
|
read_line#run)
|
||||||
(function
|
(function
|
||||||
| Sys.Break ->
|
| Sys.Break ->
|
||||||
LTerm.fprintl term "Interrupted." >>= fun () ->
|
LTerm.fprintl term "Interrupted." >>= fun () ->
|
||||||
|
|
Loading…
Reference in New Issue