iTerm2 has terrible defaults concerning option + arrow
, cmd + arrow
+ backspace
or delete
. Here's a fixed dynamic profile to fix that.
Refer to iTerm 2: How to set keyboard shortcuts to jump to beginning/end of line? Answer.
I followed instructions, took the first suggestion each time and generated this iTerm2 profile.
git clone https://github.com/GabLeRoux/iterm2-macos-dynamic-profile.git
cd iterm2-macos-dynamic-profile
# copy the json profile to dynamic profiles folder
cp ./fix-iterm2-keys-profile.json ~/Library/Application\ Support/iTerm2/DynamicProfiles
# or create a symlink for easier updates
ln -s $(pwd)/fix-iterm2-keys-profile.json ~/Library/Application\ Support/iTerm2/DynamicProfiles/
- Open iTerm2 Preferences -> Profiles
- Select the new dynamic profile from the list
- Click
Other Actions
->Bulk Copy from Selected Profile...
- Check
Keys
checkbox - Select your profile
- Hit Copy button
- Enjoy a much better life with your keyboard
As explained in iTerm 2: How to set keyboard shortcuts to jump to beginning/end of line? Answer:
# Copy fixed keys to your dotfiles
mkdir ~/dotfiles/
cp ./fix_zsh_keys.sh ~/dotfiles/
# Add entry to your ~/.zshrc
echo 'source ~/dotfiles/fix_zsh_keys.sh' >> ~/.zshrc
# Reload your .zshrc for changes to take effect
source ~/.zshrc
See iterm2 dynamic profiles documentation for more details.