Giter Club home page Giter Club logo

ctags's Introduction

Exuberant Ctags (extended)

What's this?

This is a fork of Exuberant Ctags, the source code comes from: http://ctags.sourceforge.net, see README(without '.md' extension) for more details.

This project, inherited from the original, follows the GNU General Public License

It supports the following languages: Assembler, AWK, ASP, BETA, Bourne/Korn/Z Shell, C, C++, C#, COBOL, Eiffel, Erlang, Fortran, Java, Lisp, Lua, Makefile, Pascal, Perl, PHP, PL/SQL, Python, REXX, Ruby, Scheme, S-Lang, SML (Standard ML), Tcl, Vera, Verilog, VHDL, Vim, and YACC.

markdown

Besides above, this branch implemented a markdown module, which extracts the headings of the markdown doc. Cooperated with vim and taglist, a hierarchy of the document can be displayed as follows:

markdown-taglist.png

go

go.c from github.

protobuf

protobuf.c from https://github.com/universal-ctags/ctags.git

What's done?

A file called markdown.c is added to the original project and some modification of some files

What's new?

  • extract the headings

    see the pic above

  • extract the headings discarding the <a> html tag

      ## some heading 1
      ### <a name="test"></a>some heading
      ## some heading 2
      ### <a name="test1"></a>some heading1
    

    the above will generate the taglist as follow:

      some heading 1
        some heading
      some heading 2
        some heading1
    

    this features is very useful for some markdown doc with many jump tags, the taglist wont display so many annoying html tags:

      some heading 1
        <a name="test"></a>some heading
      some heading 2
        <a name="test1"></a>some heading1
    

How to define a new language in Ctags?

in ctags, a new language is defined with a new .c file say new_language.c

besides .c file, there are files to modify:

  1. source.mak

    source

     ...
     yacc.c \
     new_language.c \
     vstring.c
     ...
    

    OBJECT

     yacc.$(OBJEXT) \
     new_language.$(OBJEXT) \
     vstring.$(OBJEXT)
    
  2. parsers.h

    add new_language parser

     ...
     VhdlParser, \
     VimParser, \
     YaccParser, \
     NewLanguageParser
    

config vim

here are some instructions for configuring vim with ctags support

config for taglist.vim

taglist parses catags' output, taglist needs to be notified when there is a
new language

	" vim language
	let s:tlist_def_vim_settings =
							\ 'vim;v:variable;a:autocmds;c:commands;m:map;f:function'

	" yacc language
	let s:tlist_def_yacc_settings = 'yacc;l:label'

	" markdown language
	let s:tlist_def_markdown_settings = 'markdown;h:heading'

config for tagbar

	let g:tagbar_type_markdown = {
	\ 'ctagstype' : 'markdown',
	\ 'kinds' : [
	  \ 'h:heading',
	\ ],
	\ 'sort' : 0
	\ }
	
	let g:tagbar_type_go = {
	\ 'ctagstype' : 'go',
	\ 'kinds' : [
	  \ 'f:function',
	  \ 'p:package',
	  \ 'v:variable',
	  \ 't:type',
	  \ 'c:const',
	\ ],
	\ 'sro' : '.',
	\ 'kind2scope' : {
	\ 't' : 'ctype',
	\ 'n' : 'ntype'
	\ },
	\ 'scope2kind' : {
	\ 'ctype' : 't',
	\ 'ntype' : 'n'
	\ },
	\ 'sort' : 0
	\ }

ctags's People

Contributors

gavinchou avatar

Watchers

 avatar  avatar

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.