# VSCode-style keybindings.
#
# VSCode is a *modeless* editor: build the crate with the `textmode-normal`
# feature so the editor stays in edit/insert mode, and the `[ins]` section below
# is the one that's actually consulted. `[nor]` and `[sel]` are provided for
# parity with the other built-in presets (and for the unusual case of running
# this preset under a modal `textmode-vim` build).
#
# Notes / limitations of the current engine (tracked for later phases):
#   - Multi-cursor (Ctrl+D, Ctrl+Alt+Up/Down) is not implemented yet.
#   - IntelliSense accept (Tab/Enter while the popup is open) needs
#     context-sensitive handling; only trigger + navigate are bound here.
#
# Chords like Ctrl+Backspace, Ctrl+Shift+K and Shift+Alt+Arrow only reach the
# editor when the terminal reports enhanced key modifiers (the Kitty keyboard
# protocol). The application is responsible for enabling that; see the
# `textarea_vscode_minimal` example.

[ins]
mode = "ins"

# --- Caret movement ---
move_left = ["Left"]
move_right = ["Right"]
move_up = ["Up"]
move_down = ["Down"]
move_word_prev = ["Ctrl+Left"]
move_word_next = ["Ctrl+Right"]
move_line_start = ["Home"]
move_line_end = ["End"]
move_first_line = ["Ctrl+Home"]
move_last_line = ["Ctrl+End"]
move_page_up = ["PageUp"]
move_page_down = ["PageDown"]

# --- Deletion ---
delete_char_backward = ["Backspace"]
delete_char_forward = ["Delete"]
delete_word_backward = ["Ctrl+Backspace"]
delete_word_forward = ["Ctrl+Delete"]
delete_line = ["Ctrl+Shift+k"]

# --- Editing ---
join_line_below = ["Ctrl+j"]
paste_after = ["Ctrl+v"]
undo = ["Ctrl+z"]
redo = ["Ctrl+y", "Ctrl+Shift+z"]

# --- Line operations ---
# Ctrl+C / Ctrl+X with no selection copy / cut the whole current line, matching
# VSCode. (They become selection-aware once modeless selection lands.)
copy_line = ["Ctrl+c"]
cut_line = ["Ctrl+x"]
move_line_up = ["Alt+Up"]
move_line_down = ["Alt+Down"]
duplicate_line_up = ["Shift+Alt+Up"]
duplicate_line_down = ["Shift+Alt+Down"]

# --- Selection (Shift extends; plain movement collapses) ---
select_left = ["Shift+Left"]
select_right = ["Shift+Right"]
select_up = ["Shift+Up"]
select_down = ["Shift+Down"]
select_word_prev = ["Shift+Ctrl+Left"]
select_word_next = ["Shift+Ctrl+Right"]
select_line_start = ["Shift+Home"]
select_line_end = ["Shift+End"]
select_doc_start = ["Shift+Ctrl+Home"]
select_doc_end = ["Shift+Ctrl+End"]
select_all = ["Ctrl+a"]

# --- IntelliSense ---
open_suggestions = ["Ctrl+space"]
suggestion_down = ["Ctrl+n"]
suggestion_up = ["Ctrl+p"]
exit_suggestions = ["Ctrl+g"]

[nor]
mode = "nor"
move_left = ["Left", "h"]
move_right = ["Right", "l"]
move_up = ["Up", "k"]
move_down = ["Down", "j"]
move_word_prev = ["Ctrl+Left"]
move_word_next = ["Ctrl+Right"]
move_line_start = ["Home"]
move_line_end = ["End"]
move_first_line = ["Ctrl+Home"]
move_last_line = ["Ctrl+End"]
move_page_up = ["PageUp"]
move_page_down = ["PageDown"]
enter_edit_mode_before = ["i"]
enter_edit_mode_after = ["a"]
enter_highlight_mode = ["Ctrl+space"]
paste_after = ["Ctrl+v"]
undo = ["Ctrl+z"]
redo = ["Ctrl+y", "Ctrl+Shift+z"]

[sel]
mode = "sel"
exit_highlight_mode = ["esc"]
move_left = ["Left"]
move_right = ["Right"]
move_up = ["Up"]
move_down = ["Down"]
move_word_prev = ["Ctrl+Left"]
move_word_next = ["Ctrl+Right"]
move_line_start = ["Home"]
move_line_end = ["End"]
yank_selection = ["Ctrl+c"]
delete_selection = ["Ctrl+x"]
paste_after = ["Ctrl+v"]
undo = ["Ctrl+z"]
redo = ["Ctrl+y", "Ctrl+Shift+z"]
