Display line numbers in vim. If a file is open with vim press ESC (if you are in insert mode) and then press colon (:) and type:
The above command will print line numbers in front of each line.
Now if you want to hide line numbers you just need to press colon again and type:
#vim #tricks #line_number #nonumber #number
set number
The above command will print line numbers in front of each line.
Now if you want to hide line numbers you just need to press colon again and type:
set nonumber
#vim #tricks #line_number #nonumber #number
One the most useful commands in
In case you want to just delete inside of something and you don't want to go into
Let's give an example. Suppose we have lines like below and we have opened it in vim:
Place the cursor between double quotes somewhere in the
Now let's assume we have a block of code like below:
Go inside of the block of curly braces (`{}`) and put your cursor inside of the block. Now press
You can do the same with every block of code and every character like
#vim #tricks #commands #change #delete #ci #di
vim
is to delete or change inside of a block like {}
or inside of a charater like "SOME THING"
.In case you want to just delete inside of something and you don't want to go into
INSERT
mode just press di
keyboard buttons in order, otherwise press ci
keyboard buttons to go in INSERT
mode and change something.Let's give an example. Suppose we have lines like below and we have opened it in vim:
user_id = "43dd94e5d79ffeb2ffffabd112d5e945"
name = "Alireza"
dob = "SECRET :)"
Place the cursor between double quotes somewhere in the
SECRET :)
and press d
then press c
keys and finally press double quote ("). The vim will search for the surrounding double quotes and will remove everything inside of it. Our output is:user_id = "43dd94e5d79ffeb2ffffabd112d5e945"
name = "Alireza"
dob = ""
Now let's assume we have a block of code like below:
users_data = {
}
Go inside of the block of curly braces (`{}`) and put your cursor inside of the block. Now press
c
on your keyboard then press i
afterward, and at the end press {
on your keyboard. It will delete everything inside of {}
for you and put your vim mode in INSERT
mode. So you would have the following output:users_data = {
}
You can do the same with every block of code and every character like
()
, []
, ''
, etc.ci
stands for Change Insidedi
stands for Delete Inside#vim #tricks #commands #change #delete #ci #di
To join lines in
#pycharm #tricks #join #join_lines
PyCharm
first select you lines, then use CTRL+Shift+j
(⌃⇧J) to put them in one line.#pycharm #tricks #join #join_lines
How to add comma to end of multiple lines in
1- First go to
2- Now select your mutiple lines by going down using
3- Go to end of line by pressing
4- Now press
5- type comma
6- press ESC (wait one second or so)
Voila! We're done.
#vim #tricks #VB #visual_block
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