annotate runtime/doc/usr_05.txt @ 4687:79797c8534b5

Added tag v7-3-1090 for changeset 8db697ae406a
author Bram Moolenaar <bram@vim.org>
date Sat, 01 Jun 2013 23:02:55 +0200
parents fdb8a9c7bd91
children 6ec6b7ff2d43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3967
fdb8a9c7bd91 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
1 *usr_05.txt* For Vim version 7.3. Last change: 2012 Nov 20
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 Set your settings
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 Vim can be tuned to work like you want it to. This chapter shows you how to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 make Vim start with options set to different values. Add plugins to extend
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 43
diff changeset
10 Vim's capabilities. Or define your own macros.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 |05.1| The vimrc file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 |05.2| The example vimrc file explained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 |05.3| Simple mappings
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 |05.4| Adding a plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 |05.5| Adding a help file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 |05.6| The option window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 |05.7| Often used options
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_06.txt| Using syntax highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 Previous chapter: |usr_04.txt| Making small changes
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 *05.1* The vimrc file *vimrc-intro*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 You probably got tired of typing commands that you use very often. To start
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
28 Vim with all your favorite option settings and mappings, you write them in
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
29 what is called the vimrc file. Vim executes the commands in this file when it
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
30 starts up.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
32 If you already have a vimrc file (e.g., when your sysadmin has one setup for
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
33 you), you can edit it this way: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
35 :edit $MYVIMRC
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
36
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
37 If you don't have a vimrc file yet, see |vimrc| to find out where you can
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 create a vimrc file. Also, the ":version" command mentions the name of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 "user vimrc file" Vim looks for.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
41 For Unix and Macintosh this file is always used and is recommended:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
43 ~/.vimrc ~
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
45 For MS-DOS and MS-Windows you can use one of these:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
47 $HOME/_vimrc ~
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
48 $VIM/_vimrc ~
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 The vimrc file can contain all the commands that you type after a colon. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 most simple ones are for setting options. For example, if you want Vim to
3967
fdb8a9c7bd91 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
52 always start with the 'incsearch' option on, add this line your vimrc file: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 set incsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 For this new line to take effect you need to exit Vim and start it again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 Later you will learn how to do this without exiting Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 This chapter only explains the most basic items. For more information on how
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 to write a Vim script file: |usr_41.txt|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 *05.2* The example vimrc file explained *vimrc_example.vim*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 In the first chapter was explained how the example vimrc (included in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 Vim distribution) file can be used to make Vim startup in not-compatible mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 (see |not-compatible|). The file can be found here:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 $VIMRUNTIME/vimrc_example.vim ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 In this section we will explain the various commands used in this file. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 will give you hints about how to set up your own preferences. Not everything
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 will be explained though. Use the ":help" command to find out more.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 set nocompatible
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 As mentioned in the first chapter, these manuals explain Vim working in an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 improved way, thus not completely Vi compatible. Setting the 'compatible'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 option off, thus 'nocompatible' takes care of this.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 set backspace=indent,eol,start
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 This specifies where in Insert mode the <BS> is allowed to delete the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 character in front of the cursor. The three items, separated by commas, tell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 Vim to delete the white space at the start of the line, a line break and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 character before where Insert mode started.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 set autoindent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 This makes Vim use the indent of the previous line for a newly created line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 Thus there is the same amount of white space before the new line. For example
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 when pressing <Enter> in Insert mode, and when using the "o" command to open a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 new line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 if has("vms")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 set nobackup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 set backup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 This tells Vim to keep a backup copy of a file when overwriting it. But not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 on the VMS system, since it keeps old versions of files already. The backup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 file will have the same name as the original file with "~" added. See |07.4|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 set history=50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 Keep 50 commands and 50 search patterns in the history. Use another number if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 you want to remember fewer or more lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 set ruler
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 Always display the current cursor position in the lower right corner of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 Vim window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 set showcmd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 Display an incomplete command in the lower right corner of the Vim window,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 left of the ruler. For example, when you type "2f", Vim is waiting for you to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 type the character to find and "2f" is displayed. When you press "w" next,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 the "2fw" command is executed and the displayed "2f" is removed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 +-------------------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 |text in the Vim window |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 |-- VISUAL -- 2f 43,8 17% |
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 'showmode' 'showcmd' 'ruler'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 set incsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 Display the match for a search pattern when halfway typing it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 map Q gq
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 This defines a key mapping. More about that in the next section. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 defines the "Q" command to do formatting with the "gq" operator. This is how
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 it worked before Vim 5.0. Otherwise the "Q" command starts Ex mode, but you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 will not need it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 >
43
f55897d6921d updated for version 7.0026
vimboss
parents: 22
diff changeset
152 vnoremap _g y:exe "grep /" . escape(@", '\\/') . "/ *.c *.h"<CR>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153
43
f55897d6921d updated for version 7.0026
vimboss
parents: 22
diff changeset
154 This mapping yanks the visually selected text and searches for it in C files.
f55897d6921d updated for version 7.0026
vimboss
parents: 22
diff changeset
155 This is a complicated mapping. You can see that mappings can be used to do
f55897d6921d updated for version 7.0026
vimboss
parents: 22
diff changeset
156 quite complicated things. Still, it is just a sequence of commands that are
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 executed like you typed them.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 if &t_Co > 2 || has("gui_running")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 syntax on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 set hlsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 This switches on syntax highlighting, but only if colors are available. And
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 the 'hlsearch' option tells Vim to highlight matches with the last used search
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 pattern. The "if" command is very useful to set options only when some
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 condition is met. More about that in |usr_41.txt|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 *vimrc-filetype* >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 filetype plugin indent on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 This switches on three very clever mechanisms:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 1. Filetype detection.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 Whenever you start editing a file, Vim will try to figure out what kind of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 file this is. When you edit "main.c", Vim will see the ".c" extension and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 recognize this as a "c" filetype. When you edit a file that starts with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 "#!/bin/sh", Vim will recognize it as a "sh" filetype.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 The filetype detection is used for syntax highlighting and the other two
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 items below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 See |filetypes|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 2. Using filetype plugin files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 Many different filetypes are edited with different options. For example,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 when you edit a "c" file, it's very useful to set the 'cindent' option to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 automatically indent the lines. These commonly useful option settings are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 included with Vim in filetype plugins. You can also add your own, see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 |write-filetype-plugin|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 3. Using indent files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 When editing programs, the indent of a line can often be computed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 automatically. Vim comes with these indent rules for a number of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 filetypes. See |:filetype-indent-on| and 'indentexpr'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 autocmd FileType text setlocal textwidth=78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 This makes Vim break text to avoid lines getting longer than 78 characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 But only for files that have been detected to be plain text. There are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 actually two parts here. "autocmd FileType text" is an autocommand. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 defines that when the file type is set to "text" the following command is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 automatically executed. "setlocal textwidth=78" sets the 'textwidth' option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 to 78, but only locally in one file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 874
diff changeset
205 *restore-cursor* >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 autocmd BufReadPost *
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
207 \ if line("'\"") > 1 && line("'\"") <= line("$") |
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
208 \ exe "normal! g`\"" |
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 \ endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 Another autocommand. This time it is used after reading any file. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 complicated stuff after it checks if the '" mark is defined, and jumps to it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 if so. The backslash at the start of a line is used to continue the command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 from the previous line. That avoids a line getting very long.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 See |line-continuation|. This only works in a Vim script file, not when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 typing commands at the command-line.
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 *05.3* Simple mappings
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 A mapping enables you to bind a set of Vim commands to a single key. Suppose,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 for example, that you need to surround certain words with curly braces. In
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 other words, you need to change a word such as "amount" into "{amount}". With
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 the :map command, you can tell Vim that the F5 key does this job. The command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 is as follows: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 :map <F5> i{<Esc>ea}<Esc>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 Note:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 When entering this command, you must enter <F5> by typing four
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 characters. Similarly, <Esc> is not entered by pressing the <Esc>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 key, but by typing five characters. Watch out for this difference
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 when reading the manual!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 Let's break this down:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 <F5> The F5 function key. This is the trigger key that causes the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 command to be executed as the key is pressed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 i{<Esc> Insert the { character. The <Esc> key ends Insert mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 e Move to the end of the word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 a}<Esc> Append the } to the word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 After you execute the ":map" command, all you have to do to put {} around a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 word is to put the cursor on the first character and press F5.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 In this example, the trigger is a single key; it can be any string. But when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 you use an existing Vim command, that command will no longer be available.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 You better avoid that.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 One key that can be used with mappings is the backslash. Since you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 probably want to define more than one mapping, add another character. You
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 43
diff changeset
253 could map "\p" to add parentheses around a word, and "\c" to add curly braces,
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 43
diff changeset
254 for example: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 :map \p i(<Esc>ea)<Esc>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 :map \c i{<Esc>ea}<Esc>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 You need to type the \ and the p quickly after another, so that Vim knows they
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 belong together.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 The ":map" command (with no arguments) lists your current mappings. At
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 least the ones for Normal mode. More about mappings in section |40.1|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 *05.4* Adding a plugin *add-plugin* *plugin*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 Vim's functionality can be extended by adding plugins. A plugin is nothing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 more than a Vim script file that is loaded automatically when Vim starts. You
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 can add a plugin very easily by dropping it in your plugin directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 {not available when Vim was compiled without the |+eval| feature}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 There are two types of plugins:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 global plugin: Used for all kinds of files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 filetype plugin: Only used for a specific type of file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 The global plugins will be discussed first, then the filetype ones
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 |add-filetype-plugin|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 GLOBAL PLUGINS *standard-plugin*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 When you start Vim, it will automatically load a number of global plugins.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 You don't have to do anything for this. They add functionality that most
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 people will want to use, but which was implemented as a Vim script instead of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 being compiled into Vim. You can find them listed in the help index
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 |standard-plugin-list|. Also see |load-plugins|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 *add-global-plugin*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 You can add a global plugin to add functionality that will always be present
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 when you use Vim. There are only two steps for adding a global plugin:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 1. Get a copy of the plugin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 2. Drop it in the right directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 GETTING A GLOBAL PLUGIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 Where can you find plugins?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 - Some come with Vim. You can find them in the directory $VIMRUNTIME/macros
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 and its sub-directories.
800
d8f905020502 updated for version 7.0b
vimboss
parents: 548
diff changeset
302 - Download from the net. There is a large collection on http://www.vim.org.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 - They are sometimes posted in a Vim |maillist|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 - You could write one yourself, see |write-plugin|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305
800
d8f905020502 updated for version 7.0b
vimboss
parents: 548
diff changeset
306 Some plugins come as a vimball archive, see |vimball|.
d8f905020502 updated for version 7.0b
vimboss
parents: 548
diff changeset
307 Some plugins can be updated automatically, see |getscript|.
d8f905020502 updated for version 7.0b
vimboss
parents: 548
diff changeset
308
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 USING A GLOBAL PLUGIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 First read the text in the plugin itself to check for any special conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 Then copy the file to your plugin directory:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 system plugin directory ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 Unix ~/.vim/plugin/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 PC and OS/2 $HOME/vimfiles/plugin or $VIM/vimfiles/plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 Amiga s:vimfiles/plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 Macintosh $VIM:vimfiles:plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 Mac OS X ~/.vim/plugin/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 RISC-OS Choices:vimfiles.plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 Example for Unix (assuming you didn't have a plugin directory yet): >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 mkdir ~/.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 mkdir ~/.vim/plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 cp /usr/local/share/vim/vim60/macros/justify.vim ~/.vim/plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 That's all! Now you can use the commands defined in this plugin to justify
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331
548
f43150a669dc updated for version 7.0155
vimboss
parents: 541
diff changeset
332 Instead of putting plugins directly into the plugin/ directory, you may
f43150a669dc updated for version 7.0155
vimboss
parents: 541
diff changeset
333 better organize them by putting them into subdirectories under plugin/.
f43150a669dc updated for version 7.0155
vimboss
parents: 541
diff changeset
334 As an example, consider using "~/.vim/plugin/perl/*.vim" for all your Perl
f43150a669dc updated for version 7.0155
vimboss
parents: 541
diff changeset
335 plugins.
541
3e19ea54eb07 updated for version 7.0153
vimboss
parents: 164
diff changeset
336
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 FILETYPE PLUGINS *add-filetype-plugin* *ftplugins*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 The Vim distribution comes with a set of plugins for different filetypes that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 you can start using with this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 :filetype plugin on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 That's all! See |vimrc-filetype|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 If you are missing a plugin for a filetype you are using, or you found a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 better one, you can add it. There are two steps for adding a filetype plugin:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 1. Get a copy of the plugin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 2. Drop it in the right directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 GETTING A FILETYPE PLUGIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 You can find them in the same places as the global plugins. Watch out if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 type of file is mentioned, then you know if the plugin is a global or a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 filetype one. The scripts in $VIMRUNTIME/macros are global ones, the filetype
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 plugins are in $VIMRUNTIME/ftplugin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 USING A FILETYPE PLUGIN *ftplugin-name*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 You can add a filetype plugin by dropping it in the right directory. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 name of this directory is in the same directory mentioned above for global
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 plugins, but the last part is "ftplugin". Suppose you have found a plugin for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 the "stuff" filetype, and you are on Unix. Then you can move this file to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 ftplugin directory: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 mv thefile ~/.vim/ftplugin/stuff.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 If that file already exists you already have a plugin for "stuff". You might
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 want to check if the existing plugin doesn't conflict with the one you are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 adding. If it's OK, you can give the new one another name: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 mv thefile ~/.vim/ftplugin/stuff_too.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 The underscore is used to separate the name of the filetype from the rest,
10
4e2284e71352 updated for version 7.0002
vimboss
parents: 7
diff changeset
378 which can be anything. If you use "otherstuff.vim" it wouldn't work, it would
4e2284e71352 updated for version 7.0002
vimboss
parents: 7
diff changeset
379 be loaded for the "otherstuff" filetype.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 On MS-DOS you cannot use long filenames. You would run into trouble if you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 add a second plugin and the filetype has more than six characters. You can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 use an extra directory to get around this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 mkdir $VIM/vimfiles/ftplugin/fortran
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 copy thefile $VIM/vimfiles/ftplugin/fortran/too.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 The generic names for the filetype plugins are: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 ftplugin/<filetype>.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 ftplugin/<filetype>_<name>.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 ftplugin/<filetype>/<name>.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 Here "<name>" can be any name that you prefer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 Examples for the "stuff" filetype on Unix: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 ~/.vim/ftplugin/stuff.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 ~/.vim/ftplugin/stuff_def.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 ~/.vim/ftplugin/stuff/header.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 The <filetype> part is the name of the filetype the plugin is to be used for.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 Only files of this filetype will use the settings from the plugin. The <name>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 part of the plugin file doesn't matter, you can use it to have several plugins
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 for the same filetype. Note that it must end in ".vim".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 Further reading:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 |filetype-plugins| Documentation for the filetype plugins and information
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 about how to avoid that mappings cause problems.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 |load-plugins| When the global plugins are loaded during startup.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 |ftplugin-overrule| Overruling the settings from a global plugin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 |write-plugin| How to write a plugin script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 |plugin-details| For more information about using plugins or when your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 plugin doesn't work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 |new-filetype| How to detect a new file type.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 *05.5* Adding a help file *add-local-help* *matchit-install*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 If you are lucky, the plugin you installed also comes with a help file. We
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 will explain how to install the help file, so that you can easily find help
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 for your new plugin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 Let us use the "matchit.vim" plugin as an example (it is included with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 Vim). This plugin makes the "%" command jump to matching HTML tags,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 if/else/endif in Vim scripts, etc. Very useful, although it's not backwards
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 compatible (that's why it is not enabled by default).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 This plugin comes with documentation: "matchit.txt". Let's first copy the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 plugin to the right directory. This time we will do it from inside Vim, so
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 that we can use $VIMRUNTIME. (You may skip some of the "mkdir" commands if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 you already have the directory.) >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 :!mkdir ~/.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 :!mkdir ~/.vim/plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 :!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 10
diff changeset
436 The "cp" command is for Unix, on MS-DOS you can use "copy".
cc049b00ee70 updated for version 7.0014
vimboss
parents: 10
diff changeset
437
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 Now create a "doc" directory in one of the directories in 'runtimepath'. >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 :!mkdir ~/.vim/doc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 Copy the help file to the "doc" directory. >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 :!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 Now comes the trick, which allows you to jump to the subjects in the new help
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 file: Generate the local tags file with the |:helptags| command. >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 :helptags ~/.vim/doc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 Now you can use the >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 :help g%
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 command to find help for "g%" in the help file you just added. You can see an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 entry for the local help file when you do: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 :help local-additions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 The title lines from the local help files are automagically added to this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 section. There you can see which local help files have been added and jump to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 them through the tag.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 For writing a local help file, see |write-local-help|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 *05.6* The option window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 If you are looking for an option that does what you want, you can search in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 the help files here: |options|. Another way is by using this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 :options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 This opens a new window, with a list of options with a one-line explanation.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 The options are grouped by subject. Move the cursor to a subject and press
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 <Enter> to jump there. Press <Enter> again to jump back. Or use CTRL-O.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 You can change the value of an option. For example, move to the "displaying
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 text" subject. Then move the cursor down to this line:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 set wrap nowrap ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 When you hit <Enter>, the line will change to:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 set nowrap wrap ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 The option has now been switched off.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 Just above this line is a short description of the 'wrap' option. Move the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 cursor one line up to place it in this line. Now hit <Enter> and you jump to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 the full help on the 'wrap' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 For options that take a number or string argument you can edit the value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 Then press <Enter> to apply the new value. For example, move the cursor a few
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 lines up to this line:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 set so=0 ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 Position the cursor on the zero with "$". Change it into a five with "r5".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 Then press <Enter> to apply the new value. When you now move the cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 around you will notice that the text starts scrolling before you reach the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 border. This is what the 'scrolloff' option does, it specifies an offset
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 from the window border where scrolling starts.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 *05.7* Often used options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 There are an awful lot of options. Most of them you will hardly ever use.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 Some of the more useful ones will be mentioned here. Don't forget you can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 find more help on these options with the ":help" command, with single quotes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 before and after the option name. For example: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 :help 'wrap'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 In case you have messed up an option value, you can set it back to the
10
4e2284e71352 updated for version 7.0002
vimboss
parents: 7
diff changeset
516 default by putting an ampersand (&) after the option name. Example: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 :set iskeyword&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 NOT WRAPPING LINES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 Vim normally wraps long lines, so that you can see all of the text. Sometimes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 it's better to let the text continue right of the window. Then you need to
10
4e2284e71352 updated for version 7.0002
vimboss
parents: 7
diff changeset
525 scroll the text left-right to see all of a long line. Switch wrapping off
4e2284e71352 updated for version 7.0002
vimboss
parents: 7
diff changeset
526 with this command: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 :set nowrap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 Vim will automatically scroll the text when you move to text that is not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 displayed. To see a context of ten characters, do this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 :set sidescroll=10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 This doesn't change the text in the file, only the way it is displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 WRAPPING MOVEMENT COMMANDS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 Most commands for moving around will stop moving at the start and end of a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 line. You can change that with the 'whichwrap' option. This sets it to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 default value: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 :set whichwrap=b,s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 This allows the <BS> key, when used in the first position of a line, to move
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 the cursor to the end of the previous line. And the <Space> key moves from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 the end of a line to the start of the next one.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 To allow the cursor keys <Left> and <Right> to also wrap, use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 :set whichwrap=b,s,<,>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 This is still only for Normal mode. To let <Left> and <Right> do this in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 Insert mode as well: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 :set whichwrap=b,s,<,>,[,]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 There are a few other flags that can be added, see 'whichwrap'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 VIEWING TABS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 When there are tabs in a file, you cannot see where they are. To make them
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 visible: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 :set list
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568
1278
f9537da5e66d updated for version 7.1
vimboss
parents: 1226
diff changeset
569 Now every tab is displayed as ^I. And a $ is displayed at the end of each
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 line, so that you can spot trailing spaces that would otherwise go unnoticed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 A disadvantage is that this looks ugly when there are many Tabs in a file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 If you have a color terminal, or are using the GUI, Vim can show the spaces
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 and tabs as highlighted characters. Use the 'listchars' option: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 :set listchars=tab:>-,trail:-
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 Now every tab will be displayed as ">---" (with more or less "-") and trailing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 white space as "-". Looks a lot better, doesn't it?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 KEYWORDS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 The 'iskeyword' option specifies which characters can appear in a word: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 :set iskeyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 < iskeyword=@,48-57,_,192-255 ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 The "@" stands for all alphabetic letters. "48-57" stands for ASCII
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 characters 48 to 57, which are the numbers 0 to 9. "192-255" are the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 printable latin characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 Sometimes you will want to include a dash in keywords, so that commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 like "w" consider "upper-case" to be one word. You can do it like this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 :set iskeyword+=-
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 :set iskeyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 < iskeyword=@,48-57,_,192-255,- ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 If you look at the new value, you will see that Vim has added a comma for you.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 To remove a character use "-=". For example, to remove the underscore: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 :set iskeyword-=_
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 :set iskeyword
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 < iskeyword=@,48-57,192-255,- ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 This time a comma is automatically deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 ROOM FOR MESSAGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 When Vim starts there is one line at the bottom that is used for messages.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 When a message is long, it is either truncated, thus you can only see part of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 it, or the text scrolls and you have to press <Enter> to continue.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 You can set the 'cmdheight' option to the number of lines used for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 messages. Example: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 :set cmdheight=3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 This does mean there is less room to edit text, thus it's a compromise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 Next chapter: |usr_06.txt| Using syntax highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: