I'm using rbenv, and when trying to use the build function inside Sublime Text 2 (Cmd+B) it tries to use the ruby and gems under /Library/Ruby/Gems/
How can I tell ST2 to use my rbenv rubies?
PS: I installed rbenv using boxen.
I figured out this. In order to configure rbenv in ST2 you need to go to Browse Packages, then select the Ruby package, and edit the file Ruby.sublime-build changing the cmd property, like this:
{
"cmd": ["/path/to/your/ruby/shim", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
In my case, since I'm using boxen, the path was /opt/boxen/rbenv/shims/ruby, but in a standard rbenv installation it should be something like /home/username/.rbenv/shims/ruby in Linux or /Users/username/.rbenv/shims/ruby in OS X.
Related
I'm brand new to Ruby and Rails, so sorry if this is a totally ridiculous question. The tutorial book that I'm reading says that I should be able to launch a Gemfile in Sublime Text directly from the command prompt using the subl Gemfile command. When I try this, I get an error that says "subl is not recognized as an internal or external command, operable program, or batch file".
I am in the right directory where the Gemfile is located.
Ruby is definitely installed and I am using the command prompt with Ruby and Rails.
i have the sublime text 2 and i added the path as i found,but no solution.i even tried :sublime_text Gemfile
i have tried so many different solutions but no result.
i'm using windows
Thank you in advance
the reason it isn't working isn't a rails question, it is because you haven't set up sublime to work using the command "subl" in your terminal. Try these commands. If you wish to understand the error better, just type in any gibberish into the terminal. It will tell you a similar thing.
sudomkdir /usr/local
sudomkdir /usr/local/bin
sudo ln-s/Applications/Sublime\Text\2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
EDIT
Sublime Text from Command Line (Win7)
https://teamtreehouse.com/forum/sublime-text-command-line-shortcut-windows
https://teamtreehouse.com/forum/ruby-on-rails-subl-command-not-found
Otherwise, you can refer to this
subl is Mac only.
For Windows, you need to add C:\Program Files (x86)\Sublime Text 2 to your Environment path,
This will work on Windows 7:
Right click My Computer, Properties, then Advanced System Settings, then Environment Variables.. Go down to System Variables, and edit PATH, you'll need to add the Path to Sublime.
Then you should be able to run sublime_text my-file from the command line. (Since the .exe is called sublime_text.exe
The Sublime text 2.0.1 (Mac OSX) build command ignores the shebang line a the top of my python file.
The shebang line has the full path to my python 3.2 installation :
#!/usr/local/bin/python3
However the python version being used is always 2.7.2. I'm maintaining code for both 2.7 and 3.2 and so must rely on the shebang line to be used.
Is there a way to configure the Sublime text 2 build system to look at the shebang?
Sublime does not use the shebang to determine the execution, it uses your build rule. You could customize the Python build rule to add variants for python2 and python3.
Official instructions for adding build variants.
Simplified example of build variants from another SO question.
Note that with build variants, the default is run by Command+B (Mac) or Control+B (Windows and Linux). The second variant can be run Command+Shift+B (Mac) or Control+Shift+B (Windows and Linux).
Have a look at Sublime Text Shebang plugin.
It adds a few commands that allow to run scripts, based on the shebang line, but the output will be placed on a new buffer, not in the console.
I need help getting the SublimeLinter to work.
I have installed the SublimeLinter using the package installer. However I cant see the lint working in my js files. Also when I do command + shift + P (linux) I only see the following command for linter 'Sublime Linter : Extract Annotations'.
I don't see the other commands for running the linter.
Any Ideas what is wrong?
Thanks,
Murtaza
You have to install nodejs from the repos.
If nodejs isn't installed in /usr/local/bin/node you have to set a symbolic link to this place:
touch /usr/local/bin/node
ln -s /usr/bin/nodejs /usr/local/bin/node
The above worked for me on debian/crunchbang
Alternatively you can change the sublime user settings for linter(ps haven't tested this option)
"sublimelinter_executable_map":
{
"javascript": "/usr/bin/nodejs"
}
Some tips:
Be sure your files are using the Javascript syntax.
The linter runs automatically (check the package settings).
Open the console to see any errors.
Check the documentation to configure Javascript linters
I created some python hooks for Mercurial that use some external libraries (namely jira-python). In Linux, I install the packages using pip. In Windows, however, Mercurial comes with a bundled version of Python. My hooks fail when I run them because the external packages are not installed.
I want to make Mercurial / TortoiseHG use my Python installation so I can control its environment. How can I do that?
You can install Mercurial package for Python:
Mercurial 2.4 Python 2.7 package - x86 Windows
Mercurial 2.4 Python 2.7 package - x64 Windows
For TortoiseHG-specific details I can suggest to inspect %TortoiseHg%\library.zip - it contains (some? all?) needed for TortoiseHG|Mercurial Python's modules, which list you can (try) to extend: "in Where is the Python path for TortoiseHG?" topic Steve Borho wrote:
TortoiseHg's entire python environment is contained within the library.zip that comes packaged
with it.
What I suspect you can do is add a line or two to the top of your reviewboard extension file to add your installed python path to sys.path before trying to import simplejson
Hint for adding python path to sys.path is applicable for you too
Recommendation from Convert Extension page
you'll need to use a Mercurial installed on top of a stand-alone Python, and you may also need to do something like
set HG=python c:\Python25\Scripts\hg
to override the default Win32 binaries if you have those installed also
I have Mercurial installed through pip, and I also have TortoiseHg. My system path selects the Python version first.
I renamed C:\Program Files\TortoiseHg\hg.exe to something else, and then ran TortoiseHg. Everything still worked, but I haven't got a good way of verifying it does what you want. You can give it a shot.
I just started using Sublime Text 2 and was wondering, to sort of make it a full featured python IDE, if there was a way to change the integrated python interpreter to target the system python install rather than the one that came with Sublime. The reason is because I would like to use my python libraries that I have on my computer with the python interpreter.
I am aware of running python code in sublime using my version of python as explicitly shown here: How do I run Python code from Sublime Text 2?
However, this does not change the version of the python interpreter that you are running.
Any ideas?
Tools > Build System > New Build System. Insert the file and with your python version:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
According to the documentation referenced by the Sublime Text website itself, the embedded Python intrepreter is not intended for general development. This restricted usage recommendation even applies to ST2 for OS X, which is the only version that does use the system's Python version. So it's probably better to use the Build System workflow, or use a ST plug-in. Or switch to a purpose-built IDE.