Giter VIP home page Giter VIP logo

vim-ctrlp-tjump's Introduction

CtrlP tjump

CtrlP extension for fuzzy-search in tag matches. May be used instead of :tjump or :tselect for IDE-like Goto declaration functionality, which jumps to the declaration in case of one match, and shows quick-search window in case of multiple matches.

Two vim commands are created by this plugin:

  • CtrlPtjump - go to declaration of the identifier supplied as an argument, if not use the word under cursor
  • CtrlPtjumpVisual - go to declaration of the visual selected text

CtrlP tjump

Prerequisites

  1. CtrlP should be installed
  2. Tags should already work with :tag, :tselect and :tjump commands. More information on that here.

Installation

  1. Use your favorite method (I prefer Vundle)

  2. (Optional) Create mapping

    nnoremap <c-]> :CtrlPtjump<cr>
    vnoremap <c-]> :CtrlPtjumpVisual<cr>
    

Basic Usage

  1. Move cursor to the Class/Method usage in your code
  2. Press c-] (if you have created mapping) or just execute :CtrlPtjump (or :CtrlPtjumpVisual in visual mode) in the command line.

Or provide the symbol as an argument:

:CtrlPtjump MyFavoriteClass

Configuration

It is possible to configure shortener for filenames, that will be displayed in CtrlP window. In the example below, RegExp '/home/.*/gems/' will be substituted by string '.../'. This may be useful if filename (with path) of generated tag is long and you want to make it shorter.

let g:ctrlp_tjump_shortener = ['/home/.*/gems/', '.../']

If there is only one tag found, it is possible to open it without opening CtrlP window:

let g:ctrlp_tjump_only_silent = 1

The tag name itself takes valuable screen estate and can be disabled by:

let g:ctrlp_tjump_skip_tag_name = 1

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Self-Promotion

If you like this project, please follow the repository on GitHub and vote for it on vim.org. Also, you might consider visiting my blog and following me on Twitter and Github.

vim-ctrlp-tjump's People

Contributors

ivalkeen avatar konfekt avatar larrylv avatar noscript avatar pjkack avatar tazimmerman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vim-ctrlp-tjump's Issues

The default :tjump command runs after :CtrlPtjump

When I use the :CtrlPtjump command, the nice CtrlP window is displayed with the tag locations, but when I select one of them, the CtrlP window closes and then the default :tjump command apparently runs and displays the normal tags menu (where you select a tag by number). Do I need to disable some default behavior to prevent the second window from displaying?

some error

Error detected while processing function <SNR>141_AcceptSelection..ctrlp#tjump#accept..<SNR>169_open_tag:
line    1:
E687: Less targets than List items
line    2:
E121: Undefined variable: idx
E116: Invalid arguments for function feedkeys

tag files:

https://dl.dropboxusercontent.com/u/185589/tags.tar.bz2

file itself:

https://dl.dropboxusercontent.com/u/185589/Application.php

in detail:

go to line 225 of Application.php, then try to jump at detectWebEnvironment
error above is shown. I first didn't notice that its a next method, but managed to reproduce same error in similar situation (tag in same file, 2 tag files).

tselect and tjump count differ

For some tags, :1tag differs from :tselect 1. Thus, :CtrlPtjump 1 (that uses taglist() which matches the output of tselect) differs from tselect 1 and :CtrlPtjump does not jump to the chosen tag.

This offset might be a Vim bug and happens over here for large TeX files, dunno if this issue is known in other cases as well.

let g:ctrlp_tjump_only_silent = 0

Supposedly

" Skip selection window if only one match found
let g:ctrlp_tjump_only_silent = 0

should be moved from the autoload to the plugin folder to avoid the value set in .vimrc being overwritten.

CtrlP shows only one tag or does not show tjump mode at all

I've just encountered the problem similar to the issue #3 :

  1. Latest versions of CtrlP and CtrlP-TJump installed via Pathogen
  2. set tags=/absolute/path/to/tags
  3. Default mapping created to C-]
  4. :tjump and :tselect work properly
  5. setting cursor on a name and pressing C-] shows CtrlP dialog with tjump mode and proper tag selected

However, if I press the C-P for the CtrlP dialog there is no tjump mode.
If I go to some tag via C-] first, then tjump mode appears in CtrlP, but it only contains the tag I've opened via C-].

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.