annotate runtime/doc/usr_06.txt @ 7224:42bf8902d4da v7.4.921

commit https://github.com/vim/vim/commit/cd1c55f706c2f9b8310b8a9fc1f8226c7fd19372 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 10 20:52:04 2015 +0100 patch 7.4.921 Problem: Missing proto file update. (Randall W. Morris) Solution: Add the missing line for mch_ishidden.
author Christian Brabandt <cb@256bit.org>
date Tue, 10 Nov 2015 21:00:05 +0100
parents 359743c1f59a
children 9f48eab77d62
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5294
359743c1f59a release version 7.4
Bram Moolenaar <bram@vim.org>
parents: 5247
diff changeset
1 *usr_06.txt* For Vim version 7.4. Last change: 2009 Oct 28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 VIM USER MANUAL - by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 Using syntax highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 Black and white text is boring. With colors your file comes to life. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 not only looks nice, it also speeds up your work. Change the colors used for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 the different sorts of text. Print your text, with the colors you see on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 |06.1| Switching it on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 |06.2| No or wrong colors?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 |06.3| Different colors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 |06.4| With colors or without colors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 |06.5| Printing with colors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 |06.6| Further reading
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 Next chapter: |usr_07.txt| Editing more than one file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 Previous chapter: |usr_05.txt| Set your settings
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 Table of contents: |usr_toc.txt|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 *06.1* Switching it on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 It all starts with one simple command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 :syntax enable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 That should work in most situations to get color in your files. Vim will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 automagically detect the type of file and load the right syntax highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 Suddenly comments are blue, keywords brown and strings red. This makes it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 easy to overview the file. After a while you will find that black&white text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 slows you down!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 If you always want to use syntax highlighting, put the ":syntax enable"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 command in your |vimrc| file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 If you want syntax highlighting only when the terminal supports colors, you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 can put this in your |vimrc| file: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 if &t_Co > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syntax enable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 If you want syntax highlighting only in the GUI version, put the ":syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 enable" command in your |gvimrc| file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 *06.2* No or wrong colors?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 There can be a number of reasons why you don't see colors:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 - Your terminal does not support colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 Vim will use bold, italic and underlined text, but this doesn't look
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 very nice. You probably will want to try to get a terminal with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 colors. For Unix, I recommend the xterm from the XFree86 project:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 |xfree-xterm|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 - Your terminal does support colors, but Vim doesn't know this.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 Make sure your $TERM setting is correct. For example, when using an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 xterm that supports colors: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 setenv TERM xterm-color
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 or (depending on your shell): >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 TERM=xterm-color; export TERM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 < The terminal name must match the terminal you are using. If it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 still doesn't work, have a look at |xterm-color|, which shows a few
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 ways to make Vim display colors (not only for an xterm).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 - The file type is not recognized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 Vim doesn't know all file types, and sometimes it's near to impossible
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 to tell what language a file uses. Try this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 :set filetype
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 If the result is "filetype=" then the problem is indeed that Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 doesn't know what type of file this is. You can set the type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 manually: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 :set filetype=fortran
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 < To see which types are available, look in the directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 $VIMRUNTIME/syntax. For the GUI you can use the Syntax menu.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 Setting the filetype can also be done with a |modeline|, so that the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 file will be highlighted each time you edit it. For example, this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 line can be used in a Makefile (put it near the start or end of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 file): >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 # vim: syntax=make
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 < You might know how to detect the file type yourself. Often the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 name extension (after the dot) can be used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 See |new-filetype| for how to tell Vim to detect that file type.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 - There is no highlighting for your file type.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 You could try using a similar file type by manually setting it as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 mentioned above. If that isn't good enough, you can write your own
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syntax file, see |mysyntaxfile|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 Or the colors could be wrong:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 - The colored text is very hard to read.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 Vim guesses the background color that you are using. If it is black
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 (or another dark color) it will use light colors for text. If it is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 white (or another light color) it will use dark colors for text. If
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 Vim guessed wrong the text will be hard to read. To solve this, set
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 the 'background' option. For a dark background: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 :set background=dark
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 < And for a light background: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 :set background=light
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 < Make sure you put this _before_ the ":syntax enable" command,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 otherwise the colors will already have been set. You could do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 ":syntax reset" after setting 'background' to make Vim set the default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 colors again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 - The colors are wrong when scrolling bottom to top.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 Vim doesn't read the whole file to parse the text. It starts parsing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 wherever you are viewing the file. That saves a lot of time, but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 sometimes the colors are wrong. A simple fix is hitting CTRL-L. Or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 scroll back a bit and then forward again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 For a real fix, see |:syn-sync|. Some syntax files have a way to make
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 it look further back, see the help for the specific syntax file. For
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 example, |tex.vim| for the TeX syntax.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 *06.3* Different colors *:syn-default-override*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 If you don't like the default colors, you can select another color scheme. In
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 the GUI use the Edit/Color Scheme menu. You can also type the command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 :colorscheme evening
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 "evening" is the name of the color scheme. There are several others you might
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 want to try out. Look in the directory $VIMRUNTIME/colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 When you found the color scheme that you like, add the ":colorscheme" command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 to your |vimrc| file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 You could also write your own color scheme. This is how you do it:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 1. Select a color scheme that comes close. Copy this file to your own Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 directory. For Unix, this should work: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 !mkdir ~/.vim/colors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 !cp $VIMRUNTIME/colors/morning.vim ~/.vim/colors/mine.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 This is done from Vim, because it knows the value of $VIMRUNTIME.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 2. Edit the color scheme file. These entries are useful:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 term attributes in a B&W terminal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 cterm attributes in a color terminal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 ctermfg foreground color in a color terminal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 ctermbg background color in a color terminal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 gui attributes in the GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 guifg foreground color in the GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 guibg background color in the GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 For example, to make comments green: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 :highlight Comment ctermfg=green guifg=green
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 Attributes you can use for "cterm" and "gui" are "bold" and "underline".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 If you want both, use "bold,underline". For details see the |:highlight|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 3. Tell Vim to always use your color scheme. Put this line in your |vimrc|: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 colorscheme mine
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 If you want to see what the most often used color combinations look like, use
671
83a006f81bac updated for version 7.0199
vimboss
parents: 7
diff changeset
182 this command: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
671
83a006f81bac updated for version 7.0199
vimboss
parents: 7
diff changeset
184 :runtime syntax/colortest.vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 You will see text in various color combinations. You can check which ones are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 readable and look nice.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 *06.4* With colors or without colors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 Displaying text in color takes a lot of effort. If you find the displaying
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 too slow, you might want to disable syntax highlighting for a moment: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 :syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 When editing another file (or the same one) the colors will come back.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 *:syn-off*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 If you want to stop highlighting completely use: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 :syntax off
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 This will completely disable syntax highlighting and remove it immediately for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 all buffers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 *:syn-manual*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 If you want syntax highlighting only for specific files, use this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 :syntax manual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 This will enable the syntax highlighting, but not switch it on automatically
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 when starting to edit a buffer. To switch highlighting on for the current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 buffer, set the 'syntax' option: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 :set syntax=ON
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 *06.5* Printing with colors *syntax-printing*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 In the MS-Windows version you can print the current file with this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 :hardcopy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 You will get the usual printer dialog, where you can select the printer and a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 few settings. If you have a color printer, the paper output should look the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 same as what you see inside Vim. But when you use a dark background the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 colors will be adjusted to look good on white paper.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 There are several options that change the way Vim prints:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 'printdevice'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 'printheader'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 'printfont'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 'printoptions'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 To print only a range of lines, use Visual mode to select the lines and then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 type the command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 v100j:hardcopy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 "v" starts Visual mode. "100j" moves a hundred lines down, they will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 highlighted. Then ":hardcopy" will print those lines. You can use other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 commands to move in Visual mode, of course.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 This also works on Unix, if you have a PostScript printer. Otherwise, you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 will have to do a bit more work. You need to convert the text to HTML first,
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
247 and then print it from a web browser.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 Convert the current file to HTML with this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
251 :TOhtml
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
252
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
253 In case that doesn't work: >
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
254
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 :source $VIMRUNTIME/syntax/2html.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 You will see it crunching away, this can take quite a while for a large file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 Some time later another window shows the HTML code. Now write this somewhere
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 (doesn't matter where, you throw it away later):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 :write main.c.html
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 Open this file in your favorite browser and print it from there. If all goes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 well, the output should look exactly as it does in Vim. See |2html.vim| for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 details. Don't forget to delete the HTML file when you are done with it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 Instead of printing, you could also put the HTML file on a web server, and let
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 others look at the colored text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 *06.6* Further reading
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 |usr_44.txt| Your own syntax highlighted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 |syntax| All the details.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 Next chapter: |usr_07.txt| Editing more than one file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: