-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c9cea8d
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
cmp-color-names.nvim | ||
==================== | ||
|
||
![X11 / web color names](./colors.jpg) | ||
|
||
This Neovim plugin provides an | ||
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) completion source | ||
for X11 / web color names like `SlateBlue` and `SeaGreen`. | ||
|
||
Installation | ||
------------ | ||
|
||
Using [Packer](https://github.com/wbthomason/packer.nvim): | ||
```lua | ||
use({ | ||
'https://https://github.com/nat-418/cmp-color-names.nvim', | ||
config = { | ||
require('cmp-color-names').setup() | ||
} | ||
}) | ||
``` | ||
|
||
Configuration | ||
------------- | ||
|
||
Add this source to your `nvim-cmp` configuration: | ||
|
||
```lua | ||
cmp.setup({ | ||
sources = cmp.config.sources({ | ||
{ name = 'luasnip' }, | ||
}, { | ||
{ name = 'path' }, | ||
{ name = 'calc' }, | ||
{ name = 'git' }, | ||
{ name = 'buffer' }, | ||
{ name = 'omni' }, | ||
{ name = 'color_names'}, | ||
}) | ||
}) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
local M = {} | ||
local source = {} | ||
|
||
function source:is_available() return true end | ||
function source:get_debug_name() return 'color_names' end | ||
function source:get_keyword_pattern() return [[\k\+]] end | ||
function source:get_trigger_characters() return { '.' } end | ||
|
||
-- -- X11 / web color names | ||
local color_names_table = { | ||
{label = 'White'}, {label = 'Snow'}, {label = 'Ivory'}, {label = 'Linen'}, | ||
{label = 'AntiqueWhite'}, {label = 'Beige'}, {label = 'WhiteSmoke'}, | ||
{label = 'LavenderBlush'}, {label = 'OldLace'}, {label = 'AliceBlue'}, | ||
{label = 'SeaShell'}, {label = 'GhostWhite'}, {label = 'Honeydew'}, | ||
{label = 'FloralWhite'}, {label = 'Azure'}, {label = 'MintCream'}, | ||
{label = 'Black'}, {label = 'DarkSlateGray'}, {label = 'DimGray'}, | ||
{label = 'SlateGray'}, {label = 'Gray'}, {label = 'LightSlateGray'}, | ||
{label = 'Silver'}, {label = 'LightGray'}, {label = 'Gainsboro'}, | ||
{label = 'Pink'}, {label = 'LightPink'}, {label = 'HotPink'}, | ||
{label = 'PaleVioletRed'}, {label = 'DeepPink'}, {label = 'MediumVioletRed'}, | ||
{label = 'Indigo'}, {label = 'Purple'}, {label = 'DarkMagenta'}, | ||
{label = 'DarkViolet'}, {label = 'DarkSlateBlue'}, {label = 'BlueViolet'}, | ||
{label = 'DarkOrchid'}, {label = 'Fuchsia'}, {label = 'Magenta'}, | ||
{label = 'SlateBlue'}, {label = 'MediumSlateBlue'}, {label = 'MediumOrchid'}, | ||
{label = 'MediumPurple'}, {label = 'Orchid'}, {label = 'Violet'}, | ||
{label = 'Plum'}, {label = 'Thistle'}, {label = 'Lavender'}, | ||
{label = 'DarkRed'}, {label = 'Red'}, {label = 'Firebrick'}, | ||
{label = 'Crimson'}, {label = 'IndianRed'}, {label = 'LightCoral'}, | ||
{label = 'Salmon'}, {label = 'DarkSalmon'}, {label = 'LightSalmon'}, | ||
{label = 'OrangeRed'}, {label = 'Tomato'}, {label = 'DarkOrange'}, | ||
{label = 'Coral'}, {label = 'Orange'}, {label = 'DarkKhaki'}, | ||
{label = 'Gold'}, {label = 'Khaki'}, {label = 'PeachPuff'}, | ||
{label = 'Yellow'}, {label = 'PaleGoldenRod'}, {label = 'Moccasin'}, | ||
{label = 'PapayaWhip'}, {label = 'LightGoldenRodYellow'}, | ||
{label = 'LemonChiffon'}, {label = 'LightYellow'}, {label = 'MidnightBlue'}, | ||
{label = 'Navy'}, {label = 'DarkBlue'}, {label = 'MediumBlue'}, | ||
{label = 'Blue'}, {label = 'RoyalBlue'}, {label = 'SteelBlue'}, | ||
{label = 'DodgerBlue'}, {label = 'DeepSkyBlue'}, {label = 'CornFlowerBlue'}, | ||
{label = 'SkyBlue'}, {label = 'LightSkyBlue'}, {label = 'LightSteelBlue'}, | ||
{label = 'LightBlue'}, {label = 'PowderBlue'}, {label = 'Maroon'}, | ||
{label = 'Brown'}, {label = 'SaddleBrown'}, {label = 'Sienna'}, | ||
{label = 'Chocolate'}, {label = 'DarkGoldenRod'}, {label = 'Peru'}, | ||
{label = 'RosyBrown'}, {label = 'GoldenRod'}, {label = 'SandyBrown'}, | ||
{label = 'Tan'}, {label = 'BurlyWood'}, {label = 'Wheat'}, | ||
{label = 'NavajoWhite'}, {label = 'Bisque'}, {label = 'BlanchedAlmond'}, | ||
{label = 'Cornsilk'}, {label = 'Teal'}, {label = 'DarkCyan'}, | ||
{label = 'LightSeaGreen'}, {label = 'CadetBlue'}, {label = 'DarkTurquoise'}, | ||
{label = 'MediumTurquoise'}, {label = 'Turquoise'}, {label = 'Aqua'}, | ||
{label = 'Cyan'}, {label = 'Aquamarine'}, {label = 'PaleTurquoise'}, | ||
{label = 'LightCyan'}, {label = 'DarkGreen'}, {label = 'Green'}, | ||
{label = 'DarkOliveGreen'}, {label = 'ForestGreen'}, {label = 'SeaGreen'}, | ||
{label = 'Olive'}, {label = 'OliveDrab'}, {label = 'MediumSeaGreen'}, | ||
{label = 'LimeGreen'}, {label = 'Lime'}, {label = 'SpringGreen'}, | ||
{label = 'MediumSpringGreen'}, {label = 'DarkSeaGreen'}, | ||
{label = 'MediumAquamarine'}, {label = 'YellowGreen'}, | ||
{label = 'LawnGreen'}, {label = 'Chartreuse'}, {label = 'LightGreen'}, | ||
{label = 'GreenYellow'}, {label = 'PaleGreen'} | ||
} | ||
|
||
function source:complete(_, callback) callback(color_names_table) end | ||
function source:resolve(completion, callback) callback(completion) end | ||
function source:execute(completion, callback) callback(completion) end | ||
|
||
M.setup = function() | ||
require('cmp').register_source('color_names', source) | ||
end | ||
|
||
return M |