I normally use Vim on Windows and have had no problems with key-mapping, but now that I'm using a virtual machine running Ubuntu, accessed through MobaXterm, things don't quite work as they should. That includes basic things like <c-s> for save and <F5> for run, which I can't live without. I've done my research and read materials that seem to address this problem (here and here), but they went well over my head. Frankly, having to press <c-v> before a function key is downright weird. And it didn't even work when I tried. Can somebody explain, please? As a test case, if I want to map <F2> to :pwd, what do I have to do? To my delight, I've found that my key-mappings do work as intended on Ubuntu's gVim, so I'll be using that. I still would like the answer, though, because I actually prefer the quick and easy feel of plain old vim on the terminal. 
Vim: x-terminal key mapping
vim
You'll have to live without ctrlS because that is the terminal command to stop output (ctrlQ undoes that).Other function keys should be mappable without any problem, just enter :map , then hit the function key you want to map which should show e.g.<F5> for F5, then space, then what you want the key to map to.You can put that line (without the leading colon) in your ~/.vimrc file to enable the mapping for every vim session.If you've tried that then please edit your question to show what exactly you tried and what the result was (and how that differed from your expectations).EDIT:If you want to map sequences that aren't defined in the terminal definition, then you can manually map the sequence.First you need to find out what bytes/characters it sent when you press e.g. ctrlshiftF2. I always use od -c for this; start the command, press the key sequence, hit ctrld to send an end-of-file to the command, which then prints the decoded version:$ od -c^[[24^0000000 033   [   2   4   ^  \n0000006So this is escape, [, 2, 4, ^ (the newline is what I entered after the sequence and should be ignored; you can also hit ctrld twice but then the output is started after the input and looks messed up).Now we know the sequence, and can add the mapping to .vimrc. Add a line such as the following:map <C-[>[24^ :whateveryouwantThe <C-[> sequence is the vim representation of escape, which is the same as ctrl[. After that the characters aren't special so they can be entered as-is.Now ctrlshiftF2 will be mapped to the right hand side you entered when you start vim.