I am new to Sublime Text as well as web developing. I was looking for something that can save the file when any changes are made to it. I came across to
this. It seems promising. But the problem is I don't know how to install this and use this. I also found this. But it didn't helped. So can someone tell me how to
Create this plugin
Install this plugin
Use this plugin
Step by step help would be really nice if possible.
Or If someone can point me to another editor with this functionality I am looking for.
If you're sure you really want to do this, here's how:
Select File -> New File, then View -> Syntax -> Python.
Paste the following:
import sublime, sublime_plugin
class SaveOnModifiedListener(sublime_plugin.EventListener):
def on_modified(self, view):
view.run_command("save")
Select File -> Save As... and save as Packages/User/save_on_modified.py. The Packages directory is either in %APPDATA%/Roaming/Sublime Text 2 on Windows, ~/Library/Application Support/Sublime Text 2 on OSX, or ~/.config/sublime-text-2 on Linux. You can find this directory by selecting Preferences -> Browse Packages.... On OSX the Preferences menu is a sub-menu of Sublime Text 2, on other OSes it's its own menu next to all the others. When you select Save As... you may already be in the User directory (I was on my machine).
Restart Sublime, just for fun. If you're on OSX, make sure you quit by using ⌘Q, not just closing the window by clicking on the red button.
You now should be good to go. This will now save every file, of any type, after every single modification. Again, make sure you really want to do this.
If at some point you decide you don't want to do this anymore, just delete save_on_modified.py or move it to a directory outside of the Packages hierarchy.
Good luck!
Related
I am new to programming and have been using the IDE BlueJ. I wanted to change to dark mode using the code given in this GitHub link:
https://github.com/t-ye/bluej-dark-theme
The instructions there say to "Replace path/to/BlueJ/lib/stylesheets with the stylesheets in this project". I'm not really sure how to do that. I've tried searching for files within my Mac Finder, but haven't found anything. I'm assuming this is a pretty easy thing to do because the instructions on the Github don't say much, but I'm just not sure how to proceed. Sorry if it's a dumb question!
Thanks :)
First off locate the blueJ application in finder, and then right click(or control+click), and click "Show Package Contents", then navigate to Contents/Resources/Java/stylesheets, then look for a css file named "java-colors.css". You can then either replace the file as a whole with a predefined darkmode css file or manually edit the colours to your liking.
I realy dont know how to ask this one, so I will try to describe it.
I am pretty sure that there is a shortcut in NetBeans for files.
And when I want to get path to web/img/sample/fileWithStrangeName I dont want to type it and make some mistake.
What is shortcut in netbeans for that kind of navigation?
As you can see from the http://wiki.netbeans.org/Keyboard_Shortcuts there is no direct way to do this using a keyboard shortcut for any version until now.
What i do is right clicking on a file and then select properties. And then copy the value of the All Files property.
Another way is to use the plugin Explore from here, that opens the file in its location. And then copy the path from that window.
I've got a small homework project, and for whatever reason Eclipse has decided to stop highlighting syntax or allowing intellisense or goto definitions or anything in this Main.java file. I've tried rebooting it, and the computer, but had no luck.
The thing that really has me confused is that it's still compiling and running the code correctly (eg, changes I make in Main.java are compiled and run - it's not running old Main.class files), so it's still in the build path ... right?
Any ideas?
Right click on the file in the Package Explorer and choose the Open With menu. You will probably find that Text Editor is selected, choose Java Editor to open the file with the correct editor.
The Open With menu selection is remembered so you should get the Java Editor in future, but equally if you choose the plain text editor that is also remembered.
I suggest finding a way to reset any setting you might have set by accident. Not saying that you did it. But just to make sure, just try it out. If you customized the preferences already, you could make some kind of note of the settings, then change it. If that doesn't work, let me know. Good Luck!
Copy the text somewhere, delete the file, and then add a new class (of the same name) and paste the text back.
This seems so simple but I can't find a good way to do it:
Often I want to take an existing (Java) file and base a new one on it - basically just copy the file, rename the copy, and edit it. I can't find any good way to do this. The best I can do is to right-click on the file in the Package Explorer, select copy, and then paste it. If I do it in the same directory I'm prompted to change its name, which is cool.
The problems with this are: 1) It doesn't seem very "Eclipse-y", and 2) Usually I don't have the Package Explorer expanded to where the source file is, so it's very tedious to go through all the projects/packages and find it.
There must be a better way to do this, no? I expected something in the refactor menu but all there is is "move".
Alternative is there a simple way to show where a file I'm currently editing is in the Package Explorer? That wouldn't be ideal but would be good enough for me.
On the top right portion of the package explorer, there is a "link with editor" button that will automatically highlight which file you have open in the editor.
Select 'Show In - Package Explorer' in the context menu of your editor.
Is there a shortcut in Eclipse for "open project"? Ideally, I'd like something like the "Open Resource" dialog.
I want this because I have a "testing" project, which I use whenever I want to try something out… But it's annoying to scroll through the massive Navigator trying to find it and click it when it gets closed.
Not by default. The action is defined here, with no keyboard shortcut.
http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_(3.0).pdf
You could add a Working Set that contains only your test project, and use 'Select Working Set...' functionality from the Navigator tab's view menu:
While this won't open the project for you, it WILL make it the only thing you see in navigator or package explorer.
Once you've added it, it will be in a list and you won't need to open the 'Select Working Set...' dialog, just select 'my test project' from the popup menu. It's triggered by that small triangle in the upper right of Navigator, I'm not sure if there is a shortcut.
To switch back to your normal work, simply 'Deselect Working Set' and you will then see everything again.
I also find the 'Collapse All' button/shortcut to be handy when finding things in the Package Explorer or Navigator tabs.
I'll offer a solution to a problem I've had which, if I've interpreted the question correctly, is very similar to yours.
I find that when I have a lot of projects with loads of expanded directories/packages inside Project Explorer, trying to find a particular project is irritating because I have to scroll through all this. I could collapse all projects down but then I also lose my current position in every project.
I'd just like to be able to search for a particular project by name and open it, in the Project Explorer tree. Opening a file inside the project using Open Resource isn't a good enough workaround, as having to think of the name of a file inside that project completely out of context is often equally annoying!
A solution that works great (at least in Eclipse Juno, Mac OSX) is, with the Project Explorer focused, to hold Shift and start typing the project name. This dynamically selects the best matching project in the Explorer as you type. Then with your hands still on the keyboard you can use the arrow keys to open up and browse the project.
It ain't pretty but it gets the job done, and saves some valuable seconds :)
You could also:
switch workspace (in a workspace with only this test project in it) (no shortcut: you can define one)
install mylyn and select a "test" task (which would immediately empty your Navigator view, leaving only the relevant classes/methods).
If the test project is already opened and you know the name of the class in it, you could go to this class with Navigate -> Open Type (There is a shorcut also, on mac osx is Shift + Command + T)
I find it easier to move with this method, but I didn't know it until someone else showed me, maybe it helps.
You can set a shortcut at Preferences->General->Keys, search for Open Project. However, for me it does not work from the editor itself. I have to click the package explorer, for example. Also, if you have a lot of projects, there will be a huge list of them as well, as expected.