Add configurable default vi mode (#660)

- `vi_default_mode` added
- supports `normal` and `insert`
This commit is contained in:
Varun Vasan V 2024-07-27 15:01:55 +05:30 committed by GitHub
parent 2b0301c1d0
commit a939b82179
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,11 @@ clear_password = false
# Enable vi keybindings
vi_mode = false
# Default vi mode
# normal -> normal mode
# insert -> insert mode
vi_default_mode = normal
# The `fg` and `bg` color settings take a digit 0-8 corresponding to:
#define TB_DEFAULT 0x00
#define TB_BLACK 0x01

View File

@ -3,6 +3,7 @@ const enums = @import("../enums.zig");
const Animation = enums.Animation;
const Input = enums.Input;
const ViMode = enums.ViMode;
animation: Animation = .none,
asterisk: u8 = '*',
@ -45,6 +46,7 @@ term_reset_cmd: [:0]const u8 = "/usr/bin/tput reset",
term_restore_cursor_cmd: []const u8 = "/usr/bin/tput cnorm",
tty: u8 = build_options.tty,
vi_mode: bool = false,
vi_default_mode: ViMode = .normal,
wayland_cmd: []const u8 = build_options.data_directory ++ "/wsetup.sh",
waylandsessions: []const u8 = "/usr/share/wayland-sessions",
x_cmd: []const u8 = "/usr/bin/X",

View File

@ -16,3 +16,8 @@ pub const Input = enum {
login,
password,
};
pub const ViMode = enum {
normal,
insert,
};

View File

@ -194,7 +194,7 @@ pub fn main() !void {
defer password.deinit();
var active_input = config.default_input;
var insert_mode = !config.vi_mode;
var insert_mode = !config.vi_mode or config.vi_default_mode == .insert;
// Load last saved username and desktop selection, if any
if (config.load) {