Coder Social home page Coder Social logo

preservim / tagbar Goto Github PK

View Code? Open in Web Editor NEW
6.1K 93.0 482.0 3.56 MB

Vim plugin that displays tags in a window, ordered by scope

Home Page: https://preservim.github.io/tagbar

License: Other

Vim Script 100.00%
exuberant-ctags vim vim-plugins neovim tagbar linux macos windows

tagbar's Introduction

Tagbar: a class outline viewer for Vim

Vint Check

What Tagbar is

Tagbar is a Vim plugin that provides an easy way to browse the tags of the current file and get an overview of its structure. It does this by creating a sidebar that displays the ctags-generated tags of the current file, ordered by their scope. This means that for example methods in C++ are displayed under the class they are defined in.

What Tagbar is not

Tagbar is not a general-purpose tool for managing tags files. It only creates the tags it needs on-the-fly in-memory without creating any files. tags file management is provided by other plugins, like for example gutentags.

Dependencies

  • Vim >= 7.3.1058 or any version of NeoVim.

  • A ctags implementation: We highly recommend any version of Universal Ctags. It is a maintained fork of Exuberant Ctags with many bugfixes, support for many more formats, and proper Unicode support.

    Exuberant Ctags 5.5 or higher works to some degree but will be deprecated eventually.

    Some additional formats can also be handled by other providers such as jsctags or phpctags.

Installation

Extract the archive or clone the repository into a directory in your 'runtimepath', or use a plugin manager of your choice like pathogen. Don't forget to run :helptags if your plugin manager doesn't do it for you so you can access the documentation with :help tagbar.

If the ctags executable is not installed in one of the directories in your $PATH environment variable you have to set the g:tagbar_ctags_bin variable, see the documentation for more info.

Quickstart

Put something like the following into your ~/.vimrc:

nmap <F8> :TagbarToggle<CR>

If you do this the F8 key will toggle the Tagbar window. You can of course use any shortcut you want. For more flexible ways to open and close the window (and the rest of the functionality) see the documentation using :help tagbar.

Support for additional filetypes

For filetypes that are not supported by Exuberant Ctags check out the wiki to see whether other projects offer support for them and how to use them. Please add any other projects/configurations that you find or create yourself so that others can benefit from them, too.

Note: If the file structure display is wrong

If you notice that there are some errors in the way your file's structure is displayed in Tagbar, please make sure that the bug is actually in Tagbar before you report an issue. Since Tagbar uses exuberant-ctags and compatible programs to do the actual file parsing, it is likely that the bug is actually in the program responsible for that filetype instead.

There is an example in :h tagbar-issues about how to run ctags manually so you can determine where the bug actually is. If the bug is actually in ctags, please report it on their website instead, as there is nothing I can do about it in Tagbar. Thank you!

You can also have a look at ctags bugs that have previously been filed against Tagbar.

Screenshots

screenshot1 screenshot2

License

Tagbar is distributed under the terms of the Vim license, see the included LICENSE file.

Contributors

Tagbar was originally written by Jan Larres. It is actively maintained by Caleb Maclennan and David Hegland. At least 75 others have contributed features and bug fixes over the years. Please document issues or submit pull requests on Github.

tagbar's People

Contributors

adnoc avatar alerque avatar blueyed avatar cofyc avatar cridemichel avatar dan0907 avatar darcyparker avatar diegok avatar elpiloto avatar embear avatar fievel avatar goerz avatar gryf avatar hupfdule avatar inkarkat avatar joshfrench avatar jpmv27 avatar jrc2139 avatar kianryan avatar kien avatar majutsushi avatar maujim avatar miteshathia avatar raven42 avatar shane-xb-qian avatar skywind3000 avatar weirdan avatar weynhamz avatar zhaocai avatar zhmars 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  avatar  avatar  avatar

tagbar's Issues

Errors when parsing Ruby file (with Rails plugin)

I'm trying to use TagBar with Ruby on Rails project (with http://www.vim.org/scripts/script.php?script_id=1567 Rails plugin) and get the following errors:

Error detected while processing function 29_AutoUpdate..29_ProcessFile:
line   61:
E716: Key not present in Dictionary: kind2scope, v:val.fields.kind) || has_key(v:val.fields, scope)
Error detected while processing function 29_AutoUpdate..29_ProcessFile:
line   61:
E116: Invalid arguments for function has_key(typeinfo.kind2scope, v:val.fields.kind) || has_key(v:val.fields, scope)
Error detected while processing function 29_AutoUpdate..29_ProcessFile:
line   63:
E716: Key not present in Dictionary: kind2scope, v:val.fields.kind) || has_key(v:val.fields, scope))
Error detected while processing function 29_AutoUpdate..29_ProcessFile:
line   63:
E116: Invalid arguments for function has_key(typeinfo.kind2scope, v:val.fields.kind) || has_key(v:val.fields, scope))
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   38:
E716: Key not present in Dictionary: kind2scope, tag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   38:
E116: Invalid arguments for function has_key(a:typeinfo.kind2scope, tag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   38:
E15: Invalid expression: !has_key(a:typeinfo.kind2scope, tag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   46:
E716: Key not present in Dictionary: kind2scope[tag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   46:
E15: Invalid expression: a:typeinfo.kind2scope[tag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   47:
E121: Undefined variable: parentscope
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags:
line   47:
E116: Invalid arguments for function 29_AddScopedTags
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E716: Key not present in Dictionary: kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E116: Invalid arguments for function has_key(a:typeinfo.kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E15: Invalid expression: !has_key(a:typeinfo.kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   10:
E716: Key not present in Dictionary: kind2scope[childtag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   10:
E15: Invalid expression: a:typeinfo.kind2scope[childtag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   11:
E121: Undefined variable: parentscope
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   11:
E116: Invalid arguments for function 29_AddScopedTags
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E716: Key not present in Dictionary: kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E116: Invalid arguments for function has_key(a:typeinfo.kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E15: Invalid expression: !has_key(a:typeinfo.kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   10:
E716: Key not present in Dictionary: kind2scope[childtag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   10:
E15: Invalid expression: a:typeinfo.kind2scope[childtag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   11:
E121: Undefined variable: parentscope
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   11:
E116: Invalid arguments for function 29_AddScopedTags
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E716: Key not present in Dictionary: kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E116: Invalid arguments for function has_key(a:typeinfo.kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line    2:
E15: Invalid expression: !has_key(a:typeinfo.kind2scope, childtag.fields.kind)
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   10:
E716: Key not present in Dictionary: kind2scope[childtag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   10:
E15: Invalid expression: a:typeinfo.kind2scope[childtag.fields.kind]
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   11:
E121: Undefined variable: parentscope
Error detected while processing function 29_AutoUpdate..29_ProcessFile..29_AddScopedTags..29_AddScopedTags..29_ProcessPseudoChildren:
line   11:
E116: Invalid arguments for function 29_AddScopedTags

tagbar jump to the error line

when the text is changed,example : insert some new line.
tagbar jump to the error line.
tagbar work depends line number,but taglist do not

if you can remove this?

:class and :function behind a python class and function,it is useless and taking much space.

submit some code

function! s:CreateAutocommands()
    augroup TagbarAutoCmds
        autocmd!
        autocmd BufEnter   __Tagbar__ nested call s:QuitIfOnlyWindow()
        autocmd BufUnload  __Tagbar__ call s:CleanUp()
        autocmd CursorHold __Tagbar__ call s:ShowPrototype()

        autocmd BufEnter,BufWritePost * call
                    \ s:AutoUpdate(fnamemodify(expand('<afile>'), ':p'))
        autocmd CursorHold * call
                    \ s:CursorHoldUpdate(fnamemodify(expand('<afile>'), ':p'))
        autocmd BufDelete * call
                    \ s:CleanupFileinfo(fnamemodify(expand('<afile>'), ':p'))
    augroup END

    let s:autocommands_done = 1
endfunction

using CursorHold to read and process a file is unnecessary.

so we can use BufEnter and BufWritePost to process file.
and CursorHold only to locate the tagbar

do you think it is good?

tagbar opens for JS files, but can't jump to fn with ctrl-] ?

If I open tagbar I get all the sidebar with all of my functions all happy and nice, and I can see my function on the left:

functionName : void function(any, Object)

But when I put my cursor over a use of the function (in the main file, not in tagbar), and hit CTRL-], I get:

E433: No tags file
E426: tag not found: functionName

I have jsctags installed:

delv@~ $ jsctags
    usage: jsctags [options] path0 [.. pathN]

I'm not too familiar with how ctags work in general, is this a TagBar issue? Or is the ctags file not getting generated...?

Can you add g:tagbar_jsctags_bin

Hi,

I installed jsctags installed on a win32 machine. (See my gist: https://gist.github.com/1438882)

To get tagbar to work with jsctags on gvim win32, I had to hard code my path to jsctags.cmd in the autoload/tagbar.vim file.

ie: in the latest version on github, I changed these lines as follows.
line 404: if executable('d:\opt\node\jsctags.cmd')
line 417: let type_javascript.ctagsbin = 'd:\opt\node\jsctags.cmd'

Works nicely now on windows. But this of course is just a workaround.

It would be nice to have logic similar to if !exists('g:tagbar_ctags_bin') logic earlier in the file.

Thanks
Darcy

tagbar highlight wrong place

when I add some new line to a file and do not save it

clicked the tagbar ,now it can goto the right line, but tagbar highlight is wrong

Can't mousewheel in MacVim

Mousewheeling inside the Tagbar pane in MacVim doesn't work as the page always jumps back to the currently-highlighted function.

tagbar does a misjudgement in python code

python code is:

class A():
++def a(self):
++++Long_str=''' first line
second line
third line
'''
++def b(self):
++++pass

"+"is indent

and now the function b is not in class A in tagbar, but it is .

Support for user definied ctags options

Taglist supports adding user defined options for ctags. I would be great if tagbar would do that. Than it's not necessary anymore to update the .ctags file but new file types can be supported by vim plug-ins directly.

tagbar doesn't play nice with NERDTree

With NERDTree open on the left and a file in the middle, I open tagbar on the right. If I leave tagbar open and then move the cursor back to the middle from tagbar, the screen is painted black and I need to use :redraw to fix the display.

I use a dark theme.

tagbar cursor jump

i found winline() cause tagbar cursor jump
such as:double click tagbar when highlight cursor isn't in current view

so i del all winline() and redrew() in tagbar.vim
Generally, it work well

jsctags / doctorjs compat

I thought this was supposed to work with doctorjs out of the box? I just installed fresh a tagbar and doctorjs, but when I open tagbar in vim I get:

Tagbar: Could not execute ctags for ~/web/js/app/views/user/User.js!
Executed command: "'jsctags'  -f -  '~/web/js/app/views/user/User.js'"
Command output:
Error: unknown option "-f"    

I even specified the let g:ctagsargs="" config so it'd quit putting that -f in there.

problem in latex file

I am having problems with tagbar when I open latex files.
If I open tagbar, it opens but doesn't show any tags.
When I try to close it I get

Error detected while processing function tagbar#ToggleWindow..21_ToggleWindow..21_CloseWindow:
line 10:
E716: Key not present in Dictionary: fpath)
E116: Invalid arguments for function bufnr(s:known_files.getCurrent().fpath)
E15: Invalid expression: bufnr(s:known_files.getCurrent().fpath)
line 21:
E121: Undefined variable: filebufnr
E15: Invalid expression: bufnr('%') != filebufnr

this does not happen with other file types, and it also doesn't happen after I open a latex file
after opening a file of another type (in the same session).

JS support?

I haven't been able to get this plugin to play nice with JavaScript files. Here's what the output looks like: http://gyazo.com/36426dcb57e835537f5561ffd45df2eb.png

I have tried setting g:tagbar_ctags_bin to both my exuberant ctags install and jsctags, but the output remains the same. I would expect to see some kind of hierarchy & organization of functions? Is there something I'm missing here?

Can't jump-to-line via tagbar with DoctorJS

In tagbar, with DoctorJS installed, you can't select a certain function in a .js file function list.

Pressing 'enter' anywhere in tagbar's list always jumps to the top of the file.

Add a way of specifying type nesting/hierarchy

Hi

I'm trying to make tagbar work with CoffeeScript. So far I got it working ok with classes which are contained in a single file

example

Configuration used:

(in .vimrc):

let g:tagbar_type_coffee = {
  \ 'ctagstype' : 'coffee',
  \ 'kinds' : [
  \   'n:namespace',
  \   'c:class',
  \   'o:object',
  \   'm:methods',
  \   'f:functions',
  \   'i:instance variables',
  \   'v:var:1',
  \ ],
  \ 'sro' : ".",
  \ 'scope2kind' : {
  \   'o' : 'object',
  \   'f' : 'function',
  \   'm' : 'method',
  \   'v' : 'var',
  \   'i' : 'ivar'
  \ },
  \ 'kind2scope' : {
  \  'function' : 'f',
  \  'method' : 'm',
  \  'var' : 'v',
  \  'ivar' : 'i',
  \ 'object' : 'o'
  \},
  \ 'deffile' : expand('<sfile>:p:h') . '/.vim/coffee.ctags'
\ }

and coffee.ctags

--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/class ([A-Za-z.]+)/\1/c,class/
--regex-coffee=/^([A-Z][a-z].*)[ \t]*=/\1/n,namespace/
--regex-coffee=/^[ \t]*((A-Z][a-zA-Z]*/\1/c,class/
--regex-coffee=/^[ \t]*([A-Za-z]+)[ \t]*=.*->.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z]+)[ \t]*:.*->.*$/\1/m,method/
--regex-coffee=/^[ \t]*([ \t][a-z]+)[ \t]*=.*$/\1/v,var/
--regex-coffee=/^[ \t]*(@[A-Za-z]+)[ \t]*=.*$/\1/i,ivar/

This doesn't work in a file which has multiple classes or object literals with methods.

Is there a way of saying that kind method (m) belongs to object (o)? Or am I asking for too much and such functionality would have to be added to ctags/jsctags (or whatever it is called nowadays)?

Custom tags cause errors

Hi, This is both a bug report and a feature request. I'm passing flags to ctags to generate custom tags for a custom object system in perl like so:

--regex-perl=/^[ \t]*class[ \t]+([[:alnum:]:]+)/\1/k,classes,UR classes/
--regex-perl=/^[ \t]*([[:alnum:]_]+)[ \t]*=>[ \t]*\{/\1/r,properties,UR properties/

This is causing Tagbar to go nuts when it gets to the custom tags. Here are some of the errors i get:

Error detected while processing function <SNR>58_AutoUpdate..<SNR>58_ProcessFile..<SNR>58_parseTagline..393:
line 12:
E716: Key not present in Dictionary: k

Error detected while processing function <SNR>58_AutoUpdate..<SNR>58_ProcessFile..<SNR>58_parseTagline..393:
line 12:
E15: Invalid expression: fileinfo.kindfolds[self.fields.kind]

Error detected while processing function <SNR>58_AutoUpdate..<SNR>58_ProcessFile..419..<SNR>58_SortTags.. <SNR>58_CompareByKind:
line 3:
E716: Key not present in Dictionary: k

With Taglist I am able to add new categories to the view like this:

let tlist_perl_settings='perl;c:constant;l:label;p:package;k:class;r:property;s:subroutine'

So at a minimum it would seem good to have Tagbar ignore these extra tags when defined (or give a useful error message instead of exploding). Ideally it would support adding categories like Taglist.

Thanks for your awesome work,
Randy

cursor moves slowly in tagbar window

For a cpp or hpp file which has functions with many arguments, when I open the tagbar window, the cursor moves up or down slowly. If the functions has only a few arguments, the cursor moves fast. Different speed for different files annoys me.
Actually, even in the same file, the cursor in different area of the tagbar window moves in different speed, because different function has different number of arguments.
For taglist, the cursor moves in the same speed, because taglist does not show the arguments of functions.
Hope the cursor in tagbar can also move in the same speed like taglist.

unmap of <CR> tagbarToggle?

can I unman the default map tagbarToggle, I use ack plugin, I can't press enter on ack popup window, or I think the map should add a keyword

高亮组错误

刚安装时是对的,一次打开build.xml,提示出现了这个错误。
以后开java,xml就没有高亮了,然后一直报错。

Ruby methods not well folded

Hi Jan,

I have a simple ruby file(a class with four methods):

class Foo
  def a
  end

  def b
  end

  def Foo.c(item)
  end

  def self.d
  end
end

And tagbar panel show me:

Foo : Class
  a
  b
  c
  d

I think it should be showed as below:

Foo : Class
  methods
    a
    b
  singleton methods
    c
    d

Tags generated by hand(same command used by tagbar):

$ 'ctags-exuberant'  -f -  --format=2  --excmd=pattern  --fields=nksSa  --extra=  --sort=yes  --language-force=ruby --ruby-kinds=mcfF  '/home/foo/Workspace/tagbar.rb'
Foo /home/foo/Workspace/tagbar.rb   /^class Foo$/;" c   line:1
a   /home/foo/Workspace/tagbar.rb   /^  def a$/;"   f   line:3  class:Foo
b   /home/foo/Workspace/tagbar.rb   /^  def b$/;"   f   line:8  class:Foo
c   /home/foo/Workspace/tagbar.rb   /^  def Foo.c(item)$/;" F   line:13 class:Foo
d   /home/foo/Workspace/tagbar.rb   /^  def self.d$/;"  F   line:17 class:Foo

Thanks!

Permanent "1 line less" Message

Whenever I have TagBar enabled, my status line will say "1 line less." This message always overrides whatever else updates the status line and causes an extra cursor flicker after movement commands.

Can't specify ctags location with space in path name

There appear to be several problems with g:tagbar_ctags_bin option. First, if the path to ctags executable contains a space, it is never recognized. Also, it appears shellslash option is not respected either.

Errors in AutoUpdate method

I am getting a flood of errors when opening new .js files with Tagbar already open:

key not present in dictionary ('s', 'a', and 'o')

invalid expression: fileinfo.kindfolds

invalid expression: typeinfo.kinddict

-- the plugin does seem to function however. Some initial thoughts:

  1. I am not using JSCTags for .js because it now is erroring out with the newest node.js, instead
    I have fallen back to the older regex hacks for getting exuberant-ctags to recognize .js. Would these
    cause an issue?

well, that is my only initial thought...

Can't show function signature for Python

when open tagbar, only show the function name, none (params).
but i guess this function should be there.
Did I missed something? or this function need python.dll ?

Error calling tagbar open - cannot find module underscore

Error detected while processing function <SNR>27_AutoUpdate..<SNR>27_ProcessFile..        <SNR>27_ExecuteCtagsOnFile:
line   43:
Tagbar: Could not execute ctags for file.js!
Executed command: "'jsctags'  -f -  'file.js'"
Command output:
node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: Cannot find module 'underscore'
    at Function._resolveFilename (module.js:322:11)
    at Function._load (module.js:267:25)
    at require (module.js:351:19)
    at Object.<anonymous> (/usr/local/bin/jsctags:42:9)
    at Module._compile (module.js:407:26)
    at Object..js (module.js:413:10)
    at Module.load (module.js:339:31)
    at Function._load (module.js:298:12)
    at Array.<anonymous> (module.js:426:10)
    at EventEmitter._tickCallback (node.js:126:26)

Note that running jsctags' -f - file.js from the command line works just fine

doctorjs option error

I get this error when calling TagbarOpen on a JavaScript file:

Tagbar: Could not execute ctags for /home/user/example.js!
Executed command: "'jsctags'  -f -  '/home/user/example.js'"
Command output:
Error: unknown option "-f"

Vim version - 7.3.1-206

Exuberant Ctags - 5.8

Doctorjs - git clone

Any ideas?

Comments parsed as code

I only use tagbar for PHP development (so I don't know if this bug affects other languages as well). In the list of classes and functions in tagbar, I'll often see comments in my docblock parsed as being actual code, and whenever the word "class" or "function" is used, the word following it will appear in the tagbar list.

The comments in question are interpreted as comments and colored by VIM. I use MacVim 61 (latest) and the latest version of tagbar.

Example code:
...
/**
*
* This function is useful for unit tests
* @return Service_ObjectFactory
*/
public function getObjectFactory()
{
...

Tagbar sidebar:

...
is
getObjectFactory
...

Closing tagbar in tagbar goes to wrong window

When tagbar is closed via :TagbarToggle while inside the tagbar window the previous window is not returned to. Instead the right most (or left most when opened on the left) window is switched to. This is the default Vim behavior, but it is annoying when toggling the tagbar. Adding the following command will jump to the previous window in this situation.

The code to add: exe winnr('#') . 'wincmd w'

Context:
Line 1476 of autoload/tagbar.vim inside the function s:CloseWindow():

if winnr() == tagbarwinnr
    if winbufnr(2) != -1
        " Other windows are open, only close the tagbar one
        close
        " Return to the previous window.
        exe winnr('#') . 'wincmd w'
    endif
else

Why don't you have a "how to use Tagbar" anywhere?

I see screenshots with a sidebar open, but pretend like I don't know how to make that open (because I don't). Why don't you have instructions anywhere for usage? You have a github page, a vim page, and a separate homepage, and you didn't think that usage instructions would be good on any of those?

Tagbar empty

I have a strange behaviour on my system and can't explain why:

when trying to start TagbarToggle, I see ctags running, but the Tagbar is not opened. When I force it to open, it is empty. The tags file is created and has tons of data in it.

My system configuration is MacVim+latest Janus . Ctags is Version 5.8 build with brew

Can you help me to debug this?

Tagbar returns to wrong window on toggle close

While editing a file, and with MiniBufExplorer window open, If I toggle the tagbar window open, then toggle it back shut, the cursor always ends up in the MiniBufExplorer window, rather than the last window I was editing.

Here are my tagbar settings:

let g:tagbar_singleClick=1
let g:tagbar_autoclose=1

jsctags unknown option "-f"

When jsctags installed an error occured for TagbarOpen:

Error detected while processing function <SNR>59_AutoUpdate..<SNR>59_ProcessFile:
line 67:
Tagbar: Could not execute ctags for ...js!
Executed command: "'jsctags' -f '...js'"
Command output:
Error: unknown option "-f"

Error when toggelling TagBar in Python (.py) & Java (.java) files. Caused by DoctorJS?

Hi!

I was trying to :TagbarToggle in Python (.py) and Java (.java) files, and Vim throws the same error, followed by an empty TagBar window.

Error detected while processing function <SNR>16_AutoUpdate..<SNR>16_ProcessFile:
line 48: Tagbar: Could not execute ctags for /home/me/script.py!
Executed command: "'ctags' -f -  --format=2  --excmd=pattern  --fields=nksSa  --extra=  --sort=yes  --language-force=python --python-kinds=icfmv '/home/me/script.py'"
Command output:
ctags: illegal option -- -
usage: ctags [-BFadtuwvx] [-f tagsfile] file ... 

Note that I'm using DoctorJS, and toggelling TagBar in a JavaScript (.js) file works great and lists everything. Perhaps this is causing the error? I believe this error will be thrown for any filetype except JavaScript.

Mouse commands doesn't work

Whenever I click on the tagbar window vim enters in visual mode and starts selecting everything on the window that was on focus before, from the original position of the cursor to the current mouse position (and the selection changes as if I was pressing the left mouse button).

Notes:

  • NERDTree plugin is also installed and the mouse commands work just fine there.
  • I'm using mouse=a

CR stops jumping to tag

Tagbar sometimes enters a state where CR just moves down a line in the tagbar window instead of jumping to the tag. I'm not sure how to replicate it, but it has happened about three times.

Crash on buffer deletion.

To reproduce:
Start vim,
open a file for which tagbar can generate tags,
ToggleTagbar.
Switch the main window to a different buffer.

The tagbar remains active. If the different buffer is taggable, the TagBar will be updated, otherwise the TagBar will retain the tags of the previous buffer.

Now, delete the buffer you switched to, which is now the current buffer:
:bd[elete]

Vim will crash.

If you deactivate the TagBar before you delete the buffer, no crash.

Single click feature

Any way we can configure it so we can navigate through the methods using a single click instead of double-clicking?

In Tlist, this was possible by throwing an option into vimrc: let Tlist_Use_SingleClick = 1

Any equivalent for tagbar?

Keep up the good work!

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.