Often I have to comment out a line of code. The following 2 maps helped me with speeding up my workflow.
cl to comment a line and
ucl to uncomment a line
:map cl 0i//<Esc>
:map ucl 02x
0 jumps to the first first character (including whitespaces) of the current line.
i changes to the insert mode
//will insert 2 slashes. For other programming languages where you something else for commenting out a line, you need to replace this. As an example I would replace the
-- for Eiffel.
<Esc> switches back to normal mode.
ucl command is even easier.
0 jumps to the first character (including whitespaces) of the current line.
2x delets 2 characters starting at the cursor position.