Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
A quick way to comment/uncomment lines in vim:

Put your cursor on the first # character, press Ctrl+V, and go down until the last commented line and press x, that will delete all the # characters vertically.


For commenting a block of text is almost the same:

- First, go to the first line you want to comment, press Ctrl+V. This will put the editor in the VISUAL BLOCK mode.

- Then using the arrow key and select until the last line.

- Now press Shift+I, which will put the editor in INSERT mode and then press #. This will add a hash to the first line.

- Then press Esc (give it a second), and it will insert a # character on all other selected lines.

#vim #comment #comment_out #visual_block
How to disable visual block in VIM?

There is a feature in vim that as you select a text inside of vim, it turns the mode into VISUAL BLOCK. This is annoying for me in case you want to disable it put the below code in ~/.vimrc:

set mouse-=a

#vim #visual_block #mouse #set #vimrc
How to add comma to end of multiple lines in VIM? Yeah, that's tricky boy :))))

1- First go to Visual Block mode by pressing ^v (CTRL+V)

2- Now select your mutiple lines by going down using down arrow button.

3- Go to end of line by pressing end command in your keyboard in linux and windows or if you're using MAC by pressing fn+right arrow.

4- Now press shift+A (It worked in MAC in linux we needn't that)

5- type comma

6- press ESC (wait one second or so)

Voila! We're done.

#vim #tricks #VB #visual_block