NodeMCU capable of key injection?
No, you can't use a NodeMCU for this.

To emulate a USB keyboard you have to have a device with a main MCU on it which is directly connected to USB. The ESP8266 on the NodeMCU is not a USB-capable MCU, and so it uses a USB to UART bridge chip to connect the ESP8266 to the USB of your computer.

You can't program that bridge chip, so you can't make it anything other than a serial port.  

Common devices that are directly USB connected and can emulate a keyboard include:


Arduino Micro
Teensy 3.X
Fubarino Mini / SD
Arduino Leonardo
chipKIT Lenny


And there are many more.

For 8-bit Arduino boards you need to look at the MCU it uses. If it's an ATMega32U4 as the main MCU then you can program it to be a keyboard.



Addendum: There are ways of making non-USB boards work as a keyboard. For ATMega328P based Arduinos and similar that use an ATMega16U2 chip as the USB to UART bridge, that bridge chip can be reprogrammed to appear as a keyboard.  For other MCUs there may be software "bit-banged" USB implementations available (such as V-USB), though YMMV with those implementations, and they require building extra hardware to interface the chip to the USB port.