jsctags


Ⅰ. 插件描述

jsctags generator using tern

Ⅱ. 基本信息

创建日期:  2013-06-23
使用用户:  22
Github星:  475
插件作者:  Sérgio Ramos

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'ramitos/jsctags-you-belong-with-me'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'ramitos/jsctags-you-belong-with-me'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'ramitos/jsctags-you-belong-with-me'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/ramitos/jsctags

Ⅳ. 文档说明

# jsctags

jsctags generator using tern

install

For access to the binary:

npm install -g git+https://github.com/ramitos/jsctags.git

Otherwise, add to your project's package.json under dependencies or
dev-dependencies:

"jsctags": "git://github.com/ramitos/jsctags.git"

usage

$ jsctags [--dir=/path/to] /path/to/file.js [-f]
$ cat /path/to/file.js | jsctags [--dir=/path/to] [--file=/path/to/file.js] [-f]

By default, jsctags will output a JSON file. Use the -f flag to output an exuberant ctags-compatible file.

const jsctags = require('jsctags');
const fs = require('fs');

const file = '/path/to/file.js';
const dir = '/path/to/';
const content = fs.readFileSync(file, 'utf8');

jsctags(file, dir, content, function(e, tags) {
  console.log(tags);
});

Usage with Vim

If you'd like to take a JavaScript project and generate a tags file that Vim can parse, you can use the below command. It searches your directory for any .js files, excluding ./node_modules, formats the tags correctly for Vim and outputs them into tags.

find . -type f -iregex ".*\.js$" -not -path "./node_modules/*" -exec jsctags {} -f \; | sed '/^$/d' | LANG=C sort > tags

If you would like tags generated for files within node_modules/, just remove the -not -path "./node_modules/* part of the command:

find . -type f -iregex ".*\.js$" -exec jsctags {} -f \; | sed '/^$/d' | LANG=C sort > tags

examples

license

MIT

添加新评论