comparison runtime/doc/insert.txt @ 702:8a99b25de218

updated for version 7.0212
author vimboss
date Thu, 02 Mar 2006 22:43:39 +0000
parents f1b013312711
children 1babf94e0b24
comparison
equal deleted inserted replaced
701:4cf1c5977c35 702:8a99b25de218
1 *insert.txt* For Vim version 7.0aa. Last change: 2006 Feb 23 1 *insert.txt* For Vim version 7.0aa. Last change: 2006 Mar 02
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1242 SYNTAX *ft-syntax-omni* 1242 SYNTAX *ft-syntax-omni*
1243 1243
1244 This uses the current syntax highlighting for completion. It can be used for 1244 This uses the current syntax highlighting for completion. It can be used for
1245 any filetype and provides a minimal language-sensitive completion. 1245 any filetype and provides a minimal language-sensitive completion.
1246 1246
1247 To enable code completion do: > 1247 To enable syntax code completion you can run: >
1248 source $VIMRUNTIME/autoload/syntaxcomplete.vim 1248 setlocal omnifunc=syntaxcomplete#Complete
1249 1249
1250 You can automate this by placing this in your vimrc (after any ":filetype" 1250 You can automate this by placing the following in your vimrc (after any
1251 command): > 1251 ":filetype" command): >
1252 autocmd Filetype * 1252 if has("autocmd") && exists("+omnifunc")
1253 \ if exists('&ofu') && &ofu == "" | 1253 autocmd Filetype *
1254 \ source $VIMRUNTIME/autoload/syntaxcomplete.vim | 1254 \ if &omnifunc == "" |
1255 \ endif 1255 \ setlocal omnifunc=syntaxcomplete#Complete |
1256 1256 \ endif
1257 The above will set completion to this script only if a proper one does not 1257 endif
1258 already exist for that filetype. 1258
1259 The above will set completion to this script only if a specific plugin does
1260 not already exist for that filetype.
1261
1262 Each filetype can have a wide range of syntax items. The plugin allows you to
1263 customize which syntax groups to include or exclude from the list. Let's have
1264 a look at the PHP filetype to see how this works.
1265
1266 If you edit a file called, index.php, run the following command: >
1267 :syntax list
1268
1269 First thing you will notice is there are many different syntax groups. The
1270 PHP language can include elements from different languages like HTML,
1271 JavaScript and many more. The syntax plugin will only include syntax groups
1272 that begin with the filetype, "php", in this case. For example these syntax
1273 groups are included by default with the PHP: phpEnvVar, phpIntVar,
1274 phpFunctions.
1275
1276 The PHP language has an enormous number of items which it knows how to syntax
1277 highlight. This means these items will be available within the omni
1278 completion list. Some people may find this list unwieldy or are only
1279 interested in certain items.
1280
1281 There are two ways to prune this list (if necessary). If you find certain
1282 syntax groups you do not wish displayed you can add the following to your
1283 vimrc: >
1284 let g:omni_syntax_group_exclude_php = 'phpCoreConstant,phpConstant'
1285
1286 Add as many syntax groups to this list by comma separating them. The basic
1287 form of this variable is: >
1288 let g:omni_syntax_group_exclude_{filetype} = 'comma,separated,list'
1289
1290 For completeness the opposite is also true. Creating this variable in your
1291 vimrc will only include the items in the phpFunctions and phpMethods syntax
1292 groups: >
1293 let g:omni_syntax_group_include_php = 'phpFunctions,phpMethods'
1294
1295 You can create as many of these variables as you need, varying only the
1296 filetype at the end of the variable name.
1259 1297
1260 1298
1261 XML *ft-xml-omni* 1299 XML *ft-xml-omni*
1262 1300
1263 Vim 7 provides mechanism to context aware completion of XML files. It depends 1301 Vim 7 provides mechanism to context aware completion of XML files. It depends