summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-12 23:14:03 +0000
committerKarl Berry <karl@freefriends.org>2011-08-12 23:14:03 +0000
commit3affad3394ee81c3f5ba136242d5d56949254515 (patch)
treea0a6e75f758b5c846182e833f658014df28cba23 /Master/texmf-dist/doc/context
parentc74165f3bdbaaefef4e594d6dbc2ad7b13292bbb (diff)
context-vim (11aug11)
git-svn-id: svn://tug.org/texlive/trunk@23523 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/context')
-rw-r--r--Master/texmf-dist/doc/context/third/vim/vim.txt142
1 files changed, 137 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/context/third/vim/vim.txt b/Master/texmf-dist/doc/context/third/vim/vim.txt
index 153398011ce..ed6c0e3feae 100644
--- a/Master/texmf-dist/doc/context/third/vim/vim.txt
+++ b/Master/texmf-dist/doc/context/third/vim/vim.txt
@@ -31,10 +31,10 @@ Both colors and no ligatures work out of the box in MkIV.
Installation
------------
-This module depends on the `t-filter` module. If you are using ConTeXt minimals,
-you can install the module using
+This module depends on the `t-filter` module. If you are using ConTeXt
+standalone, you can install the module using
- first-setup.sh --extras="t-filter,t-vim"
+ first-setup.sh --modules="t-filter,t-vim"
Depending on your TeX distribution, you may already have the module.
To verify, check if
@@ -287,10 +287,66 @@ By default, the space is invisible. If you want to make the space visible, set
The default value is `space=off`.
-Splitting lines
+Removing leading spaces
+-----------------------
+
+If you are listing a code snippet inside another environment, it is common to
+indent the TeX code. For example:
+
+ \definevimtyping[C][syntax=C]
+ \definevimtyping[ruby][syntax=ruby]
+
+ \startitemize
+ \item A hello world example in C
+ \startC
+ #include<stdio.h>
+
+ int main()
+ {
+ printf("Hello World")
+ }
+ \stopC
+ \item A hello world example in ruby
+ \startruby
+ puts "Hello World"
+ \stopruby
+ \stopitemize
+
+Although, the source code is easy to read, the output will not be. This is
+because, unlike regular TeX, `\start<vimtyping>` ... `\stop<vimtyping>`
+environment does not ignore whote space. So, the output is the same as
+
+ \startitemize
+ \item A hello world example in C
+ \startC
+ #include<stdio.h>
+
+ int main()
+ {
+ printf("Hello World")
+ }
+ \stopC
+ \item A hello world example in ruby
+ \startruby
+ puts "Hello World"
+ \stopruby
+ \stopitemize
+
+So, all the code snippets are indented by nine space. To avoid this behavior,
+set
+
+ \definevimtyping
+ [...]
+ [...
+ strip=yes,
+ ...]
+
+The default value of `strip` is `no`.
+
+Wrapping lines
---------------
-By default, long lines are not split. If you want to split long lines, set
+By default, long lines are not wrapped. If you want to wrap long lines, set
\definevimtyping
[...]
@@ -300,6 +356,77 @@ By default, long lines are not split. If you want to split long lines, set
The default value is `lines=fixed`.
+Highlighting lines
+------------------
+
+Sometimes you want to draw attention to a particular line (or set of lines). One
+way to do so it to highlight the lines by a background color. This can be done
+using:
+
+ \start<vimtyping>[highlight={<list>}]
+ ...
+ \stop<vimtyping>
+
+where `<list>` is a comma separated list. For example, if you want to highlight
+lines 1 and 5, you may use:
+
+ \start<vimtyping>[highlight={1,5}]
+ ...
+ \stop<vimtyping>
+
+This will highlight lines 1 and 5 with gray background color. To change the
+highlight color use
+
+ \definevimtyping
+ [...]
+ [...
+ highlightcolor=<color>,
+ ...]
+
+where `<color>` is any valid ConTeXt color.
+
+**Note**: Currently, if you use `highlight` with `numbering=on`, each
+highlighted line will be numbered thrice (with the numbers overprinted on one
+another). This is because, internally, highlighting is implemented using text
+backgrounds and they do not work with line numbering.
+
+Messages and Tracing
+--------------------
+
+The vim module uses the filter module in the background. The filter module
+outputs some diagnostic information on the console output to indicate what is
+happening. For example, for each code snippet, you will see messages like
+
+ t-filter > command : vim -u NONE -e -s -C -n -c "set tabstop=4" -c "syntax on" -c "set syntax=scala" -c "let contextstartline=1" -c "let contextstopline=0" -c "source kpse:2context.vim" -c "qa" scala-temp-SCALA-0.tmp scala-temp-SCALA-0.vimout
+
+If, for some reason, the output file is not generated, or not found, a message
+similar to
+
+ t-filter > file matlab-temp-MATLAB-0.vimout cannot be found
+ t-filter > current filter : MATLAB
+ t-filter > base file : matlab-temp-MATLAB-0
+ t-filter > input file : matlab-temp-MATLAB-0.tmp
+ t-filter > output file : matlab-temp-MATLAB-0.vimout
+
+is displayed in the console. At the same time, the string
+
+ [[output file missing]]
+
+is displayed in the PDF output. This data, along with the filter command, is
+useful for debugging what whenwrong.
+
+Yes, on, whatever
+-----------------
+
+ConTeXt has two ways of indicating binary options:
+
+- `option=yes` and `option=no`
+- `option=on` and `option=off`
+
+The core commands freely switch between the two. In some cases, `option=yes` has
+a different meaning than `option=on`. To avoid confusion, I have made these
+synonyms. Thus, whenever the documentation says `option=yes`, you may use
+`option=on`. One less thing to worry about!
A bit of a history
------------------
@@ -329,3 +456,8 @@ in the module, except a few minor bug fixes.
Around June 2010, I decided to completely rewrite the module from scratch. The
new version of `t-vim` relies on `t-filter` for all the bookkeeping. As a
result, the module is smaller and more robust.
+
+TODO
+----
+
+- Fix line highlighting with highlight={list}