Is there a way to autosave on each keystroke in sublime? - sass

I would like sublime to save my file on each key stroke, for live reload purposes.
The neatest action would be to autosave on each keystroke, only if the file has valid syntax.
If compass task was fast enough it would be like working directly in chrome inspector.

You could write a plugin that saves the file using the on_modified listener. Something like the following may work (note untested)
import sublime_plugin
class SaveOnModifiedListener(sublime_plugin.EventListener):
def on_modified(self, view):
view.run_command("save")
If you have a linter, you could validate it, and only save on clean lints. Note that with what I have posted, any edit to any file in sublime will be saved on each keystroke. You may want to add some additional checks for things like file type, if it exist on disk, etc.

I had this very same need some time ago when I was trying to do some very fast feedback prototyping that required the file to be saved before I could analyze its output. However, this is not something I'd need in all my projects.
Luckily I found that there is an elegant plugin that does just what is needed - saves the given file after each and every modification - and does that with a simple addition! You can easily enable and disable the feature when it suits you with a simple key combination. Although it is but a small improvement over the other spot on answer, I hope it'll help someone out there.
The plugin in question is auto-save, and of course, it can be installed through Sublime Package Control.

Related

Is there anyway to collaborate on a Google Document in realtime using VIM?

I want to use the VIM keyboard commands to edit a Google Document. Preferably I'd like to use my .vimrc file and have changes I make reflected in real time (or at least on save). I want to do this for a technical coding interview.
So far I've tried using GoogleCL which only pushes/receives changes on quitting VIM (which is too slow). And I've tried the Vimium Chrome plugin but that seems to be just for navigation not text editing. I however may be overlooking a feature of one of these.
I'm using OSX and Chrome, Safari or Firefox.
You can:
sync your google docs then edit normally
use vim-anywhere plugin
use GoogleCL inside au FileWrite
use some library to quickly create your own thing, for instance google-drive-ruby (see short example on its page).
To collaborate and see changes real time you could for instance use ruby library to upload/dowload changes every now and then. If you always overwrite your original file even as you edit it, you can diff external changes to see what the other users did.

How do I assign an icon to a custom file type?

Is there any way to do so in C or C++ (I know that it can be done in C#, so if you know how to, it'd also help!)?
What I want is a way to, automatically and through my own application, associate a custom file extension with a custom icon. For example, something that would make all current and subsequent .foo files have an image of their own, instead of the bland white paper sheet default. Just like what Java does to .jar files and Dev-C++ to .c and .cpp upon them being installed.
Through my researches I've found a lot of related information about a thing called Shell or something. I wound up myself at this page, and as viable what it says may seem, I have no idea on how to implement it at all, nor grasp what exactly it is about. Sorry if I sound noobish!
OS is Windows.
First you need to know how to modify registry in c++, here is a post that explains that:
Registry and c++
In the link you provided you have the keys that you need to update
HKEY_CLASSES_ROOT/[yourextension]
the call to SHChangeNotify is only needed to tell explorer to refresh once you modified the icon.

Creating quick GUI front ends

I wanted to have a GUI front-end for a script that accepts numerous command-line options, most of them are UNIX paths. So I thought rather than typing them in (even with auto-completion) every time, I'd create a GUI front end which contains text boxes with buttons beside them, which when clicked will invoke the file browser dialogue. Later, I thought I'd extend this to other scripts which would sure require a different set of GUI elements. This made me think if there's any existing app that would let me create a GUI dialog, after parsing some kind of description of the items that I want that window should contain.
I know of programs like Zenity, but I think it's doesn't give me what I want. For example, if I were to use it for the first script, it'll end up flashing sequence of windows in succession rather than getting everything done from a single window.
So, basically I'm looking at some corss-platform program that lets me create a window from a text description, probably XML or the like. Please suggest.
Thanks
Jeenu
Mozilla's XUL is a cross platform application framework - . You could write an app as a Firefox plugin or a standalone XUL application.
mono and monodevelop could work for this. Or even something super simple like shoes.

Files with the same name in a TextMate project

One of the few things that bothers me about TextMate is that it can be difficult to differentiate between files that share the same name in a project, e.g:
alt text http://img530.imageshack.us/img530/6791/bild1r.png
In this case, the file on the right is located in the project relative path model/realtimemodel.py, while the other file contains unit tests for that code. Sure, you can command-click the name in the title bar to see a directory list, but it feels sub-optimal. What I would like is something along the lines of:
alt text http://img240.imageshack.us/img240/1783/bild3.png
This gives a quick at-a-glance idea of what file you're working on. Has anyone seen any plugin or bundle that makes this possible?
Edit: Here is a ticket in Macromates tracker that requests this feature (although I would prefer a project-relative path).
This is a start: http://snipplr.com/view/11490/textmate-command-snippet--show-document-path-in-window-title/
I think vasi's solution is the closest you can get to what you want (+1 for him)
I don't think that the bundle can be automatically ran on open, and also, the title changes back to default when switching between tabs, so even if it could, it would be useless.
I've searched for a defaults key (like the one from Finder, _FXShowPosixPathInTitle editable with
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES)
but there isn't any. Here's the list of available keys for Textmate.
Maybe you can write feature request somewhere as it is very useful and not so hard to impletement.

Is there a simple way to change the text of the 'Open' button on the windows file dialog to 'Select'?

We're using the file picker dialog to allow users to add documents into our application. The word 'Open' doesn't make a lot of sense in this case.
Thanks.
I would browse the code found here, which shows how someone extended the OpenFileDialog. Admittedly, this is overkill for you. But I think there is code within to change the button label.
Not really no.
Given the standardization of this dialog it's extremely likely that your users will have used it many times in the past to "add" files to applications. The chances are they will be quite familiar with the implications of the word, changing it may be more confusing to them.
The standardness of the dialog is why it's called a "Common File Dialog". If you want to change it for your app, you'll have to write your own dialog.
Having said that, there are apps out there that can pull a form out of a DLL, modify it, and stick it back in. However, this is a per-machine hack and downright bad form.

Resources