nvim_oxi_api/opts/set_keymap.rs
1use types::{Boolean, LuaRef};
2
3use crate::ToFunction;
4
5/// Options passed to [`Buffer::set_keymap()`](crate::Buffer::set_keymap)
6/// and [`set_keymap()`](crate::set_keymap).
7#[derive(Clone, Debug, Default, PartialEq, macros::OptsBuilder)]
8#[repr(C)]
9pub struct SetKeymapOpts {
10 #[builder(mask)]
11 mask: u64,
12
13 /// Whether the right-hand side of the mapping shouldn't be remappable.
14 #[builder(argtype = "bool")]
15 noremap: Boolean,
16
17 /// For buffer-local mappings, whether Neovim should wait for more
18 /// characters to be typed if there's a global mapping that could also
19 /// match. See `:h map-nowait` for more details.
20 #[builder(argtype = "bool")]
21 nowait: Boolean,
22
23 /// Whether the keymap should be silent.
24 #[builder(argtype = "bool")]
25 silent: Boolean,
26
27 /// Whether to remap characters in the right-hand side by expanding the
28 /// `<sid>` script tag.
29 #[builder(argtype = "bool")]
30 script: Boolean,
31
32 /// Whether the keymap argument is an expression.
33 #[builder(argtype = "bool")]
34 expr: Boolean,
35
36 /// If `true` setting the keymap fill fail if another keymap with the same
37 /// left-hand side already exists.
38 #[builder(argtype = "bool")]
39 unique: Boolean,
40
41 /// A function to call when the mapping is executed.
42 #[builder(
43 generics = "F: ToFunction<(), ()>",
44 argtype = "F",
45 inline = "{0}.into_luaref()"
46 )]
47 callback: LuaRef,
48
49 /// A description for the keymap.
50 #[builder(
51 generics = "D: Into<types::String>",
52 argtype = "D",
53 inline = "{0}.into()"
54 )]
55 desc: types::String,
56
57 /// When [`expr`](SetKeymapOptsBuilder::expr) is `true`, this option can be
58 /// used to replace the keycodes in the resulting string (see
59 /// [replace_termcodes()](crate::replace_termcodes)).
60 #[builder(argtype = "bool")]
61 replace_keycodes: Boolean,
62}