aboutsummaryrefslogtreecommitdiff
path: root/doc/colorizer-lua.txt
blob: 471bdcc708e6244ae7110ca0b22fee52e48e6f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
*colorizer.lua* Highlight color codes like #RRGGBB and others.

Author: Ashkan Kiani <from-nvim-colorizer.lua@kiani.io>

==============================================================================
INTRODUCTION                                       *colorizer-lua-introduction*

==============================================================================
QUICK START                                          *colorizer-lua-quickstart*

Establish the an autocmd to highlight all filetypes.
>
  lua require 'colorizer'.setup()
<
==============================================================================
LUA API DEFINITION                                          *colorizer-lua-api*

Assumes the module is imported as `colorizer`

|colorizer-options|                                           *colorizer-options*

The available highlight modes are `foreground`, `background`. The default is
`background`.

modes:
- foreground: sets the foreground text color.
- background: sets the background text color.

Full options list:
- `no_names`: Disable parsing names like "Blue"
- `rgb_fn`: Enable parsing `rgb(...)` functions.
- `mode`: Highlight mode. Valid options: `foreground`,`background`


|colorizer.setup|                                               *colorizer.setup*

Easy to use function if you want the full setup without fine grained control.
Establishes an autocmd for `FileType`s .

PARAMETERS:
	`filetypes`	 (optional) filetypes to enable. see examples below
	`default_options`  (optional) |colorizer-options|
>
  colorizer.setup([filetypes=nil], [default_options={}])

  " In your VIMRC
  lua require'colorizer'.setup()

  -- From lua
  -- Attaches to every FileType mode
  require 'colorizer'.setup()
  
  -- Attach to certain Filetypes, add special configuration for `html`
  -- Use `background` for everything else.
  require 'colorizer'.setup {
    'css';
    'javascript';
    html = {
  	  mode = 'foreground';
    }
  }
  
  -- Use the `default_options` as the second parameter, which uses
  -- `foreground` for every mode. This is the inverse of the previous
  -- setup configuration.
  require 'colorizer'.setup({
    'css';
    'javascript';
    html = { mode = 'background' };
  }, { mode = 'foreground' })
  
  -- Use the `default_options` as the second parameter, which uses
  -- `foreground` for every mode. This is the inverse of the previous
  -- setup configuration.
  require 'colorizer'.setup {
    '*'; -- Highlight all files, but customize some others.
    css = { rgb_fn = true; }; -- Enable parsing rgb(...) functions in css.
    html = { no_names = true; } -- Disable parsing "names" like Blue or Gray
  }
<

|colorizer.highlight_buffer|                          *colorizer.highlight_buffer*

Highlight starting from `line_start` (0-indexed) for each line described by `lines` in the
buffer `buf` and attach it to the namespace `ns`.

PARAMETERS:
	`buf`		 buffer id.
	`ns`		 the namespace id. Create it with `vim.api.create_namespace`
	`lines`		 the lines to highlight from the buffer.
	`line_start`	 should be 0-indexed
	`options`	 (optional) |colorizer-options| to set
>
  colorizer.highlight_buffer(buf[, ns=DEFAULT_NAMESPACE], lines, line_start[, rgb_color_table=initialize_colorizer_colors()])
<

|colorizer.attach_to_buffer|                          *colorizer.attach_to_buffer*

Attach to a buffer and continuously highlight changes.

PARAMETERS:
	`buf`	 A value of 0 implies the current buffer.
	`options`	 (optional) |colorizer-options| to set
>
  colorizer.attach_to_buffer(buf[, options={}])
<

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