Mercurial > vim
comparison runtime/doc/eval.txt @ 26057:92c424550367 v8.2.3562
patch 8.2.3562: cannot add color names
Commit: https://github.com/vim/vim/commit/e30d10253fa634c4f60daa798d029245f4eed393
Author: Drew Vogel <dvogel@github>
Date: Sun Oct 24 20:35:07 2021 +0100
patch 8.2.3562: cannot add color names
Problem: Cannot add color names.
Solution: Add the v:colornames dictionary. (Drew Vogel, closes https://github.com/vim/vim/issues/8761)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 24 Oct 2021 21:45:04 +0200 |
parents | ebedba7a4898 |
children | c544eacaf066 |
comparison
equal
deleted
inserted
replaced
26056:977bbbf36908 | 26057:92c424550367 |
---|---|
1837 current locale encoding. Technical: it's the value of | 1837 current locale encoding. Technical: it's the value of |
1838 LC_COLLATE. When not using a locale the value is "C". | 1838 LC_COLLATE. When not using a locale the value is "C". |
1839 This variable can not be set directly, use the |:language| | 1839 This variable can not be set directly, use the |:language| |
1840 command. | 1840 command. |
1841 See |multi-lang|. | 1841 See |multi-lang|. |
1842 | |
1843 *v:colornames* | |
1844 v:colornames A dictionary that maps color names to hex color strings. These | |
1845 color names can be used with the |highlight-guifg|, | |
1846 |highlight-guibg|, and |highlight-guisp| parameters. Updating | |
1847 an entry in v:colornames has no immediate effect on the syntax | |
1848 highlighting. The highlight commands (probably in a | |
1849 colorscheme script) need to be re-evaluated in order to use | |
1850 the updated color values. For example: > | |
1851 | |
1852 :let v:colornames['fuscia'] = '#cf3ab4' | |
1853 :let v:colornames['mauve'] = '#915f6d' | |
1854 :highlight Normal guifg=fuscia guibg=mauve | |
1855 < | |
1856 This cannot be used to override the |cterm-colors| but it can | |
1857 be used to override other colors. For example, the X11 colors | |
1858 defined in the `colors/lists/default.vim` (previously defined | |
1859 in |rgb.txt|). When defining new color names in a plugin, the | |
1860 recommended practice is to set a color entry only when it does | |
1861 not already exist. For example: > | |
1862 | |
1863 :call extend(v:colornames, { | |
1864 \ 'fuscia': '#cf3ab4', | |
1865 \ 'mauve': '#915f6d, | |
1866 \ }, 'keep') | |
1867 < | |
1868 Using |extend| with the 'keep' option updates each color only | |
1869 if it did not exist in |v:colornames|. Doing so allows the | |
1870 user to choose the precise color value for a common name | |
1871 by setting it in their |.vimrc|. | |
1872 | |
1873 It is possible to remove entries from this dictionary but | |
1874 doing so is *NOT* recommended. Doing so is disruptive to | |
1875 other scripts. It is also unlikely to achieve the desired | |
1876 result because the |colorscheme| and |highlight| commands will | |
1877 both automatically load all `colors/lists/default.vim` color | |
1878 scripts. | |
1842 | 1879 |
1843 *v:completed_item* *completed_item-variable* | 1880 *v:completed_item* *completed_item-variable* |
1844 v:completed_item | 1881 v:completed_item |
1845 |Dictionary| containing the |complete-items| for the most | 1882 |Dictionary| containing the |complete-items| for the most |
1846 recently completed word after |CompleteDone|. The | 1883 recently completed word after |CompleteDone|. The |