comparison runtime/doc/syntax.txt @ 7384:aea5ebf352c4

commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 29 19:10:25 2015 +0100 Updated runtime files.
author Christian Brabandt <cb@256bit.org>
date Tue, 29 Dec 2015 19:15:06 +0100
parents 873eae260c97
children 61354fabf8a2
comparison
equal deleted inserted replaced
7383:377a68b9fa06 7384:aea5ebf352c4
1 *syntax.txt* For Vim version 7.4. Last change: 2015 Nov 05 1 *syntax.txt* For Vim version 7.4. Last change: 2015 Dec 19
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1436 in your .vimrc prior to the :syntax on command. If you always use fixed source 1436 in your .vimrc prior to the :syntax on command. If you always use fixed source
1437 form, then > 1437 form, then >
1438 :let fortran_fixed_source=1 1438 :let fortran_fixed_source=1
1439 in your .vimrc prior to the :syntax on command. 1439 in your .vimrc prior to the :syntax on command.
1440 1440
1441 If the form of the source code depends upon the file extension, then it is 1441 If the form of the source code depends, in a non-standard way, upon the file
1442 most convenient to set fortran_free_source in a ftplugin file. For more 1442 extension, then it is most convenient to set fortran_free_source in a ftplugin
1443 information on ftplugin files, see |ftplugin|. For example, if all your 1443 file. For more information on ftplugin files, see |ftplugin|. Note that this
1444 fortran files with an .f90 extension are written in free source form and the 1444 will work only if the "filetype plugin indent on" command precedes the "syntax
1445 rest in fixed source form, add the following code to your ftplugin file > 1445 on" command in your .vimrc file.
1446 let s:extfname = expand("%:e")
1447 if s:extfname ==? "f90"
1448 let fortran_free_source=1
1449 unlet! fortran_fixed_source
1450 else
1451 let fortran_fixed_source=1
1452 unlet! fortran_free_source
1453 endif
1454 Note that this will work only if the "filetype plugin indent on" command
1455 precedes the "syntax on" command in your .vimrc file.
1456 1446
1457 When you edit an existing fortran file, the syntax script will assume free 1447 When you edit an existing fortran file, the syntax script will assume free
1458 source form if the fortran_free_source variable has been set, and assumes 1448 source form if the fortran_free_source variable has been set, and assumes
1459 fixed source form if the fortran_fixed_source variable has been set. If 1449 fixed source form if the fortran_fixed_source variable has been set. If
1460 neither of these variables have been set, the syntax script attempts to 1450 neither of these variables have been set, the syntax script attempts to
1461 determine which source form has been used by examining the first five columns 1451 determine which source form has been used by examining the file extension
1462 of the first 250 lines of your file. If no signs of free source form are 1452 using conventions common to the ifort, gfortran, Cray, NAG, and PathScale
1463 detected, then the file is assumed to be in fixed source form. The algorithm 1453 compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for
1464 should work in the vast majority of cases. In some cases, such as a file that 1454 free-source). If none of this works, then the script examines the first five
1465 begins with 250 or more full-line comments, the script may incorrectly decide 1455 columns of the first 500 lines of your file. If no signs of free source form
1466 that the fortran code is in fixed form. If that happens, just add a 1456 are detected, then the file is assumed to be in fixed source form. The
1467 non-comment statement beginning anywhere in the first five columns of the 1457 algorithm should work in the vast majority of cases. In some cases, such as a
1468 first twenty five lines, save (:w) and then reload (:e!) the file. 1458 file that begins with 500 or more full-line comments, the script may
1459 incorrectly decide that the fortran code is in fixed form. If that happens,
1460 just add a non-comment statement beginning anywhere in the first five columns
1461 of the first twenty five lines, save (:w) and then reload (:e!) the file.
1469 1462
1470 Tabs in fortran files ~ 1463 Tabs in fortran files ~
1471 Tabs are not recognized by the Fortran standards. Tabs are not a good idea in 1464 Tabs are not recognized by the Fortran standards. Tabs are not a good idea in
1472 fixed format fortran source code which requires fixed column boundaries. 1465 fixed format fortran source code which requires fixed column boundaries.
1473 Therefore, tabs are marked as errors. Nevertheless, some programmers like 1466 Therefore, tabs are marked as errors. Nevertheless, some programmers like