I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I use a plugin to do this because different languages have different requirements for comments and I'm lazy). I use commentary but there are a few that all do much the same thing.
Out of your options, I prefer #3, but I'd also consider using a macro and repeating it n times if the comments required changing the start and end of the line, like in CSS.
Using ctrl-smilieface to enter pedantic mode I feel the urge to point out that #3 is Vim only and not available in Vi.
I haven't had a lot of experiences with different plugins, but I will have to check out commentary.
So funny, yes. I tend to use the words 'vi' and 'vim' interchangeably and I was debating if I should make that distinction on this blog.
True story, I used vi proper for almost 10 years and for 8 of those years at work on an old RedHat Workstation distribution. A time came where all our work machines got upgraded to Ubuntu and I ended up with vim on my machine (I think it was vim-tiny). I wasn't familiar with visual mode. Everytime I accidentally hit CTRL + v, I would quickly ESC out because I didn't know what it was doing.
3 months ago, I decided to finally make the small effort to learn visual mode.
I love how you can learn new things all the time even in the tools you've been using forever!
Thanks for the comments!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I use a plugin to do this because different languages have different requirements for comments and I'm lazy). I use commentary but there are a few that all do much the same thing.
Out of your options, I prefer #3, but I'd also consider using a macro and repeating it n times if the comments required changing the start and end of the line, like in CSS.
Using ctrl-smilieface to enter pedantic mode I feel the urge to point out that #3 is Vim only and not available in Vi.
I haven't had a lot of experiences with different plugins, but I will have to check out commentary.
So funny, yes. I tend to use the words 'vi' and 'vim' interchangeably and I was debating if I should make that distinction on this blog.
True story, I used
vi
proper for almost 10 years and for 8 of those years at work on an old RedHat Workstation distribution. A time came where all our work machines got upgraded to Ubuntu and I ended up withvim
on my machine (I think it was vim-tiny). I wasn't familiar with visual mode. Everytime I accidentally hit CTRL + v, I would quicklyESC
out because I didn't know what it was doing.3 months ago, I decided to finally make the small effort to learn visual mode.
I love how you can learn new things all the time even in the tools you've been using forever!
Thanks for the comments!