# Theme
theme = "catppuccin_macchiato_minimal"

[keys.normal]

# Navigation
n = "move_char_left" # Maps the 'a' key to the move_char_left command
i = "move_visual_line_down"
e = "move_visual_line_up"
o = "move_char_right"
"S-tab" = "jump_backward"

I = "page_down"
E = "page_up"

# Modes
h = "insert_mode"
H = "insert_at_line_start"
l = "open_below"
L = "open_above"

# Search
k = "search_next"
K = "search_prev"

# Selection
C-s = "split_selection_on_newline"
C-minus = "merge_selections"
C-_ = "merge_consecutive_selections"
"C-;" = "flip_selections"
"C-:" = "ensure_selections_forward"
"C-," = "remove_primary_selection"
C-c = "change_selection_noyank"
C-d = "delete_selection_noyank"
"C-(" = "rotate_selection_contents_backward"
"C-)" = "rotate_selection_contents_forward"
C-x = "shrink_to_line_bounds"
C-J = "join_selections_space"
C-K = "remove_selections"
C-o = "expand_selection"
C-i = "shrink_selection"
C-p = "select_prev_sibling"
C-n = "select_next_sibling"

# Misc
"C-/" = "toggle_comments"
"@" = ":append-output git config get user.email"

[keys.normal.space]
# Git blame for line
B = ":sh git log -n 5 --format='format:%%h (%%an: %%ar) %%s' --no-patch -L%{cursor_line},+1:%{buffer_name}"
x = ":write-buffer-close"
X = ":write-quit-all"
o = ":config-open"
h = "hover"
k = "select_references_to_symbol_under_cursor"

[keys.normal.g]
"/" = "goto_next_buffer"
h = "goto_previous_buffer"
n = ["collapse_selection", "extend_to_line_start"]
o = ["collapse_selection", "extend_to_line_end"]
e = "move_line_up"
i = "move_line_down"
l = "goto_last_line"

p = "no_op"
k = "no_op"
j = "no_op"

[keys.normal.m]
m = ["select_mode", "match_brackets", "normal_mode"]

[keys.select]
n = "extend_char_left"
i = "extend_line_down"
e = "extend_line_up"
o = "extend_char_right"

[keys.select.g]
"/" = "goto_next_buffer"
h = "goto_previous_buffer"
n = "goto_line_start"
o = "goto_line_end"
e = "move_line_up"
i = "move_line_down"
l = "goto_last_line"

p = "no_op"
k = "no_op"
j = "no_op"

# Window mode
[keys.normal."C-w"]
h = "hsplit"
C-h = "hsplit"
n = "jump_view_left"
C-n = "jump_view_left"
i = "jump_view_down"
I = "swap_view_down"
C-i = "jump_view_down"
e = "jump_view_up"
E = "swap_view_up"
C-e = "jump_view_up"
o = "jump_view_right"
O = "swap_view_right"
C-o = "jump_view_right"

# Remove old
s = "no_op"
C-s = "no_op"
H = "no_op"
j = "no_op"
J = "no_op"
C-j = "no_op"
k = "no_op"
K = "no_op"
C-k = "no_op"
l = "no_op"
L = "no_op"
C-l = "no_op"

[editor]
auto-format = true
auto-save = true
bufferline = "always"
color-modes = true # color each mode differently in statusline
completion-timeout = 5
cursorcolumn = true
cursorline = true
indent-heuristic = "tree-sitter"
line-number = "relative"
rulers = [120]
text-width = 120
end-of-line-diagnostics = "hint"

[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"

[editor.file-picker]
hidden = false

[editor.indent-guides]
render = true

[editor.inline-diagnostics]
cursor-line = "warning"
other-lines = "disable"
prefix-len = 5
max-diagnostics = 1
max-wrap = 30

[editor.lsp]
display-messages = true
display-inlay-hints = true

[editor.soft-wrap]
enable = true
max-wrap = 30

[editor.statusline]
left = ["mode", "file-modification-indicator", "spinner", "version-control"]
center = ["file-name"]
right = ["diagnostics", "selections", "register", "position", "file-encoding"]
mode.normal = "Normal"
mode.insert = "Insert"
mode.select = "Select"

[editor.whitespace.render]
space = "all"
tab = "all"
tabpad = "all"
newline = "none"
nbsp = "none"

[editor.whitespace.characters]
space = " "
# space = "·"
tab = "⇀"
tabpad = " "


#w = "move_line_up" # Maps the 'w' key move_line_up
#"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
#g = { a = "code_action" } # Maps `ga` to show possible code actions
#"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
