Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Use CodeMirror with Rails

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 codemirror-rails.gemspec
README.md

codemirror-rails

Wire up the CodeMirror assets for your Rails applications.

Getting Started

If you're using Bundler, you can add codemirror-rails to your Gemfile:

gem 'codemirror-rails'

Or manually install the codemirror-rails gem:

gem install codemirror-rails

CodeMirror for Rails 3.1

All of the assets from the most latest stable CodeMirror release are vendored so that you can use them with the asset pipeline. At a minimum, you will probably want the following in your application.js and application.css:

//= require codemirror

Adding a mode

Additional syntax modes can be added to your application.js:

//= require codemirror/modes/ruby

Adding a util

Additional reusable util components can be added in your application.js:

//= require codemirror/utils/dialog

Adding a keymap

Additional keymap bindings can be added to your application.js:

//= require codemirror/keymaps/vim

Adding a theme

Additional CSS themes can be added to your application.css

//= require codemirror/themes/night

CodeMirror for Rails 3

You can use the generator included with this gem to copy the CodeMirror 2 assets into your Rails 3 public directory.

rails generate codemirror:install
Something went wrong with that request. Please try again.