18

Have you ever noticed that the default vi key bindings on the Raspberry Pi are a little wacky? For example, while in insert mode, try using the arrow keys to navigate. Not happening :)

Is this a subtle way of getting us to use insert and command mode properly or maybe the bindings were just overlooked when the image was built?

I'm quite used to a certain key mapping in Fedora/Debian that allows the use of navigation keys while in insert mode. To get the familiar bindings I'm used to, do I need to fiddle with terminal emulation or some sort of configuration file somewhere?

3
  • 6
    I expect it's because you are used to vim and what you're now experiencing is truly vi. On modern distros, the vi command is often syslinked to vim.
    – Jivings
    Commented Dec 21, 2012 at 18:18
  • Is this through ssh? You might need to even try stty sane and setting your TERM variable (export TERM=linux is usually easiest for me to remember) Commented Dec 21, 2012 at 19:33
  • Which version? Latest (oct release) seems OK, at least over ssh.
    – ergosys
    Commented Dec 21, 2012 at 22:30

3 Answers 3

22

The default package is vim-tiny. You can install a version that is more familiar:

sudo apt-get install vim

Extra configuration and customization can be placed in the .vimrc file in your home directory.

1
  • Thanks buddy! Just when I thought there was no more hope, you saved the day :)
    – Brad Hein
    Commented Dec 22, 2012 at 4:45
2

Remove and purge vim-tiny before installing vim. It will work as expected after that.

1
  • Had to do this as well. vim-tiny and vim seem to depend on different versions of vim-common and that prevents me from installing both.
    – qznc
    Commented Dec 22, 2019 at 12:02
1

I also had this problem when I logged in as the root user but not the pi user. I have also installed vim with:

apt-get install vim

That didn't solve it alone but a little digging and I discovered that it was some environment variable differences. I managed to get my happy vi behavior of being able to move around with the cursor keys even in insert mode by simply changing the /root/.profile file to read as follows:

if [ -n "$BASH_VERSION" ]; then
  if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
  fi
fi

if [ -d "$HOME/bin" ] ; then
  PATH="$HOME/bin:$PATH"
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.