Hello Guys Today I am, going to share with you some amazing tips and cool hacks about Sublime Text which makes your work easier and saves lots of time, and of course this is my favorite text editor right now.
1> Find a file from the working directory
Let us suppose you are working on a project which has 1000’s of files and you want a file that is inside some x-x-x directory and you don’t have an exact idea where the file is.
Here in this case you can’t sit and search for each directory to find that file and it obviously takes lots of time. So for this sublime has an amazing hack where you can find your file in seconds.
ctrl+P -> filename
You just need to click on ctrl+p and write the file name for which you are searching for and all the related files with the name will appear and you can choose from them.
2> Find a function from a file
In a file, you have 100’s of functions but you have no idea where the function lies in that file and if you go on searching the whole page imaging how it feels, but I feel like oh God. So for this, we have another amazing hack
ctrl+P -> @method
You just need to click on ctrl+p and write the function name preceding @ which is used to find your function. Try this and save your time.
3> Find a line with line number
If you have 10000 lines of code and you want 7654th and the first thing that comes in your mind is scrolling right, yes this works but sometimes it may not, as some time, it takes you to somewhere else.
For this, we have a simple solution that takes you to the exact line you want.
ctrl+G -> line number
You just need to click on ctrl+g and write the line number and you get the file and start working.
4> Find a word from all files in your directory
If you want to find a particular word from all the files in your directory, then you can use this keyword.
You just need to click on ctrl+shift+f then 3 textboxes will appear at the bottom where the first one indicates to find the word and the second form where you can choose certain options like find the word from a particular folder, and the third is to replace the word with another word if you want to replace you can use that or leave it empty and click on find if you want to find or replace to replace.
5> Replace all the same words without using find – replace
Suppose if you have 1000 lines of code and need to change a word with another word, then what you do? you simply say find and replace, yes you can do that but imagine if you want only to change the first 10 same words, then how would you do you can’t goto each line and change right?
For this, I have an amazing hack which I personally love and use in my everyday programming and saves lots and lots of time.
You just need to select on a particular word and go on pressing ctrl+d up to where you want to change, like if you want to change a word VBloggers from a file but only the first 10 then select the first word and click ctrl+d 9 times and the change the word and save. Changes are done Cool right.
6> Put tags to a line or word or letter
If you want to put a tag to any word, the letter, or line then this keyword is useful, By default, it gives p tag you can change it after putting tag.
7> Bring a line-up or down
If you used cut and paste to bring a line to a few places above or below, just try this one.
select the word -> ctrl+shift+arrow keys
8> Duplicate a line
select the line or click anywhere on that line-> ctrl+shift+d
9> Cut a line without selecting
click anywhere on that line-> ctrl+X
10> Get all lines to one line
For this, you need to click at the start of each line using ctrl+click which will select each line from where you want to start and the ctrl+j
click at the start of each line using ctrl+click-> ctrl+J
11> Comment a line
11> Zoom in and Zoom out editor
Zoom In ctrl+ (+)
Zoom Out ctrl+ (-)