Can I have Sublime Text automatically run another command after Sublime SFTP plugin performs an upload? Maybe it could trigger a terminal command or system service (that I set up using OSX's Automator)?
This is what I am specifically trying to do... I have Sublime SFTP configured to automatically upload on save. I also have a system service which reloads the active tab in Safari. I would love if pressing CMD-S to save, not only uploads, but reloads active browser tab after upload is complete. Is there is a way I can trigger a command after the SFTP plugin is finished uploading?
Thank you in advance!
There are a couple of options here:
There are plugins that support live-preview or refresh on save capabilities. For Example
https://sublime.wbond.net/search/Refresh or LiveReload
The Chain of Command plugin allows you to execute multiple commands subsequently
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.
Im new to watir and running scripts from it. Just want to ask if how can I get or extract the error messages Scite displays on the left panel and import it to a textfile? or is it really possible to do? Thanks.
I am not sure how would you do it from Scite, but if you execute Watir script from command line, you can redirect output to file:
$ ruby watir_script.rb > results.txt
If you use test framework like RSpec, there are a lot of options for storing test results in files.
From Scite, you click in the output frame, Ctrl-A (to select all), Ctrl-C (to copy), then paste into what every application you like such as notepad.
I agree with Zeljko, you should use a good framework like rspec or testunit. Goodluck.
Are there any tools that can be used on a Mac to support manually executed tests? I have a number of tests that I'm executing manually and which I'm currently documenting using merely a plain text file. "Tools" can be interpreted rather loosely here, anything that's a step up from the plain text file would be useful: a template for some suitable application, supporting AppleScript scripts, a web-based system, a full-blown application ...
Some things that would be great to have better support for (see also the example below):
Checking off each step while you're manually executing the test.
Showing the next step(s) in a small window that is always kept in front of all other windows.
Automatically updating the 'last tested' and 'using svn revision' info.
Keeping a record of all previous testing rounds (not just the last one).
...
Any suggestions for any such "tools" that can be used on a Mac?
An example (faked) entry from the plain text file to give you a better idea of what I'm looking for:
- Check that exported web pages render properly in Safari.
Last tested: 2010-03-24
Using SVN revision: 1000
Steps:
- Open a new document.
- Add some items to the document.
- Export the document to a web page "Test.html" in a new folder "Export Test"
on the Desktop.
- Open the web page in Safari, script:
tell application "Finder"
open file "Test.html" of folder "Export Test" of desktop
end tell
Expected results:
- The web page should appear properly with all items shown.
Clean up steps:
- Remove the folder "Export Test" from the Desktop.
( Note: for those unaware, the snippet of AppleScript in the above can be executed from most text editing applications through the Services menu by selecting the snippet and using: the application menu > Services > Script Editor > Run as AppleScript. This is quite useful to automate some steps for tests that are difficult to automate as a whole. )
Have a look at TestLink - it's a PHP app that you should be able get get working on a Mac easily enough, and will do most of the things you're looking for.
You might want to look into our test management tool TestRail, as it does most of what you mentioned. TestRail is a PHP application (web-based) and can be installed on almost any system.
or "How do I answer questions on SO in Firefox using gVim inside the textboxes?"
It's All Text!
From the extension page:
At the bottom right corner of any edit
box, a little edit button will appear.
Click it. If this is the first time
you've used "It's All Text!" then you
will be asked to set your preferences,
most importantly the editor.
The web page will pop up in your
selected editor. When you save it,
it'll refresh in the web page. Wait
for the magic yellow glow that means
that the radiation has taken effect!
Vimperator makes Firefox act very much like VIM:
Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. It has similar key bindings, and you could call it a modal web browser, as key bindings differ according to which mode you are in.
Once you have the cursor in a text box, hit Ctrl-I to open in your editor, which defaults to gvim.
The current answers don't work anymore now that Mozilla removed XUL in favour of WebExtensions. With recent firefox versions, there are the following options (sorted in descending order by the current popularity on addons.mozilla.org).
GhostText provides instant synchronization between editor and textbox via editor-specific plugins. The project is on github and the vim extension is written in Tcl.
withExEditor is cross-platform but requires a native application written in node.js. In addition to editing text fields it also allows viewing the source of the page, MathML, SVG and the current selection. The project on github and the native node.js application
Textern requires a (currently) Linux-only native application written in Python. Synchronizes the content of the text field while you type in the editor. The extension and the native app can be found on github
Tridactyl is probably what you're looking for nowadays.
It's the spiritual successor to the likes of Pentadactyl and Vimperator, which are not available for the current version of Firefox.
If you want something more like It's All Text, where the editing area appears right on top of the browser text area rather than launching an editor window, and you're willing to use Neovim, check out firenvim.
It's All Text! will let you use whatever editor you want. To use vim with it, you'll need a small shell script to open it in a terminal:
#!/bin/sh
exec xterm -e /usr/bin/vim "$#"
If you have GVim, you won't need the shell, script, obviously.
ViewSourceWith is another addon worth lookng at. It supports more than just edit boxes and text. For example, you can configure it to open images in the GIMP.
Another feature that I find useful is that it can pop-up a dialog box that shows all the js and css scripts used on the page. You can then choose to view/edit file in your preferred editor.
For answering questions on SO, you may also want to get the Vim Markdown Syntax file
The "It's all Text" extension, perhaps?
http://addons.mozilla.org/en-US/firefox/addon/4125
If you use vimperator and have the markdown syntax file installed, a useful line for your .vimperatorrc is:
au LocationChange .* :set editor="gvim -f"
au LocationChange stackoverflow\.com :set editor="gvim -f -c 'set ft=mkd'"
This will tell vim to do syntax highlighting for markdown when you are on stackoverflow.com, but not when you are any other site. There are similar hacks for wikipedia/mediawiki etc. Enjoy :)
One way to do this is to use the vimperator extension - of course, that does a lot more than what you're looking for.
At the time of writing it is experimental, but the jV extension looks good. To quote from the page:
This extension makes all html textareas into a very stripped-down version of Vi[m]. It's modal, supports infinite undo, has register support, search, visual mode, and various movement and editing commands.
When using Vimperator in Windows (I am using Vista) you may need to double-escape the path to gvim.exe to use it as the external editor. Single escaping did not work for me as Vimperator unescapes it twice. Eg:
:set editor="C:\\\\Program\\ Files\\ (x86)\\\\Vim\\\\vim72\\\\gvim.exe" -f
Then while in a text box you use Ctrl+I and it will open gvim for editing. When you save and exit it will update the text box.
There is an experimental way to directly embed the real vim in firefox using embedded editor - though it requires mozplugger and will only work on Linux.
Try out the wasavi extension. You might want to check out the all versions page to make sure you try out the latest version. (Copy of this answer.)
You can also use the ViewSourceWith addon to achieve the same. Just right-click on any text input and you can edit it using Vim.
As said by others,
as a Vi/(g)Vim user you'll probably want to look at the Vimperator addon, which also provides the what you ask:
inside a textbox, hit <C-i> to launch the external editor.
(can be defined in _vimperatorrc: set editor=gvim -f )
A hint for Mac users: if you want to use "It's all text" with vim, the easiest way is to use http://code.google.com/p/macvim/ . Point "It's all text" to the mvim script that's provided along with the .app (you can place this script anywhere, I choose /usr/bin/ so that I can load mvim from the command line)
Pterosaur is a Firefox plugin that allows you to use Vim in all input fields. It uses an actual Vim process in the background so it has all the functionality you expect, including reading your .vimrc configuration and your plugins.
With Firefox-57 on Linux, I installed textern https://addons.mozilla.org/en-US/firefox/addon/textern/, and found it to be a suitable replacement for ViewSourceWith for editing text boxes.