---
title: "Press Home or End Button to Navigate to the Beginning or End of Line in zsh"
date: 2023-01-04T10:27:59.000Z
author: Z.SHINCHVEN
tags: [zsh]
canonical: https://atlassc.net/2023/01/04/home-or-end-button-navigation-in-zsh
---
I've been using zsh with starship prompt for a while. One small pain is that `home` and `end` button doesn't navigate the cursor to the beginning or end of the command line. It's the muscle memory from using bash.

I didn't get it fixed for a long time, I thought it was a hotkey issue of the terminal emulator and I never found the option to fix it in preferences. 

Until today, I tried to google it, turns out that it's a zsh hotkey binding issue.

To fix it, add the following line to `~/.zshrc`:

```zsh
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
```

## References

- [How to get fn + left key working on macOS after changing to zsh from bash?](https://apple.stackexchange.com/a/396230/430509)
