develop.txt (27610B)
1 *develop.txt* For Vim version 9.2. Last change: 2026 Feb 14 2 3 4 VIM REFERENCE MANUAL by Bram Moolenaar 5 6 7 Development of Vim. *development* 8 9 This text is important for those who want to be involved in further developing 10 Vim. 11 12 1. Design goals |design-goals| 13 2. Design decisions |design-decisions| 14 3. Assumptions |design-assumptions| 15 4. Coding style |coding-style| 16 5. Policy |design-policy| 17 18 See the file README.txt in the "src" directory for an overview of the source 19 code. 20 21 Vim is open source software. Everybody is encouraged to contribute to help 22 improving Vim. For sending patches a unified diff "diff -u" is preferred. 23 You can create a pull request on github, but it's not required. 24 Also see http://vim.wikia.com/wiki/How_to_make_and_submit_a_patch. 25 26 ============================================================================== 27 1. Design goals *design-goals* 28 29 Most important things come first (roughly). 30 31 Note that quite a few items are contradicting. This is intentional. A 32 balance must be found between them. 33 34 35 VIM IS... VI COMPATIBLE *design-compatible* 36 37 First of all, it should be possible to use Vim as a drop-in replacement for 38 Vi. When the user wants to, Vim can be used in compatible mode and hardly 39 any differences with the original Vi will be noticed. 40 41 Exceptions: 42 - We don't reproduce obvious Vi bugs in Vim. 43 - There are different versions of Vi. I am using Version 3.7 (6/7/85) as a 44 reference. But support for other versions is also included when possible. 45 The Vi part of POSIX is not considered a definitive source. 46 - Vim adds new commands, you cannot rely on some command to fail because it 47 didn't exist in Vi. 48 - Vim will have a lot of features that Vi doesn't have. Going back from Vim 49 to Vi will be a problem, this cannot be avoided. 50 - Some things are hardly ever used (open mode, sending an e-mail when 51 crashing, etc.). Those will only be included when someone has a good reason 52 why it should be included and it's not too much work. 53 - For some items it is debatable whether Vi compatibility should be 54 maintained. There will be an option flag for these. 55 56 57 VIM IS... IMPROVED *design-improved* 58 59 The IMproved bits of Vim should make it a better Vi, without becoming a 60 completely different editor. Extensions are done with a "Vi spirit". 61 - Use the keyboard as much as feasible. The mouse requires a third hand, 62 which we don't have. Many terminals don't have a mouse. 63 - When the mouse is used anyway, avoid the need to switch back to the 64 keyboard. Avoid mixing mouse and keyboard handling. 65 - Add commands and options in a consistent way. Otherwise people will have a 66 hard time finding and remembering them. Keep in mind that more commands and 67 options will be added later. 68 - A feature that people do not know about is a useless feature. Don't add 69 obscure features, or at least add hints in documentation that they exist. 70 - Minimize using CTRL and other modifiers, they are more difficult to type. 71 - There are many first-time and inexperienced Vim users. Make it easy for 72 them to start using Vim and learn more over time. 73 - There is no limit to the features that can be added. Selecting new features 74 is one based on (1) what users ask for, (2) how much effort it takes to 75 implement and (3) someone actually implementing it. 76 77 78 VIM IS... MULTI PLATFORM *design-multi-platform* 79 80 Vim tries to help as many users on as many platforms as possible. 81 - Support many kinds of terminals. The minimal demands are cursor positioning 82 and clear-screen. Commands should only use key strokes that most keyboards 83 have. Support all the keys on the keyboard for mapping. 84 - Support many platforms. A condition is that there is someone willing to do 85 Vim development on that platform, and it doesn't mean messing up the code. 86 - Support many compilers and libraries. Not everybody is able or allowed to 87 install another compiler or GUI library. 88 - People switch from one platform to another, and from GUI to terminal 89 version. Features should be present in all versions, or at least in as many 90 as possible with a reasonable effort. Try to avoid that users must switch 91 between platforms to accomplish their work efficiently. 92 - That a feature is not possible on some platforms, or only possible on one 93 platform, does not mean it cannot be implemented. [This intentionally 94 contradicts the previous item, these two must be balanced.] 95 96 97 VIM IS... WELL DOCUMENTED *design-documented* 98 99 - A feature that isn't documented is a useless feature. A patch for a new 100 feature must include the documentation. 101 - Documentation should be comprehensive and understandable. Using examples is 102 recommended. 103 - Don't make the text unnecessarily long. Less documentation means that an 104 item is easier to find. 105 106 107 VIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size* 108 109 Using Vim must not be a big attack on system resources. Keep it small and 110 fast. 111 - Computers are becoming faster and bigger each year. Vim can grow too, but 112 no faster than computers are growing. Keep Vim usable on older systems. 113 - Many users start Vim from a shell very often. Startup time must be short. 114 - Commands must work efficiently. The time they consume must be as small as 115 possible. Useful commands may take longer. 116 - Don't forget that some people use Vim over a slow connection. Minimize the 117 communication overhead. 118 - Items that add considerably to the size and are not used by many people 119 should be a feature that can be disabled. 120 - Vim is a component among other components. Don't turn it into a massive 121 application, but have it work well together with other programs. 122 123 124 VIM IS... MAINTAINABLE *design-maintain* 125 126 - The source code should not become a mess. It should be reliable code. 127 - Use the same layout in all files to make it easy to read |coding-style|. 128 - Use comments in a useful way! Quoting the function name and argument names 129 is NOT useful. Do explain what they are for. 130 - Porting to another platform should be made easy, without having to change 131 too much platform-independent code. 132 - Use the object-oriented spirit: Put data and code together. Minimize the 133 knowledge spread to other parts of the code. 134 135 136 VIM IS... FLEXIBLE *design-flexible* 137 138 Vim should make it easy for users to work in their preferred styles rather 139 than coercing its users into particular patterns of work. This can be for 140 items with a large impact (e.g., the 'compatible' option) or for details. The 141 defaults are carefully chosen such that most users will enjoy using Vim as it 142 is. Commands and options can be used to adjust Vim to the desire of the user 143 and its environment. 144 145 146 VIM IS... NOT *design-not* 147 148 - Vim is not a shell or an Operating System. It does provide a terminal 149 window, in which you can run a shell or debugger. E.g. to be able to do 150 this over an ssh connection. But if you don't need a text editor with that 151 it is out of scope (use something like screen or tmux instead). 152 A satirical way to say this: "Unlike Emacs, Vim does not attempt to include 153 everything but the kitchen sink, but some people say that you can clean one 154 with it. ;-)" 155 To use Vim with gdb see |terminal-debugger|. Other (older) tools can be 156 found at http://clewn.sf.net. 157 - Vim is not a fancy GUI editor that tries to look nice at the cost of 158 being less consistent over all platforms. But functional GUI features are 159 welcomed. 160 161 162 ============================================================================== 163 2. Design decisions *design-decisions* 164 165 Folding 166 167 Several forms of folding should be possible for the same buffer. For example, 168 have one window that shows the text with function bodies folded, another 169 window that shows a function body. 170 171 Folding is a way to display the text. It should not change the text itself. 172 Therefore the folding has been implemented as a filter between the text stored 173 in a buffer (buffer lines) and the text displayed in a window (logical lines). 174 175 176 Naming the window 177 178 The word "window" is commonly used for several things: A window on the screen, 179 the xterm window, a window inside Vim to view a buffer. 180 To avoid confusion, other items that are sometimes called window have been 181 given another name. Here is an overview of the related items: 182 183 screen The whole display. For the GUI it's something like 1024x768 184 pixels. The Vim shell can use the whole screen or part of it. 185 shell The Vim application. This can cover the whole screen (e.g., 186 when running in a console) or part of it (xterm or GUI). 187 window View on a buffer. There can be several windows in Vim, 188 together with the command line, menubar, toolbar, etc. they 189 fit in the shell. 190 191 192 Spell checking *develop-spell* 193 194 When spell checking was going to be added to Vim a survey was done over the 195 available spell checking libraries and programs. Unfortunately, the result 196 was that none of them provided sufficient capabilities to be used as the spell 197 checking engine in Vim, for various reasons: 198 199 - Missing support for multibyte encodings. At least UTF-8 must be supported, 200 so that more than one language can be used in the same file. 201 Doing on-the-fly conversion is not always possible (would require iconv 202 support). 203 - For the programs and libraries: Using them as-is would require installing 204 them separately from Vim. That's mostly not impossible, but a drawback. 205 - Performance: A few tests showed that it's possible to check spelling on the 206 fly (while redrawing), just like syntax highlighting. But the mechanisms 207 used by other code are much slower. Myspell uses a hashtable, for example. 208 The affix compression that most spell checkers use makes it slower too. 209 - For using an external program like aspell a communication mechanism would 210 have to be setup. That's complicated to do in a portable way (Unix-only 211 would be relatively simple, but that's not good enough). And performance 212 will become a problem (lots of process switching involved). 213 - Missing support for words with non-word characters, such as "Etten-Leur" and 214 "et al.", would require marking the pieces of them OK, lowering the 215 reliability. 216 - Missing support for regions or dialects. Makes it difficult to accept 217 all English words and highlight non-Canadian words differently. 218 - Missing support for rare words. Many words are correct but hardly ever used 219 and could be a misspelled often-used word. 220 - For making suggestions the speed is less important and requiring to install 221 another program or library would be acceptable. But the word lists probably 222 differ, the suggestions may be wrong words. 223 224 225 Spelling suggestions *develop-spell-suggestions* 226 227 For making suggestions there are two basic mechanisms: 228 1. Try changing the bad word a little bit and check for a match with a good 229 word. Or go through the list of good words, change them a little bit and 230 check for a match with the bad word. The changes are deleting a character, 231 inserting a character, swapping two characters, etc. 232 2. Perform soundfolding on both the bad word and the good words and then find 233 matches, possibly with a few changes like with the first mechanism. 234 235 The first is good for finding typing mistakes. After experimenting with 236 hashtables and looking at solutions from other spell checkers the conclusion 237 was that a trie (a kind of tree structure) is ideal for this. Both for 238 reducing memory use and being able to try sensible changes. For example, when 239 inserting a character only characters that lead to good words need to be 240 tried. Other mechanisms (with hashtables) need to try all possible letters at 241 every position in the word. Also, a hashtable has the requirement that word 242 boundaries are identified separately, while a trie does not require this. 243 That makes the mechanism a lot simpler. 244 245 Soundfolding is useful when someone knows how the words sounds but doesn't 246 know how it is spelled. For example, the word "dictionary" might be written 247 as "daktonerie". The number of changes that the first method would need to 248 try is very big, it's hard to find the good word that way. After soundfolding 249 the words become "tktnr" and "tkxnry", these differ by only two letters. 250 251 To find words by their soundfolded equivalent (soundalike word) we need a list 252 of all soundfolded words. A few experiments have been done to find out what 253 the best method is. Alternatives: 254 1. Do the sound folding on the fly when looking for suggestions. This means 255 walking through the trie of good words, soundfolding each word and 256 checking how different it is from the bad word. This is very efficient for 257 memory use, but takes a long time. On a fast PC it takes a couple of 258 seconds for English, which can be acceptable for interactive use. But for 259 some languages it takes more than ten seconds (e.g., German, Catalan), 260 which is unacceptably slow. For batch processing (automatic corrections) 261 it's too slow for all languages. 262 2. Use a trie for the soundfolded words, so that searching can be done just 263 like how it works without soundfolding. This requires remembering a list 264 of good words for each soundfolded word. This makes finding matches very 265 fast but requires quite a lot of memory, in the order of 1 to 10 Mbyte. 266 For some languages more than the original word list. 267 3. Like the second alternative, but reduce the amount of memory by using affix 268 compression and store only the soundfolded basic word. This is what Aspell 269 does. Disadvantage is that affixes need to be stripped from the bad word 270 before soundfolding it, which means that mistakes at the start and/or end 271 of the word will cause the mechanism to fail. Also, this becomes slow when 272 the bad word is quite different from the good word. 273 274 The choice made is to use the second mechanism and use a separate file. This 275 way a user with sufficient memory can get very good suggestions while a user 276 who is short of memory or just wants the spell checking and no suggestions 277 doesn't use so much memory. 278 279 280 Word frequency 281 282 For sorting suggestions it helps to know which words are common. In theory we 283 could store a word frequency with the word in the dictionary. However, this 284 requires storing a count per word. That degrades word tree compression a lot. 285 And maintaining the word frequency for all languages will be a heavy task. 286 Also, it would be nice to prefer words that are already in the text. This way 287 the words that appear in the specific text are preferred for suggestions. 288 289 What has been implemented is to count words that have been seen during 290 displaying. A hashtable is used to quickly find the word count. The count is 291 initialized from words listed in COMMON items in the affix file, so that it 292 also works when starting a new file. 293 294 This isn't ideal, because the longer Vim is running the higher the counts 295 become. But in practice it is a noticeable improvement over not using the 296 word count. 297 298 ============================================================================== 299 3. Assumptions *design-assumptions* 300 301 The following sections define the portability and compatibility constraints 302 that all Vim code and build tools must adhere to. 303 304 305 MAKEFILES *assumptions-makefiles* 306 *POSIX.1-2001* 307 308 Vim's main Makefiles target maximum portability, relying solely on features 309 defined in POSIX.1-2001 `make` and ignoring later POSIX standards or GNU/BSD 310 extensions. In practical terms, avoid: 311 312 - % pattern rules 313 - modern assignment (`:=`, `::=`) outside POSIX.1-2001 314 - special targets (`.ONESHELL`, `.NOTPARALLEL`, `.SILENT`, ...) 315 - order-only prerequisites (`|`) or automatic directory creation 316 - GNU/BSD conditionals (`ifdef`, `ifndef`, `.for`/`.endfor`, ...) 317 318 Since POSIX.1-2001 supports only traditional suffix rules, every object built 319 in a separate directory must have an explicit rule. For example: 320 321 objects/evalbuffer.o: evalbuffer.c 322 $(CCC) -o $@ evalbuffer.c 323 324 This verbosity ensures that the same Makefile builds Vim unchanged with the 325 default `make` on Linux, *BSD, macOS, Solaris, AIX, HP-UX and virtually any 326 Unix-like OS. 327 328 Some platform-specific Makefiles (e.g., for Windows, NSIS, or Cygwin) may use 329 more advanced features when compatibility with basic make is not required. 330 331 332 C COMPILER *assumptions-C-compiler* 333 *ANSI-C* *C89* *C90* *C95* *C99* 334 335 Vim strives for maximum portability (see |design-multi-platform|) and must 336 still build with Compaq C V6.4-005 on OpenVMS VAX V7.3. 337 338 Therefore, the latest ISO C standard we follow is: 339 340 `C95` (ISO/IEC 9899:1990/AMD1:1995) 341 342 In addition, the following `C99` features are explicitly allowed: 343 - `//` comments, as required by |style-comments|; 344 - Mixed declarations and statements in a block; 345 - Variadic macros `(..., __VA_ARGS__)`; 346 - Trailing comma in `enum` lists; 347 - `_Bool` type (for `bool`, `true` and `false`); 348 - `__func__` predefined identifier; 349 - `inline` functions (use `static inline` for portability); 350 - Compound literals `(type){ initializer-list }`; 351 - Logical source lines up to 4095 characters. 352 353 Platform-specific code may use any newer compiler features supported on that 354 platform. 355 356 357 SIZE OF VARIABLES *assumptions-variables* 358 359 We follow POSIX.1-2001 (SUSv3) for type sizes, which in practice means: 360 361 char_u 8-bit unsigned 362 int 32-bit or larger signed 363 unsigned 32-bit or larger unsigned 364 365 366 FUNCTION PROTOTYPES *assumptions-prototypes* 367 368 Vim does not use conventional header files (`.h`) for most internal function 369 prototypes. Instead, the current architecture uses individual `.pro` files in 370 the `src/proto/` directory, with one `.pro` file per `.c` file. 371 372 Unlike traditional self-contained header files, these `.pro` files do not 373 contain API documentation, struct and enum definitions, or other declarations; 374 only function prototypes. 375 376 The `make proto` target in `src/Makefile` automates updating most of the .pro 377 files using the Python script proto/gen_prototypes.py, which relies on the 378 python3-clang module. Note that a few proto files are hand edited. 379 380 ============================================================================== 381 4. Coding style *coding-style* 382 383 These are the rules to use when making changes to the Vim source code. Please 384 stick to these rules, to keep the sources readable and maintainable. 385 386 This list is not complete. Look in the source code for more examples. 387 388 The code repository contains an editorconfig file, that can be used together 389 with the distributed editorconfig plugin |editorconfig-install| to ensure the 390 recommended style is followed. 391 392 393 MAKING CHANGES *style-changes* 394 395 The basic steps to make changes to the code: 396 1. Get the code from github. That makes it easier to keep your changed 397 version in sync with the main code base (it may be a while before your 398 changes will be included). 399 2. Adjust the documentation. Doing this first gives you an impression of how 400 your changes affect the user. 401 3. Make the source code changes. 402 4. Check ../doc/todo.txt if the change affects any listed item. 403 5. Add a test to src/testdir to verify the new behaviour and ensure it won't 404 regress in the future. 405 6. Make a patch with "git diff". 406 7. Make a note about what changed, preferably mentioning the problem and the 407 solution. Send an email to the |vim-dev| maillist with an explanation and 408 include the diff. 409 410 For any non-trivial change, please always create a pull request on github, 411 since this triggers the test suite. 412 413 A PR should ideally contain a single commit for a single logical change. 414 However, you can include several commits if you want to group multiple 415 logical, atomic changes in one PR. This can also make longer PRs easier to 416 review. Be sure to describe the reasoning for your changes in each commit 417 message, as this greatly helps with the review process. In cases where each 418 commit handles different logical changes, they will also be applied as 419 separate patches in Vim's repository. 420 421 *style-clang-format* 422 sound.c and sign.c can be (semi-) automatically formatted using the 423 `clang-format` formatter according to the distributed .clang-format file. 424 Other source files do not yet correspond to the .clang-format file. This may 425 change in the future and they may be reformatted as well. 426 427 428 COMMENTS *style-comments* 429 430 Try to avoid putting multiline comments inside a function body: if the 431 function is so complex that you need to separately comment parts of it, you 432 should probably rethink the structure of the function. 433 434 For file headers and function descriptions use: > 435 /* 436 * Description 437 */ 438 < 439 For everything else use: > 440 // comment 441 < 442 443 INDENTATION *style-indentation* 444 445 We use 4 space to indent the code. If you are using Vim to edit the source, 446 you don't need to do anything due to the |modeline|. 447 448 For other editors an `.editorconfig` is provided at the root of the repo. 449 450 For the source files `sign.c` and `sound.c` and any new file use only spaces, 451 no tabs. In addition, any new file must include a modeline with `set et` to 452 pass the indentation test. 453 454 455 DECLARATIONS *style-declarations* 456 457 Declare, when possible, `for` loop variables in the guard: 458 OK: > 459 for (int i = 0; i < len; ++i) 460 < 461 Wrong: > 462 int i; 463 for (i = 0; i < len; ++i) 464 < 465 Always declare a variable with a default value: 466 OK: > 467 int n = 0; 468 int *ptr = NULL; 469 < 470 Wrong: > 471 int n; 472 int *ptr; 473 < 474 475 BRACES *style-braces* 476 477 All curly braces must be returned onto a new line: 478 OK: > 479 if (cond) 480 { 481 cmd; 482 cmd; 483 } 484 else 485 { 486 cmd; 487 cmd; 488 } 489 < 490 Wrong: > 491 if (cond) { 492 cmd; 493 cmd; 494 } else { 495 cmd; 496 cmd; 497 } 498 < 499 OK: > 500 while (cond) 501 { 502 cmd; 503 cmd; 504 } 505 < 506 Wrong: > 507 while (cond) { 508 cmd; 509 cmd; 510 } 511 < 512 OK: > 513 do 514 { 515 cmd; 516 cmd; 517 } while (cond); 518 < 519 or > 520 do 521 { 522 cmd; 523 cmd; 524 } 525 while (cond); 526 < 527 Wrong: > 528 do { 529 cmd; 530 cmd; 531 } while (cond); 532 < 533 534 TYPES *style-types* 535 536 Use descriptive types. These are defined in src/vim.h, src/structs.h etc. 537 Note that all custom types are postfixed with "_T" 538 539 Example: > 540 linenr_T 541 buf_T 542 pos_T 543 < 544 545 SPACES AND PUNCTUATION *style-spaces* 546 547 No space between a function name and the bracket: 548 549 OK: func(arg); 550 Wrong: func (arg); 551 552 Do use a space after `if`, `while`, `switch`, etc. 553 554 OK: if (arg) for (;;) 555 Wrong: if(arg) for(;;) 556 557 Use a space after a comma or semicolon: 558 559 OK: func(arg1, arg2); for (i = 0; i < 2; ++i) 560 Wrong: func(arg1,arg2); for (i = 0;i < 2;++i) 561 562 Use a space before and after '=', '+', '/', etc. 563 564 OK: var = a * 5; 565 Wrong: var=a*5; 566 567 Use empty lines to group similar actions together. 568 569 OK: > 570 msg_puts_title(_("\n--- Signs ---")); 571 msg_putchar('\n'); 572 573 if (rbuf == NULL) 574 buf = firstbuf; 575 else 576 buf = rbuf; 577 578 while (buf != NULL && !got_int) 579 < 580 Wrong: > 581 msg_puts_title(_("\n--- Signs ---")); 582 msg_putchar('\n'); 583 if (rbuf == NULL) 584 buf = firstbuf; 585 else 586 buf = rbuf; 587 while (buf != NULL && !got_int) 588 < 589 590 FUNCTIONS *style-functions* 591 592 Use function declarations with the return type on a separate indented line. 593 594 OK: > 595 int 596 function_name(int arg1, int arg2) 597 { 598 } 599 < 600 Wrong: > 601 int function_name(int arg1, int arg2) 602 { 603 } 604 < 605 606 Give meaningful names to function parameters. 607 608 609 USE OF COMMON FUNCTIONS *style-common-functions* 610 611 Some functions that are common to use, have a special Vim version. Always 612 consider using the Vim version, because they were introduced with a reason. 613 614 NORMAL NAME VIM NAME DIFFERENCE OF VIM VERSION 615 free() vim_free() Checks for freeing NULL 616 malloc() alloc() Checks for out of memory situation 617 malloc() lalloc() Like alloc(), but has long argument 618 strcpy() STRCPY() Includes cast to (char *), for char_u * args 619 strchr() vim_strchr() Accepts special characters 620 strrchr() vim_strrchr() Accepts special characters 621 isspace() vim_isspace() Can handle characters > 128 622 iswhite() vim_iswhite() Only TRUE for tab and space 623 memcpy() mch_memmove() Handles overlapped copies 624 bcopy() mch_memmove() Handles overlapped copies 625 memset() vim_memset() Uniform for all systems 626 627 628 NAMES *style-names* 629 630 Function names can not be more than 31 characters long (because of VMS). 631 632 Don't use "delete" or "this" as a variable name, C++ doesn't like it. 633 634 Because of the requirement that Vim runs on as many systems as possible, we 635 need to avoid using names that are already defined by the system. This is a 636 list of names that are known to cause trouble. The name is given as a regexp 637 pattern. 638 639 is.*() POSIX, ctype.h 640 to.*() POSIX, ctype.h 641 642 d_.* POSIX, dirent.h 643 l_.* POSIX, fcntl.h 644 gr_.* POSIX, grp.h 645 pw_.* POSIX, pwd.h 646 sa_.* POSIX, signal.h 647 mem.* POSIX, string.h 648 str.* POSIX, string.h 649 wcs.* POSIX, string.h 650 st_.* POSIX, stat.h 651 tms_.* POSIX, times.h 652 tm_.* POSIX, time.h 653 c_.* POSIX, termios.h 654 MAX.* POSIX, limits.h 655 __.* POSIX, system 656 _[A-Z].* POSIX, system 657 E[A-Z0-9]* POSIX, errno.h 658 659 .*_t POSIX, for typedefs. Use .*_T instead. 660 661 wait don't use as argument to a function, conflicts with types.h 662 index shadows global declaration 663 time shadows global declaration 664 new C++ reserved keyword 665 666 clear Mac curses.h 667 echo Mac curses.h 668 instr Mac curses.h 669 meta Mac curses.h 670 newwin Mac curses.h 671 nl Mac curses.h 672 overwrite Mac curses.h 673 refresh Mac curses.h 674 scroll Mac curses.h 675 typeahead Mac curses.h 676 677 basename() GNU string function 678 dirname() GNU string function 679 get_env_value() Linux system function 680 681 682 VARIOUS *style-various* 683 684 Define'd names should be uppercase: > 685 #define SOME_THING 686 < 687 688 Features always start with "FEAT_": > 689 #define FEAT_FOO 690 < 691 692 Don't use '\"', some compilers can't handle it. '"' works fine. 693 694 Don't use: > 695 #if HAVE_SOME 696 < 697 Some compilers can't handle that and complain that "HAVE_SOME" is not defined. 698 Use > 699 #ifdef HAVE_SOME 700 < 701 or > 702 #if defined(HAVE_SOME) 703 < 704 705 STYLE *style-examples* 706 707 One statement per line. 708 709 Wrong: if (cond) a = 1; 710 711 OK: if (cond) 712 a = 1; 713 714 Wrong: while (cond); 715 716 OK: while (cond) 717 ; 718 719 Wrong: do a = 1; while (cond); 720 721 OK: do 722 a = 1; 723 while (cond); 724 725 726 ============================================================================== 727 5. Policy *design-policy* *new-features* *deprecated-features* 728 729 The time between either a new minor (e.g. 9.2.0) or major (e.g. 10.0) version 730 is released is called a development cycle. Within the development cycle each 731 single change to the C core will receive a new increased human-readable patch 732 number in order to reference each specific patch release. A typical 733 development release cycle may last several years and accumulate about 1500 - 734 2500 patch numbers. 735 736 Before a release is made, a stability period will be announced. During this 737 time, only clear bug fixes, security fixes, documentation changes, translation 738 updates and runtime file updates will be accepted (provided they do not 739 introduce backwards-incompatible changes), concentrating on polishing up the 740 upcoming release. 741 742 New features are accepted only within a development cycle, but not within the 743 stability period. During the cycle, new features may be developed and are 744 allowed to change, but they must be settled before the cycle closes. 745 746 Once a minor release has been made, features included in that release must not 747 receive any backwards-incompatible changes. Later patches are expected to 748 preserve compatibility for the C core of Vim. Runtime files are handled a bit 749 more flexibly to give runtime files maintainers a chance to change old 750 behaviour. 751 752 Within a development cycle, features may be marked as deprecated. Deprecated 753 features can be disabled at compile time through an appropriate switch. After 754 a new release, deprecated features may be removed completely in a following 755 cycle. 756 757 vim:tw=78:ts=8:noet:ft=help:norl: