• Stars
    star
    718
  • Rank 63,070 (Top 2 %)
  • Language
    Python
  • Created over 12 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sublime Text 2 setup used in the Ruby on Rails Tutorial

Rails Tutorial Sublime Text setup

These are the steps needed to set up Sublime Text 2 as in the Ruby on Rails Tutorial. Instructions are for OS X; Linux and Windows users should make substitutions as necessary. (This may require web searches. Please let me know if you find something that you think should be included here.)

Command-line command

On OS X, you can set up subl as a command-line command like this:

$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

This assumes that there is a ~/bin directory on your executable path. If that isn't the case, follow the instructions on this Stack Overflow thread.

On Linux (especially Ubuntu), the command is similar to OS X; the paths differ and you must use sudo, which is required because ordinary users don't have permission to write to /usr/bin:

$ sudo ln -s ~/Applications/Sublime\ Text\ 2/sublime_text /usr/bin/subl

Alternatively, add an alias to sublime_text in your ~/.bashrc file. This method doesn't require sudo. But it assumes you are using bash. There are similar methods available for other shells. Google is your friend.

Use any editor like gedit or vim to open ~/.bashrc.

$ gedit ~/.bashrc

Add alias subl='~/Applications/Sublime\ Text\ 2/sublime_text' at the end of the file. Save and exit.

(You may have to replace the path to sublime_text with the correct one for your system.)

On Linux Mint, take a look at Install Sublime Text 2 in Linux Mint.

On Windows, you can simply double-click the application icon. The setup at the command line depends on which shell you use; see if one of the techinques at the Stack Overflow discussion on Sublime Text from Command Line (Win7) works for you. You might also want to check out the video Easily Open Files from Windows Command Prompt with Sublime Text 2 (I suggest changing st2 to subl to be consistent with the instructions for the other platforms).

Basic configuration

Open up Sublime Text and use the View menu to modify the following settings:

View > Hide Minimap

View > Side Bar > Hide Side Bar

View > Layout > Columns: 2

Copy auxiliary files

$ cd /tmp
$ git clone https://github.com/mhartl/rails_tutorial_sublime_text.git
$ cp -r rails_tutorial_sublime_text/* \
        ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/

Setup on Linux is similar, but with a different target directory for cp:

$ cp -r rails_tutorial_sublime_text/* \
        ~/.config/sublime-text-2/Packages/User/

On Windows, the target directory is as follows:

$ cd /tmp
$ git clone https://github.com/mhartl/rails_tutorial_sublime_text.git
$ cp -r .\rails_tutorial_sublime_text\* \
        '~\AppData\Roaming\Sublime Text 2\Packages\User'

Note: If using Windows Vista, 7, or 8, you should first copy all the folders and files from the remote repo into your local temporary folder located at C:\Users\User\AppData\Local\Temp. Then proceed to move these same files to C:\Users\User\AppData\Roaming\Sublime Text 2\Packages\User.

Install Sass syntax highlighting

Install Package Control and then go to Preferences > Package Control. Select Install Package and then select the Sass package.

Set up the theme

Select Preferences > Color Scheme > User > Railscasts

Install the Rails Tutorial snippets

https://github.com/mhartl/rails_tutorial_snippets

Install Sublime Text Alternative Auto-completion

https://github.com/alexstaubo/sublime_text_alternative_autocompletion

Install SublimeERB

https://github.com/eddorre/SublimeERB

Install RubyTest

Follow https://github.com/maltize/sublime-text-2-ruby-tests, or install RubyTest using Package Control.

Go to Preferences > Package Settings > RubyTest > Settings - User and paste in the following code:

{
  "check_for_rbenv": true,
  "check_for_rvm": true,
  "check_for_bundler": true
}

If you want the "Red" part of "Red-Green-Refactor" to be truly red, edit the file "TestConsole.hidden-tmTheme" in the Library/Application\ Support/Sublime\ Text\ 2/Packages/RubyTest directory:

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/RubyTest
$ subl TestConsole.hidden-tmTheme

In that file, change

<string>#FF1493</string>

to

<string>#FF0000</string>

You may have to restart Sublime Text 2 to activate the change.

If you ever get the error

/bin/sh: rspec: command not found

you can simply quit Sublime Text and then restart it by typing

$ subl

(with no dot).

More Repositories

1

sample_app_3rd_edition

The sample app for the 3rd edition of the Ruby on Rails Tutorial
Ruby
231
star
2

git-utils

Git utility scripts
Ruby
145
star
3

rails_tutorial_4th_edition_gemfiles

Gemfiles for the 4th edition of the Ruby on Rails Tutorial
Ruby
139
star
4

sample_app_rails_3_2

Ruby on Rails Tutorial sample application
Ruby
137
star
5

find_mass_assignment

Find likely mass assignment vulnerabilities
Ruby
115
star
6

action_cable_chat_app

The chat app for Learn Enough Action Cable to Be Dangerous
Ruby
62
star
7

rails_tutorial_snippets

Sublime Text 2 snippets used in the Ruby on Rails Tutorial
61
star
8

rails_tutorial_3rd_edition_gemfiles

The Gemfiles for the three example applications of the Ruby on Rails Tutorial (3rd Ed.)
Ruby
45
star
9

rails_tutorial_translation_2nd_ed

HTML source for the Ruby on Rails Tutorial, 2nd Edition, intended for translation
CSS
44
star
10

rails_tutorial_translation

Translations of the Ruby on Rails Tutorial book
Ruby
37
star
11

sample_app_4_0_upgrade

The upgraded sample app from the Ruby on Rails Tutorial
Ruby
27
star
12

pivotal-github

Ruby
25
star
13

rails_tutorial_translation_4_0_version

HTML source for the Rails 4.0 version of the Ruby on Rails Tutorial
CSS
23
star
14

ruby_tutorial

Files for Learn Enough Ruby to Be Dangerous
Ruby
14
star
15

js_tutorial

Learn Enough JavaScript to Be Dangerous tutorial directory
JavaScript
13
star
16

catch_cookie_exception

Catch and handle the CGI::Session::CookieStore::TamperedWithCookie exception that comes from changing the Rails secret string. See http://blog.insoshi.com/2008/08/15/a-security-issue-with-rails-secret-session-keys/
10
star
17

palindrome_app

A palindrome detector Sinatra App
Ruby
7
star
18

bullish_case_for_bitcoin

Light copyedit for "The Bullish Case for Bitcoin"
4
star
19

vim-files

Files for my (g)vim configuration
Vim Script
4
star
20

hello_app_heroku

Ruby
3
star
21

toy_app

A toy demo app for the Ruby on Rails Tutorial
Ruby
3
star
22

hello_app_original

A "hello, world" app for the Ruby on Rails Tutorial
Ruby
3
star
23

mhartl-palindrome

A sample NPM module for Learn Enough JavaScript to Be Dangerous
JavaScript
3
star
24

mhartl-archive.github.io

A sample website for Learn Enough CSS & Layout to Be Dangerous
CSS
3
star
25

js_tutorial_video

Learn Enough JavaScript to Be Dangerous tutorial directory
JavaScript
3
star
26

ruby-libraries

This is the repo for the talk Ruby Libraries Important for Rails from RailsConf 2013.
Ruby
3
star
27

another_test

3
star
28

mhartl_palindrome

Learn Enough Ruby palindrome detector
Ruby
2
star
29

enumerable

Repo for Enumerable talk
Ruby
2
star
30

le_custom_domains

HTML
2
star
31

python_package_tutorial

A sample package for Learn Enough Python to Be Dangerous by Michael Hartl
Python
2
star
32

example

Example site
HTML
1
star
33

book_name

1
star
34

yo

1
star
35

website_previous

A sample website for Learn Enough Git to Be Dangerous
HTML
1
star
36

mhartl_video_palindrome

Ruby
1
star
37

padrino_book

Working example of the Padrino book
TeX
1
star
38

demo_app

Ruby
1
star
39

first_app

The first app for the Ruby on Rails Tutorial
Ruby
1
star
40

foobaz_inclusion

Demonstrates file inclusion
TeX
1
star
41

barfing-rainbow

Illustrate a softcover thing
TeX
1
star
42

mhartl-palindrome-gem

Palindrome detector for Learn Enough Rub
Ruby
1
star
43

hungarian_book_template

A Softcover book template for Hungarian
TeX
1
star
44

failing_app_rails_4_0_rc1

A minimal failing app for Rails 4.0 RC1
Ruby
1
star
45

issues_test

1
star
46

foobaz

TeX
1
star
47

latex_sublime_text

Sublime Text snippets for LaTeX
1
star
48

foobar

Template PolyTeX book for Softcover
TeX
1
star
49

rails_tutorial_sample_app_7th_ed

1
star
50

book_template

Book template for long-form documents (including those for my math learning project)
TeX
1
star