When I open vi on windows bash and go into insert mode, the arrows and the ins/del/home/end/pg up/down keys (and perhaps even more) seem to not work correctly. Many of them just cause a character to be typed, where others cause some weird deletion/cursor behavior.

Note that these keys work fine with the default mode or with the visual mode.
Windows build number: 10.0.16299.125
I originally filed this on WSL issue tracker (WSL#3076), since there was already a similar issue filed there before (WSL#1154), but I was told to file the issue here. The main difference between those two issues is that I'm not using any kind of a custom console, but I'm running the native bash executable as is.
Do you have any modifications to your .bashrc? .vimrc? /etc/inputrc? what does infocmp output from the bash prompt? is this for vi as a symlink to vim (usually the default), or is this actually vi? Which distro is this?
Vim's been pretty stable since the release of WSL, I'd be very curious if something broke it.
I honestly don't remember if I have modified .bashrc in the past or, but as for the rest of the files I surely did not modify them.
~/.bashrc
~/.vimrc doesn't exist.
/etc/inputrc
infocmp
eyal@eyal:~$ which vi
/usr/bin/vi
eyal@eyal:~$ vim
-bash: vim: command not found
Huh, so you only have vi on your system, not vim.
this link is particularly enlightening
A little while down, in one of the comments:
Actually, it is expected behavior, as that is how Vi was originally programmed. VIM, (unofficially) the successor to Vi, is in Vi-compatible mode by default, which includes this behavior for the arrow keys. So the word "should" here is merely subjective, as VIM is actually doing what it was purposefully programmed to do.
Looks like we're doing the right thing here!
Yep, that seems to work. Thanks :)
I would just install vim, it's what I regularly use and works like a charm. I prefer over nano but that might just be due to having more experience with vi in general. I noticed Debian and Kali don't include many things you find in Ubuntu or OpenSuse in their WSL image. It's sad when you have to apt install man because it wasn't included by default and even then you don't get the same match-up to a fresh install of Ubuntu. Vim is already there on Ubuntu incidentally as that was what I used before switching eventually to Debian.
@DarthSpock correct me if I am wrong but Debian distros are a lot lighter so they don't include a lot of packages that Ubuntu has by default
Well the one published to the Store is more minimal. You can get a full iso if you wanted and install using the wsl-distro launcher project.
I am having this issue just using SSH in Windows Terminal
Most helpful comment
Huh, so you only have vi on your system, not vim.
this link is particularly enlightening
A little while down, in one of the comments:
Looks like we're doing the right thing here!