Sublime Text 3 Sidebar Context Menu - sublimetext2

I wanted to know if there is a mac key binding that would work to show context menu while on the sidebar. I don't want to have to right click all the time to get the context menu and would prefer to have the key binding.

Add a key mapping. Sublime Text > Preferences > Key Bindings-User. For example you could use Ctrl+h (not assigned), syntax is below.
[
{ "keys": ["ctrl+h"], "command": "context_menu" }
]

Add a keybinding by:
Ctrl + Shift + P (or Cmd+Shift+P on OSX), then type: Preferences: Key Bindings,
Then assign Ctrl + ' (as an example, you can use any key binding) using the following syntax:
[
{ "keys": ["ctrl+'"], "command": "context_menu" }
]

This is more of a MAC related question, than sublime text related. As I don't own a MAC myself, I can only give you some advice:
Question is, what are you trying to achieve with right clicking? There are loads of useful keyboard shortcuts, which basically do the same thing and either exist by default, or can be easily set in the key bindings file manually (if you don't know how, have a look here).
For quick file switching and navigation, I highly recommend you getting used to "Goto Anything" (Command+P). Getting yourself used to this is the hardest part, but once you got used to, you don't want to turn back.
For file and folder creation there are useful plugins which work on command line basis and by far more efficient than clicking, scrolling, searching... just saying.
I also highly recommend these excellent sublime text tutorials by jeffrey way.

Related

How to not close the editor window when closing the last tab in VS Code

If there's only one tab on an editor in VS Code, the default behavior is to close the editor right then and there.
Personally, and I think many others agree with me, this behavior is very annoying since the programmer would rather preserve the layout he or she created for the project's workspace.
How do I change this behavior?
I've found discussions on this topic, but all of the solutions do not seem to be the ideal one of simply leaving the editor open but empty. Most of them simply delete the related shortcuts, which seems to me like cutting your arm off just because you broke it.
Anyway, here are some useful links:
Superuser StackExchange: How to prevent VScode from closing editor when pressing ctrl+w with no tabs open?
Issue #54492: Remove CtrlCmd+W keybinding to close window when no editors are opened
The behavior of the shortcut ctrl+w is as-designed closing the application
Actually, VSCode 1.57 (May 2021) will change that:
Removed Cmd+W / Ctrl+W as keybinding to close window when no editor is opened
We have gotten feedback that users are frustrated when the window suddenly closes after having closed the last editor via rapid Cmd+W / Ctrl+W usages.
A quick poll in the team also revealed that many had the keybinding for closing a window unassigned, so we went ahead and removed Cmd+W / Ctrl+W as keybinding to close window when no editor is opened.
You can easily bring the keybinding back by configuring it as follows:
{
"key": "cmd+w", // use "ctrl+w" on windows
"command": "workbench.action.closeWindow",
"when": "!editorIsOpen && !multipleEditorGroups"
}
Note: on all platforms there is a dedicated assigned keybinding to close the window:
macOS: Cmd+Shift+W
Linux: Alt+F4
Windows: Alt+F4
If what you are looking for is to preserve empty groups as well as empty editor windows, there is an option in the preferences that gets you almost all of the way:
"workbench.editor.closeEmptyGroups": false
This has the effect that an editor group will stay open even if the last tab within it is closed.
but all of the solutions do not seem to be the ideal one of simply leaving the editor open but empty
Reddit has an answer providing you the ideal solution of leaving the editor open, but empty: close all tabs but leave editors open.
In brief, they suggest to use in rapid succession the "close all editors" and the "three column editor layout".
They suggest to create a macro like:
"macros": {
"closeAllTabs": [
"workbench.action.closeAllEditors",
"workbench.action.editorLayoutThreeColumns"
]
}
then bind it to a key combination. macrosRe is advised.
The behavior of the shortcut ctrl+w is as-designed closing the application, see #49023. It is advisable to remove the shortcut and cut the arm, since it is design to work like that. However, for version 1.43.1 a new comment was posted this year on a thread you linked. You might want to have a look at it as well.

Search through methods in a class PhpStorm

I used to work in Eclipse and had this very neat hotkey (Ctrl + O) which is used to search through the methods within a class.
I mean, if you are in the editor viewing a source of a class, and if you hit Ctrl + O, a pop-up comes up with all the methods listed. The list will get filtered if you start typing in. If I type in get, I can see a list of getters..
This is very helpful. I moved to PHP and PhpStorm and I miss this feature here, or I do not know if PhpStorm has this.
Do you guys have any idea of such a key combo in PhpStorm?
I have never used Eclipse .. so not 100% sure how that popup looks and works .. but here is the PhpStorm functionality:
Navigate | File Structure (Ctrl + F12 using Default keymap)
Alternatively just use Speed Search (just start typing) in actual Structure panel.

Hotkey to jump past closing brackets in JetBrains PhpStorm

Right now I'm just using PhpStorm to work with some HTML, and it's great in that it auto indents and automatically closes out HTML tags.
The only problem is this feature doesn't really save me any time because I then have to use my mouse or arrow keys to navigate past the closing tag when I reach it. For example I type <p> and it closes it out <p></p> with my cursor in between, but when I'm done I either have to manually navigate past the closing bracket or use Shift+Enter to jump down to the next line (which isn't always what I want to do).
Is there a command that will just jump me to the end of the next closing bracket, or is there a way of setting this up? I've googled it but haven't been able to find anything.
I've googled it but haven't been able to find anything.
Well... Help | Default Keymap Reference has the most needed shortcuts and actions listed and the one you need is there.
In any case:
Ctrl + ] -- Navigate to code block end -- will jump to the closest closing tag (in HTML) or brace/closing keyword (CSS, PHP).
Ctrl + [ will do the opposite -- jump to the opening tag.
There are few other actions that can help here but may not have any shortcuts assigned by default -- check them in Settings (Preferences on Mac) | Appearance & Behaviour | Keymap (it has search by action name and even by already assigned shortcuts).
Another alternative (or better say -- advanced navigation) would be using AceJump pluign (you have to see it in action -- you either like or hate it).. or even Vim mode navigation (via IdeaVim plugin).
The simplest way to go about this is to press Command + -> (command+right arrow key) when your cursor is inside the brackets, and this will bring you behind the last bracket.
At least, I believe this is what you're asking.
hi, use mac os for: cmd + option + ]

How to configure Sublime Text 2/3 to use direct Ctrl+Tab order and to create new tabs after the last one?

When I press Ctrl+Tab, Ctrl+Shift+Tab or Ctrl+W the tab I get switched to is not the one just near the one I was on (as I would like to) but to some else. When I press Ctl+N the new tab is created right near the tab I am at while I always want it to be created at the end of the tabs list. How to configure it to achieve the behaviour I desire?
To achieve the Ctrl+Tab and Ctrl+Shift+Tab behavior you can add the following lines to your sublime-keymap:
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
To open sublime-keymap:
click "Preferences"
click "Key Bindings"
You will see two settings file, select a file that named "User"
This is a visual example on how it should look.
With the default key bindings, ControlPage Up and ControlPage Down will allow you to move right and left among your open tabs, respectively, in their visual order. (The keybinding solution replicates this functionality using your preferred keys.)
Because the package installer is now included with Sublime Text, it's also straightforward to add the MoveTab extension, which adds the shortcuts ShiftControlPage Up and ShiftControlPage Down to move the current tab within that visual order.
To access the package installer in Sublime Text 3 (in Windows, anyway), type ShiftControlp, then Package Control: Install Package.
You can use a plugin to get the new file behavior you want.
import sublime_plugin
class MyNewFile(sublime_plugin.WindowCommand):
def run(self):
window = self.window
view = window.new_file()
active_group = window.active_group()
views_in_group = window.views_in_group(active_group)
window.set_view_index(view, active_group, len(views_in_group) - 1)
Save the above in Packages/User as <somename>.py. Then use the command my_new_file in your key binding for ctrl+n I wouldn't be surprised if there was aplugin to do this already, but it's pretty simple, so easier to write it yourself, than to search package control :) You can likely lose a plugin to do what you want for ctrl+w also, but you didn't describe the behavior you wanted.

Sublime Text 2 auto completion popup does not work properly

I got problem with jQuery Snippet that i installed throughout package control. After installation I do not have popup with jQuery code hints and intalisance. Look at this video:
http://code.tutsplus.com/courses/perfect-workflow-in-sublime-text-2/lessons/adding-snippets-through-package-control
On 0:50 after typing . he got popup with code hints - I don't have this one. I have to type . on and then press Tab to display popup with snippet...
And yes, I'm in JavaScript file and I got default settings.
And after . he also got all jQuery functions like add or addClass. I do not have this one even if I press Ctrl+Space.
If you hit CTRL-SPACE you'll get the dropdown of available completions for what you've just typed.
http://www.sublimetext.com/docs/2/tab_completion.html
If you want the autocomplete dropdown to appear as you type then add this line to your User Preferences.sublime-settings file:
{
"auto_complete_selector": "source, text"
}
That should do what you're looking for :-)
Consider changing User Settings to the following:
{
// By default, auto complete will commit the current completion on enter.
// This setting can be used to make it complete on tab instead.
// Completing on tab is generally a superior option, as it removes
// ambiguity between committing the completion and inserting a newline.
"auto_complete_commit_on_tab": true,
// Controls if auto complete is shown when snippet fields are active.
// Only relevant if auto_complete_commit_on_tab is true.
"auto_complete_with_fields": true,
// As Richard Jordan suggested, this item
// controls what scopes auto complete will be triggered in
"auto_complete_selector": "source, text"
}
Open your User Settings by pressing Cmd+, on Mac or Ctrl+, on Windows
And if you want to fully grasp Sublime Text 2, I do recommend this course: Perfect Workflow in Sublime Text. It used to be free by the time I first posted this answer. I still recommend it anyways.
Which OS are you using? I'm guessing Windows.
The problem here seems to be that the jQuery snippets in the available plugins have <tabTrigger> attributes that start either with a $ or a ., which causes trouble.
Try the following: Find the jQuery package that contains those snippets (Under Preferences -> Browse Packages) and open the .sublime-snippet file of a snippet that doesn't work properly. The one you named in your post would be defined in the file event-on.sublime-snippet.
Find the line
<tabTrigger>.on</tabTrigger>
and remove the . as follows
<tabTrigger>on</tabTrigger>
Save and return to your .js file. Now see if the snippet shows up when you type o. This works for me.
I guess this is a bug in Sublime Text 2 for Windows (maybe Linux, too?), since it obviously works fine on OS X as we see in the video course you've linked.
There was an issue created on GitHub on this specific package and I now commented this info. I guess the only way to get this working is to have snippets that do not start with special characters.
I also filed a bug for Sublime Text on Userecho.
The creator of the video is using SublimeCodeIntel. What you see at 00:50 isn't Sublime Text 2's autocompletion popup, it's SublimeCodeIntel's import autocompletion popup:
Imports autocomplete - Shows autocomplete with the available modules/symbols in real time.
See the Github page for more information.