Skip to content

Instantly share code, notes, and snippets.

@Falconiere
Last active December 23, 2025 19:52
Show Gist options
  • Select an option

  • Save Falconiere/98ff1afe1897147c39d71cf9825ba58d to your computer and use it in GitHub Desktop.

Select an option

Save Falconiere/98ff1afe1897147c39d71cf9825ba58d to your computer and use it in GitHub Desktop.
Fish shell config with macOS-style selection keybindings
function backward-word-and-select
if not set -q __fish_selecting
set -g __fish_selecting 1
commandline -f begin-selection
end
commandline -f backward-word
end
# Arrow keys (clears selection)
bind \e\[C 'set -e __fish_selecting; commandline -f end-selection forward-char'
bind \e\[D 'set -e __fish_selecting; commandline -f end-selection backward-char'
# Ctrl+Arrow for word navigation (clears selection)
bind \e\[1\;5C 'set -e __fish_selecting; commandline -f end-selection forward-word'
bind \e\[1\;5D 'set -e __fish_selecting; commandline -f end-selection backward-word'
# Cmd+Shift+Arrow for line selection
bind \e\[1\;10C begin-selection end-of-line
bind \e\[1\;10D begin-selection beginning-of-line
# Option+Shift+Arrow for word selection
bind \e\[1\;4C forward-word-and-select
bind \e\[1\;4D backward-word-and-select
# Delete selection with backspace/delete
bind backspace 'set -e __fish_selecting; commandline -f kill-selection end-selection backward-delete-char'
bind delete 'set -e __fish_selecting; commandline -f kill-selection end-selection delete-char'
function forward-word-and-select
if not set -q __fish_selecting
set -g __fish_selecting 1
commandline -f begin-selection
end
commandline -f forward-word
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment