Mercurial > vim
annotate src/README.md @ 16309:f21de4c36152
Added tag v8.1.1159 for changeset 6400235ca4ad0400059a20ad2c6c255d73bbac58
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 12 Apr 2019 21:30:05 +0200 |
parents | e12336bb8ced |
children | 3fc956fc63b6 |
rev | line source |
---|---|
16129
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 ![Vim Logo](https://github.com/vim/vim/blob/master/runtime/vimlogo.gif) |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 # Vim source code # |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 Here are a few hints for finding your way around the source code. This |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 doesn't make it less complex than it is, but it gets you started. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 You might also want to read |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 [`:help development`](http://vimdoc.sourceforge.net/htmldoc/develop.html#development). |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 ## Jumping around ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 First of all, use `:make tags` to generate a tags file, so that you can jump |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 around in the source code. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 To jump to a function or variable definition, move the cursor on the name and |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 use the `CTRL-]` command. Use `CTRL-T` or `CTRL-O` to jump back. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 To jump to a file, move the cursor on its name and use the `gf` command. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 Most code can be found in a file with an obvious name (incomplete list): |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 File name | Description |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 --------- | ----------- |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 autocmd.c | autocommands |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 buffer.c | manipulating buffers (loaded files) |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 diff.c | diff mode (vimdiff) |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 eval.c | expression evaluation |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 fileio.c | reading and writing files |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 findfile.c | search for files in 'path' |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 fold.c | folding |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 getchar.c | getting characters and key mapping |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 indent.c | C and Lisp indentation |
16186
e12336bb8ced
patch 8.1.1098: quickfix code duplication
Bram Moolenaar <Bram@vim.org>
parents:
16129
diff
changeset
|
35 insexpand.c | Insert mode completion |
16129
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 mark.c | marks |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 mbyte.c | multi-byte character handling |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 memfile.c | storing lines for buffers in a swapfile |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 memline.c | storing lines for buffers in memory |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 menu.c | menus |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 message.c | (error) messages |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 ops.c | handling operators ("d", "y", "p") |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 option.c | options |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 quickfix.c | quickfix commands (":make", ":cn") |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 regexp.c | pattern matching |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 screen.c | updating the windows |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 search.c | pattern searching |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 sign.c | signs |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 spell.c | spell checking |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 syntax.c | syntax and other highlighting |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 tag.c | tags |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 term.c | terminal handling, termcap codes |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 undo.c | undo and redo |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 window.c | handling split windows |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 ## Debugging ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 If you have a reasonable recent version of gdb, you can use the `:Termdebug` |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 command to debug Vim. See `:help :Termdebug`. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 When something is time critical or stepping through code is a hassle, use the |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 channel logging to create a time-stamped log file. Add lines to the code like |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 this: |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 ch_log(NULL, "Value is now %02x", value); |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 After compiling and starting Vim, do: |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 :call ch_logfile('debuglog', 'w') |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 And edit `debuglog` to see what happens. The channel functions already have |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 `ch_log()` calls, thus you always see that in the log. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 ## Important Variables ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 The current mode is stored in `State`. The values it can have are `NORMAL`, |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 `INSERT`, `CMDLINE`, and a few others. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 The current window is `curwin`. The current buffer is `curbuf`. These point |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 to structures with the cursor position in the window, option values, the file |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 name, etc. These are defined in |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 [`structs.h`](https://github.com/vim/vim/blob/master/src/globals.h). |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 All the global variables are declared in |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 [`globals.h`](https://github.com/vim/vim/blob/master/src/structs.h). |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 ## The main loop ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 This is conveniently called `main_loop()`. It updates a few things and then |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 calls `normal_cmd()` to process a command. This returns when the command is |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 finished. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 The basic idea is that Vim waits for the user to type a character and |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 processes it until another character is needed. Thus there are several places |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 where Vim waits for a character to be typed. The `vgetc()` function is used |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 for this. It also handles mapping. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 Updating the screen is mostly postponed until a command or a sequence of |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 commands has finished. The work is done by `update_screen()`, which calls |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 `win_update()` for every window, which calls `win_line()` for every line. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 See the start of |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 [`screen.c`](https://github.com/vim/vim/blob/master/src/screen.c) |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 for more explanations. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 ## Command-line mode ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 When typing a `:`, `normal_cmd()` will call `getcmdline()` to obtain a line |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 with an Ex command. `getcmdline()` contains a loop that will handle each typed |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 character. It returns when hitting `CR` or `Esc` or some other character that |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 ends the command line mode. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 ## Ex commands ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 Ex commands are handled by the function `do_cmdline()`. It does the generic |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 parsing of the `:` command line and calls `do_one_cmd()` for each separate |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 command. It also takes care of while loops. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 `do_one_cmd()` parses the range and generic arguments and puts them in the |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 `exarg_t` and passes it to the function that handles the command. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 The `:` commands are listed in `ex_cmds.h`. The third entry of each item is |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 the name of the function that handles the command. The last entry are the |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 flags that are used for the command. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 ## Normal mode commands ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 The Normal mode commands are handled by the `normal_cmd()` function. It also |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 handles the optional count and an extra character for some commands. These |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 are passed in a `cmdarg_t` to the function that handles the command. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 There is a table `nv_cmds` in |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 [`normal.c`](https://github.com/vim/vim/blob/master/src/normal.c) |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 which lists the first character of every command. The second entry of each |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 item is the name of the function that handles the command. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 ## Insert mode commands ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 When doing an `i` or `a` command, `normal_cmd()` will call the `edit()` |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 function. It contains a loop that waits for the next character and handles it. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 It returns when leaving Insert mode. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 ## Options ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 There is a list with all option names in |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 [`option.c`](https://github.com/vim/vim/blob/master/src/option.c), |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 called `options[]`. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 ## The GUI ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 Most of the GUI code is implemented like it was a clever terminal. Typing a |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 character, moving a scrollbar, clicking the mouse, etc. are all translated |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 into events which are written in the input buffer. These are read by the |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 main code, just like reading from a terminal. The code for this is scattered |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 through [`gui.c`](https://github.com/vim/vim/blob/master/src/gui.c). |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 For example, `gui_send_mouse_event()` for a mouse click and `gui_menu_cb()` for |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 a menu action. Key hits are handled by the system-specific GUI code, which |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 calls `add_to_input_buf()` to send the key code. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 Updating the GUI window is done by writing codes in the output buffer, just |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 like writing to a terminal. When the buffer gets full or is flushed, |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 `gui_write()` will parse the codes and draw the appropriate items. Finally the |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 system-specific GUI code will be called to do the work. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 ## Debugging the GUI ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 Remember to prevent that gvim forks and the debugger thinks Vim has exited, |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 add the `-f` argument. In gdb: `run -f -g`. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 When stepping through display updating code, the focus event is triggered |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 when going from the debugger to Vim and back. To avoid this, recompile with |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 some code in `gui_focus_change()` disabled. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 ## Contributing ## |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 If you would like to help making Vim better, see the |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 [`CONTRIBUTING.md`](https://github.com/vim/vim/blob/master/CONTRIBUTING.md) |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 file. |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 |
52ae47071830
patch 8.1.1069: source README file doesn't look nice on github
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 This is `README.md` for version 8.1 of the Vim source code. |