Git Product home page Git Product logo

python-cts's Introduction

Description

'python-cts' adds a new executable, 'cts', which searches ctag files for your tag and then executes a command on the selected tag. By default, it executes "$EDITOR +{lineNumber} {file}", which opens the found file your default editor.

Since 'cts' is only as good as your ctag files, it is recommended running ctags with '--extra=+f' so as to index filenames as well. This will let you do 'cts Foo.java' to automatically open up Foo.java in your editor of choice.

Alternatively, one can add a new line, '--extra=+f', to ~/.ctags to set it as a default option for the ctags command. This is likely a better solution as it will also work with scripts, editors, and other out-of-band processes.

If provided a tags file with line numbers instead of patterns, 'cts' will attempt to read the line of code from the actual file.

Example 1

cts bar -i -c /some/directory/tags
  1. '-c /some/directory/tags' indicates cts should use that tags file rather than attempting to find one.

  2. '-i' indicates that it's a case insensitive search. The resulting search query is /^bar$/i

  3. Upon selecting a tag, executes "$EDITOR +{pattern} {file}.

Example 2

cts Foo -p -kc -t scala,py -e "grep def {file}"
  1. Since no ctag file was specified, recurse from the current directory up until a 'tags' file is found.

  2. '-p' indicates a partial search, so look for a /.Foo./ in the tag file.

  3. '-kc' indicates to filter out everything that isn't kind 'c', or class definitions.

  4. '-t scala,py' indicates to filter out all tags that are not files with 'scala' or py as the extension.

  5. '-e "grep def {file}"' indicates that after a selection has been made, to execute "grep def {file}" where {file} will be filled in with the absolute path to the reference file.

To Install (From Pip)

pip install python-cts

If upgrading:

pip install python-cts --upgrade

To Install (From Source)

  1. Checkout the repo
  2. python setup.py install
  3. Profit!

Usage

Type 'cts -h' to get usage information

python-cts's People

Contributors

refefer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tml

python-cts's Issues

Mention ctagsrc

In the README you mention:

Since 'cts' is only as good as your ctag files, it is recommended running ctags with '--extra=+f' so as to index filenames as well. This will let you do 'cts Foo.java' to automatically open up Foo.java in your editor of choice.

You can specify --extra=+f in it's own line in ~/.ctagsrc and have it automatically added to the parameter list, instead of having to use an alias. Bonus points, this way any calls to ctags outside of your shell (say, spawned from within the editor) will also use this option (since they don't parse aliases, etc).

'Entry' object has no attribute '__dict__'

Traceback (most recent call last):
File "/usr/bin/cts", line 288, in
variables = entry.dict.copy()
AttributeError: 'Entry' object has no attribute 'dict'

This happens whenever I try to open a file with cts. /usr/bin/python -V shows 2.7.5, system is 64-bit Linux.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.