# $DOTFILES/common/inputrc
# Date: 2024-12-22
# Author: js0ny
# GNU Readline config file, works for programs that use that library
# e.g. Python REPL, Lua REPL, Bash on Linux

# Location:
# $INPUTRC
# export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
# Linking:
# ln -sf $DOTFILES/common/inputrc $INPUTRC

# Use `man readline` to see all the options
# Reference: https://wiki.archlinux.org/title/Readline

# Colemak Key Remaps
set editing-mode vi

set mark-directories on
set completion-ignore-case on
# show all completions on a double tab without ringing the bell
set show-all-if-ambiguous on
# do not bell on tab-completion
set bell-style none


# 34 - blue, 32 - green
set show-mode-in-prompt on
set vi-cmd-mode-string \1\e[1;34m\2N\1\e[0m\2
set vi-ins-mode-string \1\e[1;32m\2I\1\e[0m\2
set emacs-mode-string \1\e[1;32m\2@\1\e[0m\2

$if mode=vi
    set keymap vi-command
    "n": next-history
    "e": previous-history
    "l": vi-insertion-mode
    "L": vi-insert-beg
    "i": forward-char
    "H": vi-first-print
    "I": end-of-line
    set keymap vi-insert
# Hybrid (Emacs) binds in Vi-Insert
# C-a as ^ instead of 0
    "\C-a": vi-first-print
    "\C-e": end-of-line
    "\C-n": next-history
    "\C-p": previous-history
# Bash will parse <C-Backspace> to C-h
    "\C-h": unix-word-rubout
$endif


# Color files by types
# Note that this may cause completion text blink in some terminals (e.g. xterm).
set colored-stats On
# Append char to indicate type
set visible-stats On
# Mark symlinked directories
set mark-symlinked-directories On
# Color the common prefix
set colored-completion-prefix On
# Color the common prefix in menu-complete
set menu-complete-display-prefix On

# This will disable `^C` shown in the prompt when pressing `Ctrl+C`
set echo-control-characters off
