robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #41113 from justinmk/doc27ce7a8d58c

master
16.4 KiB374 linesraw
1*vi_diff.txt*   Nvim
2
3
4		  VIM REFERENCE MANUAL	  by Bram Moolenaar
5
6
7Differences between Vim and Vi				*vi-differences*
8
9                                      Type |gO| to see the table of contents.
10
11==============================================================================
121. Limits						*limits*
13
14Vim has only a few limits for the files that can be edited. Vi cannot handle
15<Nul> characters and characters above 128, has limited line length, many other
16limits.
17
18Maximum line length	   2147483647 characters
19Maximum number of lines	   2147483647 lines
20Maximum file size	   2147483647 bytes (2 Gbyte) when a long integer is
21			   32 bits.  Much more for 64 bit longs.  Also limited
22			   by available disk space for the |swap-file|.
23							*E75*
24Length of a file path	   Unix and Win32: 1024 characters, otherwise 256
25			   characters (or as much as the system supports).
26Length of an expanded string option
27			   Unix and Win32: 1024 characters, otherwise 256
28			   characters
29Maximum display width	   Unix and Win32: 1024 characters, otherwise 255
30			   characters
31Maximum lhs of a mapping   50 characters.
32Number of different highlighting types: over 30000
33Range of a Number variable:  -2147483648 to 2147483647 (might be more on 64
34			   bit systems)  See also: |v:numbermax|,
35			   |v:numbermin| and |v:numbersize|
36Maximum length of a line in a tags file: 512 bytes.
37							*E1541*
38Maximum value for |/\U| and |/\%U|: 2147483647 (for 32bit integer).
39
40Information for undo and text in registers is kept in memory, thus when making
41(big) changes the amount of (virtual) memory available limits the number of
42undo levels and the text that can be kept in registers.  Other things are also
43kept in memory:  Command-line history, error messages for Quickfix mode, etc.
44
45==============================================================================
462. The most interesting additions			*vim-additions*
47
48Support for different systems.
49	Vim can be used on:
50	- Modern Unix systems (BSD, Linux, etc.)
51	- Windows (XP SP 2 or greater)
52	- OS X
53
54Multi level persistent undo.					|undo|
55	'u' goes backward in time, 'CTRL-R' goes forward again.  Set option
56	'undolevels' to the number of changes to be remembered (default 1000).
57	Set 'undolevels' to 0 for a Vi-compatible one level undo.  Set it to
58	-1 for no undo at all.
59	When all changes in a buffer have been undone, the buffer is not
60	considered changed anymore.  You can exit it with :q, without <!>.
61	When undoing a few changes and then making a new change Vim will
62	create a branch in the undo tree.  This means you can go back to any
63	state of the text, there is no risk of a change causing text to be
64	lost forever. |undo-tree|
65	The undo information is stored in a file when the 'undofile' option is
66	set.  This means you can exit Vim, start Vim on a previously edited
67	file and undo changes that were made before exiting Vim.
68
69Graphical User Interface (GUI).				|gui|
70	Included support for GUI: menu's, mouse, scrollbars, etc.  You can
71	define your own menus.  Better support for CTRL/SHIFT/ALT keys in
72	combination with special keys and mouse.  Supported for various
73	platforms such as Win32.
74
75Multiple windows and buffers.				|windows.txt|
76	Vim can split the screen into several windows, each editing a
77	different buffer or the same buffer at a different location.  Buffers
78	can still be loaded (and changed) but not displayed in a window.  This
79	is called a hidden buffer.  Many commands and options have been added
80	for this facility.
81	Vim can also use multiple tabpages, each with one or more windows.  A
82	line with tab labels can be used to quickly switch between these
83	pages.
84	|tabpage|
85
86Syntax highlighting.					|:syntax|
87	Vim can highlight keywords, patterns and other things.  This is
88	defined by a number of |:syntax| commands, and can be made to
89	highlight most languages and file types.  A number of files are
90	included for highlighting the most common languages, like C, C++,
91	Java, Pascal, Makefiles, shell scripts, etc.  The colors used for
92	highlighting can be defined for ordinary terminals, color terminals
93	and the GUI with the |:highlight| command.  A convenient way to do
94	this is using a |:colorscheme| command.
95	The highlighted text can be exported as HTML. |convert-to-HTML|
96	Other items that can be highlighted are matches with the search string
97	'hlsearch', matching parens |matchparen| and the cursor line and
98	column 'cursorline' 'cursorcolumn'.
99
100Spell checking.						|spell|
101	When the 'spell' option is set Vim will highlight spelling mistakes.
102	About 50 languages are currently supported, selected with the
103	'spelllang' option.  In source code only comments and strings are
104	checked for spelling.
105
106Folding.						|folding|
107	A range of lines can be shown as one "folded" line.  This allows
108	overviewing a file and moving blocks of text around quickly.
109	Folds can be created manually, from the syntax of the file, by indent,
110	etc.
111
112Diff mode.						|diff-mode|
113	Vim can show two versions of a file with the differences highlighted.
114	Parts of the text that are equal are folded away.  Commands can be
115	used to move text from one version to the other.
116
117Plugins.						|add-plugin|
118	The functionality can be extended by dropping a plugin file in the
119	right directory.  That's an easy way to start using Vim scripts
120	written by others.  Plugins can be for all kind of files, or
121	specifically for a filetype.
122	Packages make this even easier. |packages|
123
124Asynchronous communication and timers.			|job-control| |timer|
125	Vim can exchange messages with other processes in the background.
126	Vim can start a job, communicate with it and stop it. |job-control|
127	Timers can fire once or repeatedly and invoke a function to do any
128	work. |timer|
129
130Repeat a series of commands.				|q|
131	"q{c}" starts recording typed characters into named register {c}.
132	A subsequent "q" stops recording.  The register can then be executed
133	with the "@{c}" command.  This is very useful to repeat a complex
134	action.
135
136Flexible insert mode.					|ins-special-special|
137	The arrow keys can be used in insert mode to move around in the file.
138	This breaks the insert in two parts as far as undo and redo is
139	concerned.
140
141	CTRL-O can be used to execute a single Normal mode command.  This is
142	almost the same as hitting <Esc>, typing the command and doing |a|.
143
144Visual mode.						|Visual-mode|
145	Visual mode can be used to first highlight a piece of text and then
146	give a command to do something with it.  This is an (easy to use)
147	alternative to first giving the operator and then moving to the end of
148	the text to be operated upon.
149	|v| and |V| are used to start Visual mode.  |v| works on characters
150	and |V| on lines.  Move the cursor to extend the Visual area.  It is
151	shown highlighted on the screen.  By typing "o" the other end of the
152	Visual area can be moved.  The Visual area can be affected by an
153	operator:
154		d	delete
155		c	change
156		y	yank
157		> or <	insert or delete indent
158		!	filter through external program
159		=	filter through indent
160		:	start |:| command for the Visual lines.
161		gq	format text to 'textwidth' columns
162		J	join lines
163		~	swap case
164		u	make lowercase
165		U	make uppercase
166
167Block operators.					|visual-block|
168	With Visual mode a rectangular block of text can be selected.  Start
169	Visual mode with CTRL-V.  The block can be deleted ("d"), yanked ("y")
170	or its case can be changed ("~", "u" and "U").  A deleted or yanked
171	block can be put into the text with the "p" and "P" commands.
172
173Help system.						|:help|
174	Help is displayed in a window.  The usual commands can be used to
175	move around, search for a string, etc.  Tags can be used to jump
176	around in the help files, just like hypertext links.  The |:help|
177	command takes an argument to quickly jump to the info on a subject.
178	<F1> is the quick access to the help system.  The name of the help
179	index file can be set with the 'helpfile' option.
180
181Command-line editing and history.			|cmdline-editing|
182	You can insert or delete at any place in the command-line using the
183	cursor keys.  The right/left cursor keys can be used to move
184	forward/backward one character.  The shifted right/left cursor keys
185	can be used to move forward/backward one word.  CTRL-B/CTRL-E can be
186	used to go to the begin/end of the command-line.
187	(Vi: can only alter the last character in the line)
188	(Vi: when hitting <Esc> the command-line is executed.  This is
189	unexpected for most people; therefore it was changed in Vim.  But when
190	the <Esc> is part of a mapping, the command-line is executed.  If you
191	want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc>
192	^V^M")
193							|cmdline-history|
194	The command-lines are remembered.  The up/down cursor keys can be used
195	to recall previous command-lines.  The 'history' option can be set to
196	the number of lines that will be remembered.  There is a separate
197	history for commands and for search patterns.
198
199Command-line completion.				|cmdline-completion|
200	While entering a command-line (on the bottom line of the screen)
201	<Tab> can be typed to complete
202	   what		example		~
203	- command	:e<Tab>
204	- tag		:ta scr<Tab>
205	- option	:set sc<Tab>
206	- option value  :set hf=<Tab>
207	- file name	:e ve<Tab>
208	- etc.
209
210	If there are multiple matches, CTRL-N (next) and CTRL-P (previous)
211	will walk through the matches.  <Tab> works like CTRL-N, but wraps
212	around to the first match.
213
214	The 'wildchar' option can be set to the character for command-line
215	completion, <Tab> is the default.  CTRL-D can be typed after an
216	(incomplete) wildcard; all matches will be listed.  CTRL-A will insert
217	all matches.  CTRL-L will insert the longest common part of the
218	matches.
219
220Insert-mode completion.					|ins-completion|
221	In Insert mode the CTRL-N and CTRL-P keys can be used to complete a
222	word that appears elsewhere.	|i_CTRL-N|
223	With CTRL-X another mode is entered, through which completion can be
224	done for:
225	|i_CTRL-X_CTRL-F|	file names
226	|i_CTRL-X_CTRL-K|	words from 'dictionary' files
227	|i_CTRL-X_CTRL-T|	words from 'thesaurus' files
228	|i_CTRL-X_CTRL-I|	words from included files
229	|i_CTRL-X_CTRL-L|	whole lines
230	|i_CTRL-X_CTRL-]|	words from the tags file
231	|i_CTRL-X_CTRL-D|	definitions or macros
232	|i_CTRL-X_CTRL-O|	Omni completion: clever completion
233				specifically for a file type
234	|i_CTRL-X_CTRL-R|	contents from registers
235	etc.
236
237Long line support.					'wrap' 'linebreak'
238	If the 'wrap' option is off, long lines will not wrap and only part
239	of them will be shown.  When the cursor is moved to a part that is not
240	shown, the screen will scroll horizontally.  The minimum number of
241	columns to scroll can be set with the 'sidescroll' option.  The |zh|
242	and |zl| commands can be used to scroll sideways.
243	Alternatively, long lines are broken in between words when the
244	'linebreak' option is set.  This allows editing a single-line
245	paragraph conveniently (e.g. when the text is later read into a DTP
246	program).  Move the cursor up/down with the |gk| and |gj| commands.
247
248Text formatting.					|formatting|
249	The 'textwidth' option can be used to automatically limit the line
250	length.  This supplements the 'wrapmargin' option of Vi, which was not
251	very useful.  The |gq| operator can be used to format a piece of text
252	(for example, |gqap| formats the current paragraph).  Commands for
253	text alignment: |:center|, |:left| and |:right|.
254
255Extended search patterns.				|pattern|
256	There are many extra items to match various text items.  Examples:
257	A "\n" can be used in a search pattern to match a line break.
258	"x\{2,4}" matches "x" 2 to 4 times.
259	"\s" matches a white space character.
260
261Directory, remote and archive browsing.			|dir|
262	Vim can browse the file system.  Simply edit a directory.  Move around
263	in the list with the usual commands and press <Enter> to go to the
264	directory or file under the cursor.
265	This also works for remote files over ftp, http, ssh, etc.
266	Zip and tar archives can also be browsed. |tar| |zip|
267
268Edit-compile-edit speedup.				|quickfix|
269	The |:make| command can be used to run the compilation and jump to the
270	first error.  A file with compiler error messages is interpreted.  Vim
271	jumps to the first error.
272
273	Each line in the error file is scanned for the name of a file, line
274	number and error message.  The 'errorformat' option can be set to a
275	list of scanf-like strings to handle output from many compilers.
276
277	The |:cn| command can be used to jump to the next error.
278	|:cl| lists all the error messages.  Other commands are available.
279	The 'makeef' option has the name of the file with error messages.
280	The 'makeprg' option contains the name of the program to be executed
281	with the |:make| command.
282	The 'shellpipe' option contains the string to be used to put the
283	output of the compiler into the errorfile.
284
285Finding matches in files.				|:vimgrep|
286	Vim can search for a pattern in multiple files.  This uses the
287	advanced Vim regexp pattern, works on all systems and also works to
288	search in compressed files.
289
290Improved indenting for programs.			'cindent'
291	When the 'cindent' option is on the indent of each line is
292	automatically adjusted.  C syntax is mostly recognized.  The indent
293	for various styles can be set with 'cinoptions'.  The keys to trigger
294	indenting can be set with 'cinkeys'.
295
296	Comments can be automatically formatted.  The 'comments' option can be
297	set to the characters that start and end a comment.  This works best
298	for C code, but also works for e-mail (">" at start of the line) and
299	other types of text.  The |=| operator can be used to re-indent
300	lines.
301
302	For many other languages an indent plugin is present to support
303	automatic indenting. |30.3|
304
305Searching for words in included files.			|include-search|
306	The |[i| command can be used to search for a match of the word under
307	the cursor in the current and included files.  The 'include' option
308	can be set to a pattern that describes a command to include a file
309	(the default is for C programs).
310	The |[I| command lists all matches, the |[_CTRL-I| command jumps to
311	a match.
312	The |[d|, |[D| and |[_CTRL-D| commands do the same, but only for
313	lines where the pattern given with the 'define' option matches.
314
315Automatic commands.					|autocommand|
316	Commands can be automatically executed when reading a file, writing a
317	file, jumping to another buffer, etc., depending on the file name.
318	This is useful to set options and mappings for C programs,
319	documentation, plain text, e-mail, etc.  This also makes it possible
320	to edit compressed files.
321
322Scripts and Expressions.				|expression|
323	Commands have been added to form up a powerful script language.
324	|:if|		Conditional execution, which can be used for example
325			to set options depending on the value of $TERM.
326	|:while|	Repeat a number of commands.
327	|:for|		Loop over a list.
328	|:echo|		Print the result of an expression.
329	|:let|		Assign a value to an internal variable, option, etc.
330			Variable types are Number, String, List and Dictionary.
331	|:execute|	Execute a command formed by an expression.
332	|:try|		Catch exceptions.
333	etc., etc.  See |eval|.
334	Debugging and profiling are supported. |debug-scripts| |profile|
335	If this is not enough, an interface is provided to |Python|.
336
337Viminfo.
338	The command-line history, marks and registers can be stored in a file
339	that is read on startup.  This can be used to repeat a search command
340	or command-line command after exiting and restarting Vim.  It is also
341	possible to jump right back to where the last edit stopped with |'0|.
342	The 'viminfo' option can be set to select which items to store in the
343	.viminfo file.  This is off by default.
344
345Mouse support.						|mouse-using|
346	The mouse is supported in the GUI version, in an xterm for Unix, for
347	BSDs with sysmouse, for Linux with gpm, and for Win32.  It can be used
348	to position the cursor, select the visual area, paste a register, etc.
349
350Usage of key names.					|<>| |key-notation|
351	Special keys now all have a name like <Up>, <End>, etc.
352	This name can be used in mappings, to make it easy to edit them.
353
354Editing binary files.					|edit-binary|
355	Vim can edit binary files.  You can change a few characters in an
356	executable file, without corrupting it.  Vim doesn't remove NUL
357	characters (they are represented as <NL> internally).
358	|-b|		command-line argument to start editing a binary file
359	'binary'	Option set by |-b|.  Prevents adding an <EOL> for the
360			last line in the file.
361
362Multi-language support.					|multi-lang|
363	Files in double-byte or multibyte encodings can be edited.  There is
364	UTF-8 support to be able to edit various languages at the same time,
365	without switching fonts. |UTF-8|
366	Messages and menus are available in different languages.
367
368Move cursor beyond lines.
369	When the 'virtualedit' option is set the cursor can move all over the
370	screen, also where there is no text.  This is useful to edit tables
371	and figures easily.
372
373
374 vim:tw=78:ts=8:noet:ft=help:norl: