diff --git a/src/config.zig b/src/config.zig index ec0e51d..05dc404 100644 --- a/src/config.zig +++ b/src/config.zig @@ -17,6 +17,7 @@ inline_diagnostics: bool = true, animation_min_lag: usize = 0, //milliseconds animation_max_lag: usize = 150, //milliseconds enable_format_on_save: bool = false, +restore_last_cursor_position: bool = true, default_cursor: []const u8 = "default", indent_size: usize = 4, diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 7d68dcb..b68e273 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -384,7 +384,11 @@ const cmds = struct { const same_file = if (self.get_active_file_path()) |fp| std.mem.eql(u8, fp, f) else false; const have_editor_metadata = if (self.buffer_manager.get_buffer_for_file(f)) |_| true else false; - if (!same_file and !have_editor_metadata and line == null) { + if (tui.config().restore_last_cursor_position and + !same_file and + !have_editor_metadata and + line == null) + { const ctx_: struct { allocator: std.mem.Allocator, from: tp.pid,