1

By using ctrl + / we can comment / uncomment the current line in android studio

and we can create shortcuts commands from settings->Keymap

now my question is how to create new keyboard shortcut to comment the current line plus adding specific word "TODO" (or any other word) ???

for example:

String str="";

after pressing ctrl + / (or any other new shortcut) it should turn into this

// TODO: String str="";

I remember this is possible in Eclipse, what about Android Studio ? is it possible?

1

In Android Studio you can create custom macros and set them to whatever hotkey you want.

To create the macro:

  • Go to Edit → Macros → Start Macro Recording and then enter your commands
  • When done, in the same menu hit Stop Macro Recording
  • Save it under some name.

To add a shortcut for the macro, go to Settings -> Keymap -> Macros, find your macro and add a keyboard shortcut for it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.