When I open a document using vi or vim, I am unable to navigate the page using Page Up and Page Down keys. On pressing these keys, vim seems to behave in abnormal maaner, and changes the case of character beneath the cursor. It then takes few seconds to come back again in insert mode.

Please let me know, how to map these keys, so that on pressing them I can scroll through pages smoothly just like Ctrl+ (f / b / u / d ).

[ and 5 are valid Vim commands. But maybe Vim sees the Esc as signalling the start of an escape sequence it doesn't recognize - it has to guess where that sequence ends and restart interpreting characters as commands or data from that point.

~ is a vim command to toggle case of character under cursor.

A Happy Ending

Set TERM correctly (to match Putty/emulator settings) and ensure terminfo has a definition of PgUp etc. In Unix-land, keyboards existed before the IBM PC was born, some of them had a Previous Page key so this key capability is named kpp.

Postscript

Putty doesn't have an arbitrary key-mapping capability so far as I know (I think it was in the wish list) So ...

Configure Putty to emulate a well-known and well-defined terminal type. Unfortunately there aren't any so something like xterm will have to do.

Ensure Putty tells the Linux box what terminal type it is emulating. Partly this is by configuring Putty's settings and partly by using a protocol that communicates TERM (e.g. Putty's ssh support) rather than one that doesn't (Putty's telnet support).

Ensure that TERM is actually set to what it should be (echo $TERM).

Ensure the terminfo entry for that TERM values defines the keys you want (see above).

Ensure the PgUp key sends what it should. In Vim enter insert mode and press Ctrl+V then PgUp