It was looking like the Sublime Text team weren’t planning to fix the issue, hence my interest in solving the problem – but according to a recent post on this thread, the issue is solved in the new beta of Sublime Text 3. I’m posting the proxy anyways for people still using Sublime Text 2.
Does anyone know of a shortcut for jumping to a specific line (given a #) in Sublime Text?
Ex: I run code and get an error at line 5765. I want to be able to jump quickly in Sublime Text to line 5765, without scrolling.
Thanks!
Alexsandra GuerraAlexsandra Guerra6 Answers
Windows: Ctrl + G
Mac: Control + G
Linux:Ctrl + G
or
Windows: Ctrl + P + :
Mac: Command + P + :
Linux: Ctrl + P + :
Then type the line number. It will automatically find it for you and if it requires scrolling to get to - it will snap your view to the line number level.
Hope that helps.
Happy coding!
maxtuzzmaxtuzzRather than Control+G
, if you're used to using CMD+P
or CMD+T
, you can just type :
Also useful:
CMD+R
go to function in current fileCMD+Shift+R
find function in any file (CMD+,
'binary_file_patterns' ignore node_modules)CMD+Option+Down
jump to function definition in another file (from cursor word)CMD+D
/CMD+U
jump & accumulate next word occurrence & populate search query / (undo). from cursor becomes an exact match (case and word boundary) vs from selection is a partial match (ignore case and word boundary).D
andU
also work in less bash / zshell pager to scroll down / up half pagesCMD+G
/CMD+Shift+G
jump or 'go' to next / previous search query (CMD+D
amazing with this)CMD+{
/CMD+}
focuses left / right tab (same in terminals, browser, kapeli dash, etc.)CMD+[
/CMD+]
shift line left / right (chrome forward / backward nav, devtools changes panel)CMD+Control+Up
/CMD+Control+Down
shift line up / downCMD+K->(some number)
fold to indentationCMD+K->J
unfold allCMD+Option+[
/CMD+Option+]
fold / unfold current line's childrenCMD+,
is preferences in most all Mac applications
As pointed out by @maxTuzz, I use Ubuntu 16.06 and Sublime regularly,
this Ctrl+P then Pressing : and Starting typing the Line Number you want to Navigate.
Or
Directly we can type Ctrl+G Starting typing the Line Number you want to Navigate.
base is to press Ctrl + P and a then type : and then write the line that you want to go , BUT there is a shortcut for this :
Just hit Ctrl + G , and it does the same steps for you!
Jump To A Specific Line Sublime Text For Mac
a_m_deva_m_devon your keyboard click the:
then type :
on your keyboard follow by the line number, example374
then click the enter
key on your keyboard to jump to the desired line number
Jump To A Specific Line Sublime Text For Mac Download
Not the answer you're looking for? Browse other questions tagged sublimetext2sublimetextsublimetext3 or ask your own question.
I have read the key bindings file of Sublime Text 2
I'm wondering if we can move to the end of line without END
key in keyboard.
In vim, I just ESC
and A
, then the cursor would be in the end of line.
8 Answers
To change the key binding, open Key Bindings - User
preferences and add a new line between the square brackets. For example, to set the key binding to Control-Alt-Command-A
you'd use:
If this line that you're adding is not the last line before the closing square bracket, then you'll need to include a comma at the end of the line. For example:
You should check the Key Bindings - Default
preferences to make sure that the key binding you're setting here doesn't conflict with anything else that you might use.
You shouldn't edit the Key Bindings - Default
preferences directly, because they will be overwritten in Sublime Text 2 upgrades.
Command+RightArrowKey on Mac.Control+RightArrowKey on Windows
YilingYiling1) Hit Super+Shift+P
to open Command Palette (Ctrl+Shift+P
on Windows)
2) Type 'kbu' to open Preferences: Key Bindings - User
3) Copy / paste the following code into it:
(Note: if the file is not empty then obviously you know what to do.)
4) Hit Super+S
(Ctrl+S
) to save and you are all set!
I chose Super+;
shortcut for I often write in PHP and it's convenient to end lines with a semicolon. Other options could be Ctrl+;
or Super+.
or whatever else you find convenient.
If you're a fan of vim you can enable Vintage mode in Sublime Text 2
Preferences: Settings - User
Then remove Vintage from the ignored_packages.
How about binding something that'll make you faster? This is what I use (from Key bindings - user):
This way, to go to end of the line I use alt+;
, and to go to eof I use alt+shift+;
Or use Vim...
You can just replace the key with something other than 'end'. Don't edit the main key bindings file though. Add the change to th user version and it will override the defaults.
ValjasValjasI use [ESC] and [A] in Sublime too :-) - I know it's a long time after you asked the question, but I've started using VIM recently, and configured Sublime to use vintage mode. As I'm fairly new to Sublime too, I'm not 100% sure, but I think you should edit the user preferences file rather than the default preferences file as suggested in the above link, as I gather the default file can get overwritten, and the user preference will override the default anyway. Hope this helps.