diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2012-08-29 10:05:42 +1200 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2012-08-29 10:05:42 +1200 |
commit | f1bb32224528459b5b44fd92452195491ea375a4 (patch) | |
tree | a1e68fd222dfad59ba0e467a79d2970ba4980a7f | |
parent | 1fc6b49c258cda41a54bb376862706fb07409470 (diff) | |
download | asciidoc-f1bb32224528459b5b44fd92452195491ea375a4.tar.gz |
- Removed Vim related stuff from the installer makefile. See:
https://groups.google.com/group/asciidoc/browse_thread/thread/753a52b2af85fcfc/04c9091b0856fc13
https://groups.google.com/group/asciidoc/browse_thread/thread/cd07629fa7a53fb3
- Dropped vim/ftdetect/asciidoc_filetype.vim from distribution, the file
detection was broken and the default settings satisfied noone.
- Updated related documentation.
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Makefile.in | 26 | ||||
-rw-r--r-- | doc/asciidoc.txt | 55 | ||||
-rw-r--r-- | vim/ftdetect/asciidoc_filetype.vim | 53 | ||||
-rw-r--r-- | vim/syntax/asciidoc.vim | 14 |
5 files changed, 31 insertions, 118 deletions
@@ -86,4 +86,3 @@ tests/data/*.txt themes/flask/*.css themes/volnitsky/*.css vim/syntax/asciidoc.vim -vim/ftdetect/asciidoc_filetype.vim diff --git a/Makefile.in b/Makefile.in index 128b533..f522d45 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,8 +27,6 @@ ASCIIDOCCONF = $(sysconfdir)/asciidoc prog = asciidoc.py a2x.py progdir = $(bindir) -vimdir = @sysconfdir@/vim - manp = $(patsubst %1.txt,%1,$(wildcard doc/*.1.txt)) manpdir = $(mandir)/man1 @@ -144,31 +142,11 @@ fixconfpath: chmod +x $$f; \ done -install-vim: - @for d in $(DESTDIR)/$(vimdir) /etc/vim; do \ - if test ! -d $$d; then continue; fi ; \ - echo "installing Vim files in $$d" ; \ - $(INSTALL) -d $$d/syntax ; \ - $(INSTALL_DATA) vim/syntax/asciidoc.vim $$d/syntax ; \ - $(INSTALL) -d $$d/ftdetect ; \ - $(INSTALL_DATA) vim/ftdetect/asciidoc_filetype.vim $$d/ftdetect ; \ - done - -uninstall-vim: - @for d in $(DESTDIR)/$(vimdir) /etc/vim; do \ - if test ! -d $$d; then continue; fi ; \ - echo "uninstalling Vim files in $$d" ; \ - rm -f $$d/syntax/asciidoc.vim ; \ - rm -f $$d/ftdetect/asciidoc_filetype.vim ; \ - done - - build: fixconfpath $(manp) +install: all $(PROGTARGETS) $(DATATARGETS) progsymlink -install: all $(PROGTARGETS) $(DATATARGETS) progsymlink install-vim - -uninstall: uninstall-vim +uninstall: rm -f $(DESTDIR)/$(progdir)/asciidoc rm -f $(DESTDIR)/$(progdir)/asciidoc.py rm -f $(DESTDIR)/$(progdir)/a2x diff --git a/doc/asciidoc.txt b/doc/asciidoc.txt index 730820f..64a5be5 100644 --- a/doc/asciidoc.txt +++ b/doc/asciidoc.txt @@ -5230,22 +5230,17 @@ Example `~/.vimrc` File set background=dark " Show tabs and trailing characters. +"set listchars=tab:»·,trail:·,eol:¬ set listchars=tab:»·,trail:· set list -" Don't highlight searched text. -highlight clear Search - -" Don't move to matched text while search pattern is being entered. -set noincsearch - " Reformat paragraphs and list. -nnoremap R gq} +nnoremap <Leader>r gq} " Delete trailing white space and Dos-returns and to expand tabs to spaces. -nnoremap S :set et<CR>:retab!<CR>:%s/[\r \t]\+$//<CR> +nnoremap <Leader>t :set et<CR>:retab!<CR>:%s/[\r \t]\+$//<CR> -autocmd BufRead,BufNewFile *.txt,README,TODO,CHANGELOG,NOTES +autocmd BufRead,BufNewFile *.txt,*.asciidoc,README,TODO,CHANGELOG,NOTES,ABOUT \ setlocal autoindent expandtab tabstop=8 softtabstop=2 shiftwidth=2 filetype=asciidoc \ textwidth=70 wrap formatoptions=tcqn \ formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\\|^\\s*<\\d\\+>\\s\\+\\\\|^\\s*[a-zA-Z.]\\.\\s\\+\\\\|^\\s*[ivxIVX]\\+\\.\\s\\+ @@ -5654,39 +5649,23 @@ Syntax highlighting is incredibly useful, in addition to making reading AsciiDoc documents much easier syntax highlighting also helps you catch AsciiDoc syntax errors as you write your documents. -The AsciiDoc `./vim/` distribution directory contains Vim syntax -highlighter and filetype detection scripts for AsciiDoc. Syntax -highlighting makes it much easier to spot AsciiDoc syntax errors. +The AsciiDoc distribution directory contains a Vim syntax highlighter +for AsciiDoc (`./vim/syntax/asciidoc.vim`), you can find the latest +version in the online +https://code.google.com/p/asciidoc/source/browse/[AsciiDoc +repository]. -If Vim is installed on your system the AsciiDoc installer -(`install.sh`) will automatically install the vim scripts in the Vim -global configuration directory (`/etc/vim`). +Install the highlighter by copying `asciidoc.vim` to your +`$HOME/.vim/syntax` directory (create it if it doesn't already exist). -You can also turn on syntax highlighting by adding the following line -to the end of you AsciiDoc source files: - - // vim: set syntax=asciidoc: +To enable syntax highlighing: -TIP: Bold fonts are often easier to read, use the Vim `:set -background=dark` command to set bold bright fonts. +- Put a Vim 'autocmd' in your Vim configuration file (see the + <<X61,example vimrc file>>). +- or execute the Vim command `:set syntax=asciidoc`. +- or add the following line to the end of you AsciiDoc source files: -NOTE: There are a number of alternative syntax highlighters for -various editors listed on the {website}[AsciiDoc website]. - -Limitations -~~~~~~~~~~~ -The current implementation does a reasonable job but on occasions gets -things wrong: - -- Nested quoted text formatting is highlighted according to the outer - format. -- If a closing Example Block delimiter is sometimes mistaken for a - title underline. A workaround is to insert a blank line before the - closing delimiter. -- Lines within a paragraph starting with equals characters may be - highlighted as single-line titles. -- Lines within a paragraph beginning with a period may be highlighted - as block titles. + // vim: set syntax=asciidoc: [[X74]] diff --git a/vim/ftdetect/asciidoc_filetype.vim b/vim/ftdetect/asciidoc_filetype.vim deleted file mode 100644 index c8f7028..0000000 --- a/vim/ftdetect/asciidoc_filetype.vim +++ /dev/null @@ -1,53 +0,0 @@ -" Vim filetype detection file -" Language: AsciiDoc -" Author: Stuart Rackham <srackham@gmail.com> -" Last Change: AsciiDoc 8.2.0 -" URL: http://www.methods.co.nz/asciidoc/ -" Licence: GPL (http://www.gnu.org) -" Remarks: Vim 6 or greater - -" COMMENT OUT ONE OF THE TWO FOLLOWING COMMANDS -" The first sets asciidoc syntax highlighting on all .txt files, the second -" only existing files *.txt that appear to be AsciiDoc files. - -au BufNewFile,BufRead *.asciidoc,*.txt,README,TODO,CHANGELOG,NOTES setfiletype asciidoc -"au BufRead *.txt,README,TODO,CHANGELOG,NOTES call s:FTasciidoc() - -" This function checks for a valid AsciiDoc document title after first -" skipping any leading comments. -function! s:FTasciidoc() - let in_comment_block = 0 - let n = 1 - while n < 50 - let line = getline(n) - let n = n + 1 - if line =~ '^/\{4,}$' - if ! in_comment_block - let in_comment_block = 1 - else - let in_comment_block = 0 - endif - continue - endif - if in_comment_block - continue - endif - if line !~ '\(^//\)\|\(^\s*$\)' - break - endif - endwhile - if line !~ '.\{3,}' - return - endif - let len = len(line) - let line = getline(n) - if line !~ '[-=]\{3,}' - return - endif - if len < len(line) - 3 || len > len(line) + 3 - return - endif - setfiletype asciidoc -endfunction - -" vim: et sw=2 ts=2 sts=2: diff --git a/vim/syntax/asciidoc.vim b/vim/syntax/asciidoc.vim index f64be29..678e699 100644 --- a/vim/syntax/asciidoc.vim +++ b/vim/syntax/asciidoc.vim @@ -5,8 +5,18 @@ " URL: http://www.methods.co.nz/asciidoc/ " Licence: GPL (http://www.gnu.org) " Remarks: Vim 6 or greater -" Limitations: See 'Appendix E: Vim Syntax Highlighter' in the AsciiDoc 'User -" Guide'. +" Limitations: +" +" - Nested quoted text formatting is highlighted according to the outer +" format. +" - If a closing Example Block delimiter may be mistaken for a title +" underline. A workaround is to insert a blank line before the closing +" delimiter. +" - Lines within a paragraph starting with equals characters are +" highlighted as single-line titles. +" - Lines within a paragraph beginning with a period are highlighted as +" block titles. + if exists("b:current_syntax") finish |