I want to remap a key, but I want the mapping to be active only when I'm in the last line of my file. Is there a simple way to do this? I would also like to do a similar thing when I'm in the first line, but that is not essential to me at the moment.
My specific use case is that I want to remap
<C-E> when I'm in the final line, but I also want to know if this is possible for curiosity's sake.