Giter Site home page Giter Site logo

asciidoc-vim's Introduction

AsciiDoc syntax highlighting in VIM

Difference with upstream syntax file

While this syntax file was independently developed, it was later merged with improved regular expressions taken from the upstream syntax file.

  • Bold is bold, Emphasize is italic

  • Document title stands out (in bold)

  • Titles are underlined

  • Better and more colors facilitate reading and editing

  • Links and email addresses are underlined

  • Admonitions look nicer

The reason why this syntax file looks better is because it does not stick to the provided styles (that mostly maps to programming languages and therefor is pretty limited).

Installing the asciidoc.vim file

Put the asciidoc.vim syntax file in your home directory at ~/.vim/syntax/asciidoc.vim. That should be sufficient to have AsciiDoc support in VIM.

Auto enabling syntax highlighting

AsciiDoc files have the default .txt extension and therefor are indistinguishable from plain text files (that do not honour the AsciiDoc rules). Therefor we cannot automatically enable syntax highlighting in VIM for AsciiDoc files.

To enable syntax highlighting for AsciiDoc files, add the following line at the end of your AsciiDoc files:

// vim: set syntax=asciidoc:

Or install the asciidoc_filetype.vim filetype detection script in ~/.vim/ftdetect/asciidoc_filetype.vim.

Testing VIM syntax files

The syntax file considers 3 different environments.

  1. Terminal

  2. Color terminal

  3. GUI

Each of these have different capabilities and therefor can have different definitions. To test each of these on a capable terminal, try:

$ TERM=vt100 vim README.txt
$ TERM=ansi vim README.txt
$ gvim README.txt

Known shortcomings

There are a few quirks in the syntax files. Here is an overview:

Underlining titles does not work consistently??

There is no way that we can match the length of a title with the length of the line under it. Because of that every line preceded by text could ambigously be interpreted as either a title or the start of a block. Use the wiki-style syntax for titles. (used by this document)

Some asciidoc syntax is not implemented??

Yes, certain newer syntax rules have not been implemented yet, as is the case with the upstream version.

Feedback

If you have fixes or improvements to the syntax file, please send them to: [email protected].

asciidoc-vim's People

Contributors

dagwieers avatar spf13 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

sjas

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.