[ Avaa Bypassed ]




Upload:

Command:

www-data@18.190.159.222: ~ $
*textprop.txt*  For Vim version 8.1.  Last change: 2019 Oct 23


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Displaying text with properties attached.	*textprop* *text-properties*


1. Introduction			|text-prop-intro|
2. Functions			|text-prop-functions|
3. When text changes		|text-prop-changes|


{not able to use text properties when the |+textprop| feature was
disabled at compile time}

==============================================================================
1. Introduction						*text-prop-intro*

Text properties can be attached to text in a buffer.  They will move with the
text: If lines are deleted or inserted the properties move with the text they
are attached to.  Also when inserting/deleting text in the line before the
text property.  And when inserting/deleting text inside the text property, it
will increase/decrease in size.

The main use for text properties is to highlight text.  This can be seen as a
replacement for syntax highlighting.  Instead of defining patterns to match
the text, the highlighting is set by a script, possibly using the output of an
external parser.  This only needs to be done once, not every time when
redrawing the screen, thus can be much faster, after the initial cost of
attaching the text properties.

Text properties can also be used for other purposes to identify text.  For
example, add a text property on a function name, so that a search can be
defined to jump to the next/previous function.

A text property is attached at a specific line and column, and has a specified
length.  The property can span multiple lines.

A text property has these fields:
	"id"		a number to be used as desired
	"type"		the name of a property type


Property Types ~
							*E971*
A text property normally has the name of a property type, which defines 
how to highlight the text.  The property type can have these entries:
	"highlight"	name of the highlight group to use
	"combine"	when TRUE the text property highlighting is combined
			with any syntax highlighting, when omitted or FALSE the
			text property highlighting replaces the syntax
			highlighting
	"priority"	when properties overlap, the one with the highest
			priority will be used.
	"start_incl"	when TRUE inserts at the start position will be
			included in the text property
	"end_incl"    	when TRUE inserts at the end position will be
			included in the text property


Example ~

Suppose line 11 in a buffer has this text (excluding the indent):

	The number 123 is smaller than 4567.

To highlight the numbers in this text: >
	call prop_type_add('number', {'highlight': 'Constant'})
	call prop_add(11, 12, {'length': 3, 'type': 'number'})
	call prop_add(11, 32, {'length': 4, 'type': 'number'})

Try inserting or deleting lines above the text, you will see that the text
properties stick to the text, thus the line number is adjusted as needed.

Setting "start_incl" and "end_incl" is useful when white space surrounds the
text, e.g. for a function name.  Using false is useful when the text starts
and/or ends with a specific character, such as the quote surrounding a string.

	func FuncName(arg) ~
	     ^^^^^^^^        property with start_incl and end_incl set

	var = "text"; ~
	      ^^^^^^	     property with start_incl and end_incl not set

Nevertheless, when text is inserted or deleted the text may need to be parsed
and the text properties updated.  But this can be done asynchronously.


Internal error *E967*

If you see E967, please report the bug.  You can do this at Github:
https://github.com/vim/vim/issues/new

==============================================================================
2. Functions						*text-prop-functions*

Manipulating text property types:

prop_type_add({name}, {props})		define a new property type
prop_type_change({name}, {props})	change an existing property type
prop_type_delete({name} [, {props}])	delete a property type
prop_type_get([{name} [, {props}])	get property type values
prop_type_list([{props}])		get list of property types


Manipulating text properties:

prop_add({lnum}, {col}, {props})  	add a text property
prop_clear({lnum} [, {lnum-end} [, {bufnr}]])
					remove all text properties
prop_find({props} [, {direction}])	search for a text property
prop_list({lnum} [, {props})  		text properties in {lnum}
prop_remove({props} [, {lnum} [, {lnum-end}]])
					remove a text property

						*prop_add()* *E965*
prop_add({lnum}, {col}, {props})
		Attach a text property at position {lnum}, {col}.  {col} is
		counted in bytes, use one for the first column.
		If {lnum} is invalid an error is given. *E966*
		If {col} is invalid an error is given. *E964*

		{props} is a dictionary with these fields:
		   length	length of text in bytes, can only be used
				for a property that does not continue in
				another line; can be zero
		   end_lnum	line number for the end of text
		   end_col	column just after the text; not used when
				"length" is present; when {col} and "end_col"
				are equal, and "end_lnum" is omitted or equal
				to {lnum}, this is a zero-width text property
		   bufnr	buffer to add the property to; when omitted
				the current buffer is used
		   id		user defined ID for the property; when omitted
				zero is used
		   type		name of the text property type
		All fields except "type" are optional.

		It is an error when both "length" and "end_lnum" or "end_col"
		are given.  Either use "length" or "end_col" for a property
		within one line, or use "end_lnum" and "end_col" for a
		property that spans more than one line.
		When neither "length" nor "end_col" are given the property
		will be zero-width.  That means it will not be highlighted but
		will move with the text, as a kind of mark.
		The property can end exactly at the last character of the
		text, or just after it.  In the last case, if text is appended
		to the line, the text property size will increase, also when
		the property type does not have "end_incl" set.

		"type" will first be looked up in the buffer the property is
		added to. When not found, the global property types are used.
		If not found an error is given.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetLnum()->prop_add(col, props)


prop_clear({lnum} [, {lnum-end} [, {props}]])		*prop_clear()*
		Remove all text properties from line {lnum}.
		When {lnum-end} is given, remove all text properties from line
		{lnum} to {lnum-end} (inclusive).

		When {props} contains a "bufnr" item use this buffer,
		otherwise use the current buffer.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetLnum()->prop_clear()
<
							*prop_find()*
prop_find({props} [, {direction}])
		{not implemented yet}
		Search for a text property as specified with {props}:
		   id		property with this ID
		   type		property with this type name
		   bufnr	buffer to search in; when present a
				start position with "lnum" and "col"
				must be given; when omitted the
				current buffer is used
		   lnum		start in this line (when omitted start
				at the cursor)
		   col		start at this column (when omitted
				and "lnum" is given: use column 1,
				otherwise start at the cursor)
		   skipstart	do not look for a match at the start
				position

		{direction} can be "f" for forward and "b" for backward.  When
		omitted forward search is performed.

		If a match is found then a Dict is returned with the entries
		as with prop_list(), and additionally an "lnum" entry.
		If no match is found then an empty Dict is returned.

		See |text-properties| for information about text properties.


prop_list({lnum} [, {props}])				*prop_list()*
		Return a List with all text properties in line {lnum}.

		When {props} contains a "bufnr" item, use this buffer instead
		of the current buffer.

		The properties are ordered by starting column and priority.
		Each property is a Dict with these entries:
		   col		starting column
		   length	length in bytes, one more if line break is
				included
		   id		property ID
		   type		name of the property type, omitted if
				the type was deleted
		   start	when TRUE property starts in this line
		   end		when TRUE property ends in this line

		When "start" is zero the property started in a previous line,
		the current one is a continuation.
		When "end" is zero the property continues in the next line.
		The line break after this line is included.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetLnum()->prop_list()
<
						*prop_remove()* *E968*
prop_remove({props} [, {lnum} [, {lnum-end}]])
		Remove a matching text property from line {lnum}.  When
		{lnum-end} is given, remove matching text properties from line
		{lnum} to {lnum-end} (inclusive).
		When {lnum} is omitted remove matching text properties from
		all lines.

		{props} is a dictionary with these fields:
		   id		remove text properties with this ID
		   type		remove text properties with this type name
		   bufnr	use this buffer instead of the current one
		   all		when TRUE remove all matching text properties,
				not just the first one
		A property matches when either "id" or "type" matches.
		If buffer "bufnr" does not exist you get an error message.
		If buffer "bufnr" is not loaded then nothing happens.

		Returns the number of properties that were removed.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetProps()->prop_remove()


prop_type_add({name}, {props})		*prop_type_add()* *E969* *E970*
		Add a text property type {name}.  If a property type with this
		name already exists an error is given.  Nothing is returned.
		{props} is a dictionary with these optional fields:
		   bufnr	define the property only for this buffer; this
				avoids name collisions and automatically
				clears the property types when the buffer is
				deleted.
		   highlight	name of highlight group to use
		   priority	when a character has multiple text
				properties the one with the highest priority
				will be used; negative values can be used, the
				default priority is zero
		   combine	when TRUE combine the highlight with any
				syntax highlight; when omitted or FALSE syntax
				highlight will not be used
		   start_incl	when TRUE inserts at the start position will
				be included in the text property
		   end_incl	when TRUE inserts at the end position will be
				included in the text property

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetPropName()->prop_type_add(props)

prop_type_change({name}, {props})			*prop_type_change()*
		Change properties of an existing text property type.  If a
		property with this name does not exist an error is given.
		The {props} argument is just like |prop_type_add()|.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetPropName()->prop_type_change(props)

prop_type_delete({name} [, {props}])			*prop_type_delete()*
		Remove the text property type {name}.  When text properties
		using the type {name} are still in place, they will not have
		an effect and can no longer be removed by name.

		{props} can contain a "bufnr" item.  When it is given, delete
		a property type from this buffer instead of from the global
		property types.

		When text property type {name} is not found there is no error.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetPropName()->prop_type_delete()

prop_type_get([{name} [, {props}])			*prop_type_get()*
		Returns the properties of property type {name}.  This is a
		dictionary with the same fields as was given to
		prop_type_add().
		When the property type {name} does not exist, an empty
		dictionary is returned.

		{props} can contain a "bufnr" item.  When it is given, use
		this buffer instead of the global property types.

		See |text-properties| for information about text properties.

		Can also be used as a |method|: >
			GetPropName()->prop_type_get()

prop_type_list([{props}])				*prop_type_list()*
		Returns a list with all property type names.

		{props} can contain a "bufnr" item.  When it is given, use
		this buffer instead of the global property types.

		See |text-properties| for information about text properties.


==============================================================================
3. When text changes				*text-prop-changes*

Vim will do its best to keep the text properties on the text where it was
attached.  When inserting or deleting text the properties after the change
will move accordingly.

When text is deleted and a text property no longer includes any text, it is
deleted.  However, a text property that was defined as zero-width will remain,
unless the whole line is deleted.
								*E275*
When a buffer is unloaded, all the text properties are gone.  There is no way
to store the properties in a file.  You can only re-create them.  When a
buffer is hidden the text is preserved and so are the text properties.  It is
not possible to add text properties to an unloaded buffer.

When using replace mode, the text properties stay on the same character
positions, even though the characters themselves change.

To update text properties after the text was changed, install a callback with
`listener_add()`.  E.g, if your plugin does spell checking, you can have the
callback update spelling mistakes in the changed text.  Vim will move the
properties below the changed text, so that they still highlight the same text,
thus you don't need to update these.


Text property columns are not updated: ~

- When setting the line with |setline()| or through an interface, such as Lua,
  Tcl or Python.  Vim does not know what text got inserted or deleted.


 vim:tw=78:ts=8:noet:ft=help:norl:

Filemanager

Name Type Size Permission Actions
README.Debian File 324 B 0644
arabic.txt File 11.62 KB 0644
autocmd.txt File 68.18 KB 0644
change.txt File 74.89 KB 0644
channel.txt File 47.41 KB 0644
cmdline.txt File 46.88 KB 0644
debug.txt File 6.73 KB 0644
debugger.txt File 5.74 KB 0644
develop.txt File 22.16 KB 0644
diff.txt File 16.43 KB 0644
digraph.txt File 60.43 KB 0644
editing.txt File 71.36 KB 0644
eval.txt File 480.89 KB 0644
farsi.txt File 523 B 0644
filetype.txt File 26.61 KB 0644
fold.txt File 23.13 KB 0644
ft_ada.txt File 17.82 KB 0644
ft_rust.txt File 9.37 KB 0644
ft_sql.txt File 29.98 KB 0644
gui.txt File 50.91 KB 0644
gui_w32.txt File 18.91 KB 0644
gui_x11.txt File 29.08 KB 0644
hangulin.txt File 3.22 KB 0644
hebrew.txt File 5.53 KB 0644
help.txt File 8.69 KB 0644
help.txt.vim-tiny File 1.4 KB 0644
helphelp.txt File 14.09 KB 0644
howto.txt File 2.85 KB 0644
if_cscop.txt File 18.87 KB 0644
if_lua.txt File 15.23 KB 0644
if_mzsch.txt File 11.68 KB 0644
if_ole.txt File 7.19 KB 0644
if_perl.txt File 11.01 KB 0644
if_pyth.txt File 37.44 KB 0644
if_ruby.txt File 8.33 KB 0644
if_sniff.txt File 271 B 0644
if_tcl.txt File 22.43 KB 0644
indent.txt File 40.72 KB 0644
index.txt File 77.7 KB 0644
insert.txt File 82.33 KB 0644
intro.txt File 37.94 KB 0644
map.txt File 64.79 KB 0644
mbyte.txt File 58.25 KB 0644
message.txt File 30.5 KB 0644
mlang.txt File 7.68 KB 0644
motion.txt File 49.89 KB 0644
netbeans.txt File 36.69 KB 0644
options.txt File 378.37 KB 0644
os_390.txt File 4.64 KB 0644
os_amiga.txt File 5.34 KB 0644
os_beos.txt File 10.73 KB 0644
os_dos.txt File 11.74 KB 0644
os_mac.txt File 6.7 KB 0644
os_mint.txt File 1.37 KB 0644
os_msdos.txt File 523 B 0644
os_os2.txt File 299 B 0644
os_qnx.txt File 3.98 KB 0644
os_risc.txt File 328 B 0644
os_unix.txt File 2.54 KB 0644
os_vms.txt File 31.79 KB 0644
os_win32.txt File 13.04 KB 0644
pattern.txt File 58.29 KB 0644
pi_getscript.txt File 20.59 KB 0644
pi_gzip.txt File 1.26 KB 0644
pi_logipat.txt File 4.09 KB 0644
pi_netrw.txt File 172.43 KB 0644
pi_paren.txt File 2.22 KB 0644
pi_spec.txt File 4.03 KB 0644
pi_tar.txt File 6.51 KB 0644
pi_vimball.txt File 11.58 KB 0644
pi_zip.txt File 6.88 KB 0644
popup.txt File 35.68 KB 0644
print.txt File 30.48 KB 0644
quickfix.txt File 77.23 KB 0644
quickref.txt File 70.29 KB 0644
quotes.txt File 12.45 KB 0644
recover.txt File 10.45 KB 0644
remote.txt File 8.22 KB 0644
repeat.txt File 40.06 KB 0644
rileft.txt File 4.82 KB 0644
russian.txt File 2.95 KB 0644
scroll.txt File 13.46 KB 0644
sign.txt File 24.34 KB 0644
spell.txt File 62.38 KB 0644
sponsor.txt File 7.03 KB 0644
starting.txt File 71.58 KB 0644
syntax.txt File 216.25 KB 0644
tabpage.txt File 16.5 KB 0644
tags File 337.32 KB 0644
tags.vim-tiny File 30 B 0644
tagsrch.txt File 38.22 KB 0644
term.txt File 45.81 KB 0644
terminal.txt File 52.45 KB 0644
testing.txt File 12.63 KB 0644
textprop.txt File 13.54 KB 0644
tips.txt File 19.8 KB 0644
todo.txt File 301.55 KB 0644
uganda.txt File 13.7 KB 0644
undo.txt File 16.2 KB 0644
usr_01.txt File 6.93 KB 0644
usr_02.txt File 23.77 KB 0644
usr_03.txt File 23.06 KB 0644
usr_04.txt File 18.64 KB 0644
usr_05.txt File 26.42 KB 0644
usr_06.txt File 9.39 KB 0644
usr_07.txt File 15.61 KB 0644
usr_08.txt File 18.92 KB 0644
usr_09.txt File 11.23 KB 0644
usr_10.txt File 28.5 KB 0644
usr_11.txt File 12.62 KB 0644
usr_12.txt File 13.11 KB 0644
usr_20.txt File 13.39 KB 0644
usr_21.txt File 18.02 KB 0644
usr_22.txt File 14.65 KB 0644
usr_23.txt File 12.41 KB 0644
usr_24.txt File 20.38 KB 0644
usr_25.txt File 18.73 KB 0644
usr_26.txt File 8.07 KB 0644
usr_27.txt File 17.31 KB 0644
usr_28.txt File 15.64 KB 0644
usr_29.txt File 19.65 KB 0644
usr_30.txt File 22.13 KB 0644
usr_31.txt File 10.16 KB 0644
usr_32.txt File 5.25 KB 0644
usr_40.txt File 22.65 KB 0644
usr_41.txt File 91.23 KB 0644
usr_42.txt File 13.53 KB 0644
usr_43.txt File 7.24 KB 0644
usr_44.txt File 28.53 KB 0644
usr_45.txt File 17.24 KB 0644
usr_90.txt File 17.17 KB 0644
usr_toc.txt File 9.05 KB 0644
various.txt File 29.62 KB 0644
version4.txt File 13.58 KB 0644
version5.txt File 301.31 KB 0644
version6.txt File 563.53 KB 0644
version7.txt File 658.96 KB 0644
version8.txt File 1.26 MB 0644
vi_diff.txt File 56.27 KB 0644
vim2html.pl File 4.41 KB 0755
visual.txt File 21.26 KB 0644
windows.txt File 53.64 KB 0644
workshop.txt File 371 B 0644