summaryrefslogtreecommitdiffstats
path: root/.config/bash/inputrc
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-05-04 08:44:50 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-05-06 16:43:16 +0200
commit0bc002288b984d8ec8123c135456570c78a22da3 (patch)
tree020ed3f6a7f28a081687a3e46ea190e3aa724f7c /.config/bash/inputrc
downloaddotfiles-0bc002288b984d8ec8123c135456570c78a22da3.tar.gz
dotfiles-0bc002288b984d8ec8123c135456570c78a22da3.zip
feat: initial setup
- `dotfiles` (this project's CLI) - foot configuration - tmux configuration - bash configuration - nvim (as a git submodule) + configuration - ranger configuration - fzf configuration - KDE global shortcuts - Other miscellaneous dependencies
Diffstat (limited to '.config/bash/inputrc')
-rw-r--r--.config/bash/inputrc88
1 files changed, 88 insertions, 0 deletions
diff --git a/.config/bash/inputrc b/.config/bash/inputrc
new file mode 100644
index 0000000..c56068e
--- /dev/null
+++ b/.config/bash/inputrc
@@ -0,0 +1,88 @@
+# ------------------------------------------------------------------------------
+# Readline configuration file
+# ------------------------------------------------------------------------------
+#
+# https://www.gnu.org/software/bash/manual/bash.html#Readline-Init-File
+#
+# Executed by Readline when a program starts the Readline library
+#
+# Options that take a string parameter cannot have a comment next to them, e.g.
+# `set bell-style none # Some comment` will not work.
+
+# ------------------------------------------------------------------------------
+# Variable settings
+# ------------------------------------------------------------------------------
+
+# Completion configuration
+#
+# It's worth noting what's going on here since it's not clear from the
+# documentation.
+#
+# There are three cases to cover for the behavior I want:
+# - Only one match → complete
+# - Multiple matches → show the list
+# - Multiple matches with common prefix → complete prefix and show the list
+#
+# By default, `menu-complete()` will select the first completion, this covers
+# the first case. `show-all-if-ambiguous` covers the second case by showing the
+# list when there are multiple choices. `menu-complete-display-prefix` covers
+# the third case by completing the common prefix.
+set show-all-if-ambiguous on
+set menu-complete-display-prefix on
+
+set editing-mode vi # Vi keybindings
+set match-hidden-files off # Don't match hidden files, unless a leading '.' is typed explicitely
+set completion-ignore-case on # Ignore case when mathching completions
+set search-ignore-case on # Ignore case when searching
+set skip-completed-text on # Don't insert match when when completing in the middle of a word
+set completion-query-items 100 # Prompt before showing more than this number of completions
+set completion-display-width 100 # 100 columns for completion results
+set print-completions-horizontally off # Sort completions horizontally
+set colored-stats on # Show completions using colors depending on file type
+set visible-stats on # Append a character denoting file type
+set colored-completion-prefix on # Color the common prefix of completions
+set expand-tilde off # Don't expand tilde automatically
+set show-mode-in-prompt on # Show current mode (vi-insert, vi-command) in prompt
+# String to display for each mode
+set vi-cmd-mode-string -CMD-
+set vi-ins-mode-string -INS-
+# Don't ring the terminal bell
+set bell-style none
+
+# ------------------------------------------------------------------------------
+# Key bindings
+# ------------------------------------------------------------------------------
+#
+# To unbind: bind to `""`
+#
+# https://www.gnu.org/software/bash/manual/bash.html#Bindable-Readline-Commands-1
+
+$if mode=vi
+
+# vi-insert ____________________________________________________________________
+set keymap vi-insert
+$include ~/.config/bash/vi.inputrc
+
+"\e\t": shell-expand-line # Alt+Tab perform shell expansion
+"\C-i": menu-complete # Tab cycle completions forward
+"\e[Z": menu-complete-backward # Shift+Tab cycle completions backward
+"\C-a": insert-completions # Ctrl+a insert all completions
+"\e!": dynamic-complete-history # Alt+! complete from history entries (not lines!)
+"\eh": backward-char # Alt+h one char backward
+"\el": forward-char # Alt+l one char forward
+"\C-b": beginning-of-line # Ctrl+b beginning of line
+"\C-e": end-of-line # Ctrl+e end of line
+
+$if Bash
+
+"\ee": "ranger\r" # Alt+e open `ranger`
+
+$endif
+
+# vi-command ___________________________________________________________________
+set keymap vi-command
+$include ~/.config/bash/vi.inputrc
+
+"u": vi-undo # u undo
+
+$endif