Sublime text plugins operate irrespective of the file type - plugins

I am new to Sublime text. I have been installing a lot of plugins lately.
One thing that I realized is that all the plugins if assigned a keyboard shortcut would perform their operations irrespective of the type of file type.
For example: if I have a plugin such as HTML tidy and if i have a keyboard shortcut say CTRL+K. Now if I open a .js file and press CTRL+K the HTML Tidy plugin somehow ends up executing.
Is this the expected behavior or have I configured something incorrectly?

That's the behavior defined by the implementation of the plugin and the associated key binding. I would recommend creating an issue or making a pull request for that plugin where the file type is checked. They can also add a context to their keybindings to only run under a specific scope. You can create user keybindings with a context to run the proper command. But understand that if it does not match a context for your keybinding, it will fall back to whatever the plugin is defined as. Let me know if I can clarify anything.

Related

Eclipse keybindings. Setting up a shortcut for executing a specific run configuration

I'm trying to setup a key binding in Eclipse to directly execute a background Java file. My file is called CodeChecker.java and it's sufficient for my purposes to run the main method without any arguments. I need to run it repeatedly and so I'm trying to setup a shortcut key to run it directly without having to bring up the Run... menu or having to bring up the file itself.
As far as I'm aware Eclipse is not able to offer this functionality directly. I've tried using a plugin called Practically Macro according to this answer Assigning a keyboard shortcut for a specific Eclipse build configuration. But this answer is horribly out of date and doesn't work any longer.
So I'm wondering if Practically Macro can still be used to achieve this? Any other solution, plugin, script or otherwise would be equally welcome.

Groovy-Grails Tool Suite (GGTS) content assist not recognizing basic groovy

I have installed GGTS, on ubuntu and am trying to edit .Groovy files with the built in editor.
The autocomplete is extremely annoying because while it will recognize my domain objects i.e. my User class etc.. It doesn't recognize basic groovy, for instance I start typing "def" to define a variable then hit space and it will autocomplete to "Default", similarly if I try to type in "return" it autocompletes to "RETURN" while I am typing as soon as I hit space, which is very annoying.
Like i said it will recognize classes, so if I type def u = new User(), the User part will complete ok, but the problem is that the variable u I defined earlier isn't recgonized later in the code.
I hope you guys get my meaning... No idea how to fix it, short of not using the groovy editor and treating it as plain text. I even tried disabling content assist, but that didn't seem to work for some reason
I was having this problem in GGTS 3.4.0.RELEASE today, and getting very angry with the situation.
Somehow my workspace had the "Auto activation triggers for Java" set to "_.abcd....z" (all the lowercase letters)
Window -> Preferences
Java -> Editor -> Content Assist
"Auto activation triggers for Java" set to just "."
This seems to have helped dramatically.
I'm still not sure what caused my workspace to have this setting.
Make sure that you're in the Grails perspective; that can impact some of the Groovy/Grails features and how Eclipse (even GGTS) leverages them. You'll find the perspective button in the upper right. If you're in Java or Debug, odd things like this may occur.
Also, how are you creating and opening your Groovy files? Do you use the context menus or the Grails command prompt tool to issue orders like "create-controller"? If you're creating the files in some other way, try using those methods to generate them, and see if you get the same results.

eclipse's plugin or vim's plugin similar like ctrl+p and type # to find function/method list in sublime

eclipse is good at autocompletion when static typing , when is dynamic typing ,eclipse failed to autocompletion ; in sublime ctrl+p ,type # and type 'method name'to find function/method list , It is a wonderful way to find the right method while coding dynamic typing language ;
the key point is :
the operation in sublime text 2 is very convenient ,all key type is in one input box ; never need to chage active file tab; we can focus on the active code file tab ;
is there any plugin in eclipse or vim which can search method of any file conveniently ?
In ST2, this feature is used to quickly jump to a method anywhere in your project.
In Eclipse, Control+Shift+R can be used to jump quickly to a "resource" (file) and Control+Shift+T is for jumping to a type (not method). Control+o opens a very useful and quick outline of the current file. It doesn't work project-wide.
I'm not aware of something that works exactly like ST2's feature. Did you search the marketplace?
In Vim, FuzzyFinder, Command-T and CtrlP all allow you to navigate through your project using fuzzy matching. They can be setup to use your tags file. AFAIK, there's no plugin that provides exactly what ST2 provides.
From your question I'm not sure you use it as intended: it sounds like you use it to show a list of methods in some file in your project in order to use the right method in your code. This sounds a lot like you'd benefit from autocompletion to me.
Being an IDE, Eclipse shines on that front: its "code assist" window will show you where the suggestion is defined as well as its type.
Vim's "omnicompletion" is quite limited compared to an IDE but, depending on your language and using some third party scripts, it can be made quite powerful.

Chrome console + text editor

I find myself typing JavaScript in the console a lot. For example, I quickly want to see the result if I change the property of a certain object. However every time that I refresh the page I have to redefine my variables, etc. I do this by using the up-key, so I do not have to retype, but this costs a lot of time. What is a better way?
The ultimate coolness would be an environment like Sublime Text in which you can write multi line code and from there execute it directly in the browser... And then still have the autocomplete list of all the methods of an object (like in the console). Obviously this is not available, but I am very interesting in the workflow of other when typing JavaScript code in the console.
In Chrome 24's Sources panel, use the Snippets tab. Right-click in the left (blank) tree and choose New from the context menu.

Workspace Editor Macros in Eclipse

Is there a way to record permanent workspace macros in Eclipse and assign them a shortcut key or template?
I'd like to automate some of the actions I routinely do. Workspace editor templates are not a solution since I need to include some conditional logic as well. For example check what is a symbol to the right/left of the cursor.
See my answer at How can I launch more than one debug session in Eclipse from a single click? . The same plugin can work for you as well.