Overview
This Tutorial will teach you how to use and configure Sublime Text.
- How to install packages in sublime text editor
- How to remove packages in sublime text editor
- Visual requirements
- Ftp connection
- Git
- Find & replace
- Bonus
- Pros & cons
Features of Sublime text editor
1. How to install packages in sublime text editor
Package control: To install package control, follow the instructions below:
Procedure:
- Open the command palette
win/Linux:ctrl+shift+p, mac:cmd+shift+p
- Type install package control, press enter
- When you click on the package control:install package, the package window appears as shown below. You can search for the particular package and press enter.
- Preferences > package setting show all your installed packages.
2. How to remove packages in sublime text editor
To remove package control, follow the instructions below:
Procedure:
- Open the command palette
win/Linux:ctrl+shift+p, mac:cmd+shift+p
- Type remove package control, press enter
3. Basic Requirements
- Code styling (auto)
- Code beautification
- Auto complete tag
- Commenting options
- Shortcut keys
- Error detection
- Automatic code suggestion
-
Code styling (auto)
- Sublime can automatic complete tag, highlight CSS color codes, easy to understand (install emmet package)
-
Code beautification
- Sublime can beautify html code.(install html beautifier, php beautifier package)
-
Auto complete tags
- Sublime can Automatic complete html tags, brackets.
-
Commenting options
- There are two options available in sublime editor for commenting
- Edit > comment > Toggle comment
Toggle comment(Ctrl+/ )
It comments lines like this:// Line 1
// Line 2 - Edit > comment > Toggle comment
Toggle comment (Ctrl+/ )It comments lines like this:/*
Line 1
Line 2
*/
- Edit > comment > Toggle comment
- There are two options available in sublime editor for commenting
-
Shortcut keys
- You can create your own custom keymap preferences > key binding
- There have multiple default shortcut keys available also you can create your own keys in user section as shown below
-
Error detection
- Detect syntax error of php html & css.
(install sublimeLinter-php & sublimeLinter-html-tidy package)
.
- Detect syntax error of php html & css.
-
Automatic code suggestion
- Suggest automatic code of html css js & wordpress functions also automatic show file names(install jshint package, wordpress code reference package & auto file name package)
3. FTP connection
- Remote FTP/SFTP with sublime
- FTP connection within multiple accounts
- Auto complete on save
- Comparison with remote
- Upload & download multiple files
-
Remote FTP/SFTP with sublime
- Install sftp via package control
(ctrl+shift+p)
go to the package control:install package and press enter then type sftp. Selecting sftp will start to install package - Right click on the folder icon/name and go to sftp/ftp > map to remote and set the configuration and save file as sftp-config.json
- Install sftp via package control
-
FTP connection within multiple accounts
- Right click on the folder icon/name and go to sftp/ftp > add alternate remote mapping this will create alternative sftp-config-alt.json file.
- Set the configuration with another account and save file.
- Right click on the folder icon/name and go to sftp/ftp > switch remote mapping option show the multiple remote accounts. Select one and right click on the folder & upload file.
-
Auto complete on save
- In the ftp-config.json file
"upload_on_save":false
, set to true
- In the ftp-config.json file
-
Comparison with remote
- Right click on the folder icon/name and go to sftp/ftp > Diff remote file.this will show the comparison with remote
-
Upload & download multiple files
- Right click on the folder icon/name and go to sftp/ftp >Upload file
- Right click on the folder icon/name and go to sftp/ftp >Upload folder
- Right click on the folder icon/name and go to sftp/ftp >Download file
- Right click on the folder icon/name and go to sftp/ftp > Download folder
5. Git
-
Git in sublime text
- Install git package for git integration.
https://packagecontrol.io/packages/Git
- Install git package for git integration.
-
Highlight untracked and staged files
The sidebar will show the git status of files and folders with a icon like,- Untracked
- Modified
- Missing
- Staged addition
- Staged modification
- Staged deletion
-
Git all facilities
- Install sublime merge package
- Right click on file > open git repository
- Tools > command palette >search git status will display status window with tracked and untracked files. We can perform multiple action on it using the short keys given below,
6. Find & Replace
- Find and replace in particular extensions files inside folder
- Find and replace in current, selected files
- Find and replace in folder
- Find and replace within multiple files
-
Find and replace in particular extensions files inside folder
- Using extensions like .js, .php, /project/*js we can find words and replace.
-
Find and replace in current, selected files
- You can find word in file and replace with another word
-
Find and replace in folder
- Type word which you want to replace & the name of the file or folder and replace word
-
Find and replace within multiple files
- Find>find in files and then type word which you want to replace & the name of the file or folder and word you want to replace with.
6. Workspace
-
Create workspace/project
- Project > add folder to project >open recent project.
-
Switch between projects
- Project > switch project > select another project.
7. Bonus
-
Code snippet
- You can create your own snippet in sublime (tools > developer > new snippet).
- Add / before
$.
- Save snippet with
filename.sublime.snippet
. - Add snippets in other files(tools > snippet >search snippet which you create).
8. Pros & cons
-
Pros
- Better find replace feature than others.
- Accurate syntax suggestions.
- Color coding:Every element in your code is color coded.this makes it very easy to debug your code.
- Can easily work with multiple projects without confusion.
- Easy to use.
- Ftp connection within multiple accounts.
- Automatic syntax checking & support for various languages.
-
Cons
- Less & complicated plugins.
Conclusion
Sublime is a flexible and fast code editor.