Git Product home page Git Product logo

Comments (42)

graudeejs avatar graudeejs commented on May 30, 2024

I was about to post this as well... but thought that someone would implement it, since ctrlp now has support for user extensions (judging by commits)

I already ditched Command-T :D, FuzzyFinder to be next

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Yup, I've made it very simple to add extensions to ctrlp. Everything you need to know is here.

But I guess it's unlikely that someone will do this, so I'll give it a shot once I have some more free time.

Thanks for the suggestion!

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Added along with another extension for quickfix. You can enable it with:

let g:ctrlp_extensions = ['tag']

Start in tag mode with :CtrlPTag.

If you find any problem or see anything that can be improved, let me know.

Thanks!

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

I also use EazyTags, and I'd like to leave tag updating to it.
Right now when I start CtrlPTag EasyTags complains that updatetime is set to less than 400.
(I know I can set g:easytags_updatetime_min which would resolve, that but that's not what I want)

Also I don't see any tags if EasyTags is enabled

(Didn't thought this extensions will be ready so soon and so short :) )

Feel free to check my vim config for details:
https://github.com/graudeejs/dot.vim

to install extensions run make in ~/.vim

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

This problem also occurs with tags extension disabled.

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

c3b316a should take care of the updatetime complaint from easytags.

This tag extension only looks for tags files defined with the Vim's tags option. So you'll need to include the name and location of the tags file generated by easytags in this option. Try something like this for your vimrc:

let &tags .= ','.vim_tmp.'/easytags'

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Yes the issue is solved, but I still don't see tags

Yes tags file is included. But I've set easytags to create tags file for each filetype I edit.
So when I edit ruby my tagsfile is ~/tmp/.vim/eazytags/ruby, when I edit sh it's ~/tmp/.vim/eazytags/sh

I suppose CtrlPTag should check tag file after each time it's invoked (since tags setting is dynamic)

(EasyTags is managing last tags option (path to file))

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Assuming that the tags option is changed each time you switch to a different filetype, then I think pressing <F5> will update the results. Can you test that and let me know if it helps at all?

from ctrlp.vim.

claytron avatar claytron commented on May 30, 2024

When I try and launch the :CtrlPTag, the vim process instantly goes to 100% CPU and never loads the tags. I tried with both MacVim snapshot 62 and my MacPorts compiled vim. Here is the console vim version info:

$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 14 2011 13:08:56)
MacOS X (unix) version
Included patches: 1-244, 246-353
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
-conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
+mouse_xterm -mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg 
+path_extra +perl +persistent_undo +postscript +printer -profile +python 
-python3 +quickfix +reltime -rightleft +ruby +scrollbind +signs +smartindent 
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
   system vimrc file: "/opt/local/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/gcc-4.2 -c -I. -Iproto -DHAVE_CONFIG_H   -I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp  -pipe -O2 -arch x86_64 -D_FORTIFY_SOURCE=1      
Linking: /usr/bin/gcc-4.2   -L. -L/opt/local/lib      -L/opt/local/lib -arch x86_64 -L/usr/local/lib -o vim       -lncurses -liconv -framework Cocoa    -L/opt/local/lib  -fstack-protector  -L/opt/local/lib/perl5/5.12.3/darwin-multi-2level/CORE -lperl -lm -lutil -lc -L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config -lpython2.6 -framework CoreFoundation -u _PyMac_Error /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python   -lruby -lobjc  -L/opt/local/lib

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Nope, F5 doesn't help

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Let know me know how a4b8d4c works?

Thanks!

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Still nothing... I'll get home and check my config... perhaps I'm missing something...

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

:set tags output:

tags=~/.vim/.git/vim.tags,~/.vim/.git/tags,./tags,./TAGS,tags,TAGS,~/.vimtags,/tmp/.graudeejs/.vim/easytags/vim

(~/tmp is link to /tmp/.graudeejs)
However CtrlPTag show nothing (tagfile is generated)

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Do :echo tagfiles() and :echo taglist('.*') return anything before and
after running :CtrlPTag? What's the output of :echo tagfiles()?

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

On Mon, 28 Nov 2011 10:42:27 -0800
kien
[email protected]
wrote:

Do :echo tagfiles() and :echo taglist('.*') return anything
before and after running :CtrlPTag? What's the output of :echo tagfiles()?


Reply to this email directly or view it on GitHub:
#27 (comment)

:echo tagfiles() returns ['/tmp/.graudeejs/.vim/easytags/vim']
Which is correct. After running :CtrlPTag output is the same.

:echo taglist('.*') before and after return massive array of
dictionaries with tags

[{'cmd': '/^map ,$ <plug>NERDCommenterToEOL$/', 'static': 0, 'name':
',$', 'language': 'Vim', 'kind': 'm', 'filename': '/home/graudeejs/
.vim/vimrc'},...

Aldis Berjoza
http://www.bsdroot.lv/

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

I was able to reproduce this by setting path_mode to 0. However, it should
still work with absolute path like
/tmp/.graudeejs/.vim/easytags/vim but somehow doesn't in your case.

I'll investigate further and try to find a fix soon.

On Tue, Nov 29, 2011 at 2:14 AM, Aldis Berjoza <
[email protected]

wrote:

On Mon, 28 Nov 2011 10:42:27 -0800
kien
[email protected]
wrote:

Do :echo tagfiles() and :echo taglist('.*') return anything
before and after running :CtrlPTag? What's the output of :echo tagfiles()?


Reply to this email directly or view it on GitHub:
#27 (comment)

:echo tagfiles() returns ['/tmp/.graudeejs/.vim/easytags/vim']
Which is correct. After running :CtrlPTag output is the same.

:echo taglist('.*') before and after return massive array of
dictionaries with tags

[{'cmd': '/^map ,$ <plug>NERDCommenterToEOL$/', 'static': 0, 'name':
',$', 'language': 'Vim', 'kind': 'm', 'filename': '/home/graudeejs/
.vim/vimrc'},...

Aldis Berjoza
http://www.bsdroot.lv/


Reply to this email directly or view it on GitHub:
#27 (comment)

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

I disabled EasyTags (removed plugin) and manyally set tags path to /tmp/.graudeejs/.vim/easytags/vim with

:set tags+=/tmp/.graudeejs/.vim/easytags/vim

and CtrlPTag works.

Btw, I have suggestion:
tagfile might contain duplicates, so you should (somehow) filter these out

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Let me know how the new commit works. Thanks!

As for filtering duplicates, the :tag command already kind of does this, it
jumps to the first matching tag if there are several ones. Manually
filtering the tags list can be costly, and probably too much for the few
times it actually catches something.

Kien

On Tue, Nov 29, 2011 at 2:35 AM, Aldis Berjoza <
[email protected]

wrote:

I disabled EasyTags (removed plugin) and manyally set tags path to
/tmp/.graudeejs/.vim/easytags/vim with

:set tags+=/tmp/.graudeejs/.vim/easytags/vim

and CtrlPTag works.

Btw, I have suggestion:
tagfile might contain duplicates, so you should (somehow) filter these out


Reply to this email directly or view it on GitHub:
#27 (comment)

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Yey, it works.

Now one more thing:
There should be 2 modes:

  1. search tags in current buffer
  2. search tags in all buffers (or in entire tagfile)

For second, perhaps it would be good to enter tag name, and then search for file where this tag is. perhaps tag@file format (or should I make new Feature request?)

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

That'll require some non-trivial changes in how ctrlp does the whole pattern matching. Sounds really cool though, so I'll definitely look into it. As for seaching tags in current buffer, it's much more complicated, and I think tagbar and taglist already do it and do it better, so I probably won't make this.

@claytron: Can you let me know how it works for you now?

Thanks!

from ctrlp.vim.

travisjeffery avatar travisjeffery commented on May 30, 2024

Pretty sweet stuff going on in here! :D

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

I just came to work. I'll work with it for few hours, then I'll let you know...

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Ok, found a minor problem.

When you work with multiple files, ctrlp caches tags for first file.
When you switch to another file you need to Hit F5 for tags to be updated.

I suggest doing that automatically when CtrlPTag is opened, because it will be annoying as hell to update tags every time I open ctrlp. Also that could prevent CtrlPTag from jumping to wrong line of code, if file was updated (I haven't tested, but I suppose it would jump to wrong line)

I hit a bug..... CtrlPTag can't find tag... when I select any tag and hit Enter it opens Empty buffer saying: "CtrlP: Tag not found."

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Wow... this happens even if I delete tags file and EasyTags creates new (fresh) one

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Can you provide steps to reproduce the "Tag not found" error?

For the caching, I'll use something other than just checking for filenames.

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

For sake of environment differences I suggest you take my vim config

git clone https://github.com/graudeejs/dot.vim
cd ~/.vim
make
rm -f ~/tmp/.vim/eazytags/*
vim vimrc

Wait 4-5 seconds for EasyTags to generate tags
now when you open CtrlPTag select tag and press Enter it will show "Tag not found" error.

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Good idea, I'll try that.

My guess is that easytags changes the results returned by tagfiles() when
switching to a new buffer, hence the tags files are not found when CtrlPTag
trying to run :tag. So there's an option to not create a new buffer/split
or tab (i.e how fuzzyfinder does it).

Anyway, thanks for your time!

On Tue, Nov 29, 2011 at 2:42 PM, Aldis Berjoza <
[email protected]

wrote:

For sake of environment differences I suggest you take my vim config
(clone, cd ~/.vim && make)

rm -f ~/tmp/.vim/eazytags/*
 cd ~/.vim
vim vimrc

Wait 4-5 seconds for EasyTags to generate tags
now when you open CtrlPTag select tag and press Enter it will show "Tag
not found" error.


Reply to this email directly or view it on GitHub:
#27 (comment)

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

It works after last commit

Will do more testing...

from ctrlp.vim.

claytron avatar claytron commented on May 30, 2024

@kien I don't think it can handle the size of my tags file:

$ wc -l tags 
  144321 tags

I can let it run for a while to see how long it takes to complete. But right now it isn't usable for that many tags.

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

I see. Well, give me a couple of days I'll try adding persistent caching to
this and see if it helps, since the taglist() function seems to be much
slower than readfile().

On Tue, Nov 29, 2011 at 8:00 PM, Clayton Parker <
[email protected]

wrote:

@kien I don't think it can handle the size of my tags file:

$ wc -l tags
144321 tags

I can let it run for a while to see how long it takes to complete. But
right now it isn't usable for that many tags.


Reply to this email directly or view it on GitHub:
#27 (comment)

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

@kied..... CtrlPTag really needs to show tags of current file by default.

I don't think it would be hard to implement (Need an idea on this?)

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Sure, I'm listening!

On Tue, Nov 29, 2011 at 9:09 PM, Aldis Berjoza <
[email protected]

wrote:

@kied..... CtrlPTag really needs to show tags of current file by default.

I don't think it would be hard to implement (want me to give some ideas?)


Reply to this email directly or view it on GitHub:
#27 (comment)

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

taglist('.*') return list of hashes.
Simple algorithm would be check each element in list.
All you need to check is if filename keys value of each element (hash) match current files name

The result should probably be stored in other list. This would allow to implement quick switching to all tags mode and back to current buffers tags.

I don't think it would be slow, but I'm VimL noob. Anyway, I think user will work with current buffers tags most of the time (also would be good to sort tags by weight according to filename path, similar to how file fuzzy searching is implemented now)

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Another bug: Currently when you search for tag it show all tags. Now if there are multiple tags with same name but in different files, CtrlPTag can jump to wrong file (even if you manually [with arrow keys] select which tag you want to jump to)

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

@claytron: How does it work for you now? In addition to adding persistent caching, I also remove taglist() altogether and use readfile() for everything.

@graudeejs: That could potentially lead to listing the wrong tags from the wrong file, and would be much slower than using ctags, for example. As for the problem with multiple tags with the same name, tag.vim now uses the tag-matchlist commands as a workaround.

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

It is now showing list of tags and from where they are, and asks me to enter number of tag that I want to open. No good.
http://failiem.lv/thumb_show.php?i=svvoeax&n=not_so_good.jpg

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

It only does that if there's at least one other tag with the same name (there are 2 'index' in your case).

This should be good enough for now, as using the filename to identify the tag isn't reliable.

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

Why not?

Most of time while I work (as Rails programmer) I'll have more >1 tags with same name

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

For people who don't use easytags and have more than one tag file, the filenames can also be the same, as their locations are relative to the tags files.

It's like this:

dir_a
|- file.ext
`- tags (path to file is 'file.ext')

dir_b
|- file.ext
`- tags (path to file is also 'file.ext')

And the tags option:

set tags+=./dir_a/tags,./dir_b/tags

The listing would look like this:

'mytag'    file.ext
'mytag'    file.ext

So unless I'm missing something, there's no easy way out but using tag-matchlist.

from ctrlp.vim.

graudeejs avatar graudeejs commented on May 30, 2024

I see

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

It should be much faster now. I did a few tests with a tags file that has 200000 tags and it seemed to work reasonably well. There are probably a few ugly trade-offs, but at least it loads up in this extreme case.

I also added a tag-count finder, with it you only get the matchlist prompt when the tags are actually identical.

from ctrlp.vim.

kien avatar kien commented on May 30, 2024

Closing this as it's gotten really long and the main issues have been resolved.

Thanks everyone for the feedbacks!

Lastly, just to clarify, you also get the matchlist prompt (see in @graudeejs' screenshot) with :FufTag when jumping to a tag that has duplications. This is the default behavior of :tjump and :stjump. :FufTag just hides the duplications so that you don't know they are there, but if you select one, it'll show that prompt.

So what the tag-count finder does here is it helps switching to the :tag command when possible (differences in path/filename), since the :tag command accepts a count argument. And with this, the prompt only shows up in the rare cases where the duplicate tags have the same filename.

from ctrlp.vim.

Related Issues (20)

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.