Skip to content

Commit

Permalink
Initial add, copied over from tern repository
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Apr 26, 2013
0 parents commit 845bc90
Show file tree
Hide file tree
Showing 4 changed files with 505 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"keys": ["alt+."],
"command": "tern_jump_to_def",
"context": [
{"key": "selector", "operand": "source.js"}
]
},
{
"keys": ["alt+,"],
"command": "tern_jump_back",
"context": [
{"key": "selector", "operand": "source.js"}
]
},
{
"keys": ["alt+space"],
"command": "tern_select_variable",
"context": [
{"key": "selector", "operand": "source.js"}
]
}
]
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Tern for Sublime Text

This is a [Sublime Text][st] (version 2 and 3) package that provides
[Tern][tern]-based JavaScript editing support.

[st]: http://www.sublimetext.com/
[tern]: http://ternjs.net

In JavaScript files, the package will handle autocompletion. When the
cursor is in an argument list, it will show argument hints for the
current function in the status bar. (Unfortunately, the status bar is
*tiny*, and ST provides no proper tooltip functionality.)

The following keys will be found (in JavaScript files):

`alt+.`
Jump to the definition of the thing that the cursor is pointing at. If
there is no known code location, but it has a documentation URL
associated with, this will open the documentation in your browser
instead.

`alt+,`
Jump back to where you were when executing the previous `alt+.` command.

`alt+space`
When on a variable, select all references to that variable in the
current file.

## Installation

Check out the code in this repository into a subdirectory of your
Sublime Text's `Packages` directory.

cd /path/to/sublime-text-N/Packages
git clone git://github.com/marijnh/tern_for_sublime.git

Next, make sure [node.js][node] and [npm][npm] are installed (Tern is
a JavaScript program), and install the depedencies of the package.

[node]: http://nodejs.org
[npm]: https://npmjs.org/

cd tern_for_sublime
npm install

You should be all set now.

## Configuration

The plugin will load its settings from `Preferences.sublime-settings`,
and recognized the following settings:

`tern_argument_hints` (boolean, defaults to true)
Whether to show argument hints.

`tern_command` (list of strings)
The command to execute to start a Tern server. The default is
`["node" "/path/to/Packages/tern_for_sublime/node_modules/tern/bin/tern"]`.
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "tern_for_sublime",
"license": "MIT",
"version": "0.0.1",
"author": "Marijn Haverbeke <[email protected]>",
"description": "Sublime Text package for Tern",
"repository": {
"type": "git",
"url": "git://github.com/marijnh/tern_for_sublime.git"
},
"dependencies": {
"tern": "git://github.com/marijnh/tern.git"
}
}
Loading

0 comments on commit 845bc90

Please sign in to comment.