annotate runtime/gvimrc_example.vim @ 33399:95db67c7b754 v9.0.1958

patch 9.0.1958: cannot complete option values Commit: https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Fri Sep 29 20:42:32 2023 +0200 patch 9.0.1958: cannot complete option values Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=<Tab>` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: #13182 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Fri, 29 Sep 2023 20:45:04 +0200
parents 4027cefc2aab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " An example for a gvimrc file.
8853
48b4c1c284fb commit https://github.com/vim/vim/commit/54f1b7abf8c48b1dd997202258d1d0673ed4bd29
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
2 " The commands in this are executed when the GUI is started, after the vimrc
48b4c1c284fb commit https://github.com/vim/vim/commit/54f1b7abf8c48b1dd997202258d1d0673ed4bd29
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
3 " has been executed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 "
32770
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 19526
diff changeset
5 " Maintainer: The Vim Project <https://github.com/vim/vim>
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 19526
diff changeset
6 " Last Change: 2023 Aug 10
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 19526
diff changeset
7 " Former Maintainer: Bram Moolenaar <Bram@vim.org>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " To use it, copy it to
19526
22f0dda71638 patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents: 18912
diff changeset
10 " for Unix: ~/.gvimrc
22f0dda71638 patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents: 18912
diff changeset
11 " for Amiga: s:.gvimrc
22f0dda71638 patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents: 18912
diff changeset
12 " for MS-Windows: $VIM\_gvimrc
22f0dda71638 patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents: 18912
diff changeset
13 " for Haiku: ~/config/settings/vim/gvimrc
22f0dda71638 patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents: 18912
diff changeset
14 " for OpenVMS: sys$login:.gvimrc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " Make external commands work through a pipe instead of a pseudo-tty
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 "set noguipty
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " set the X11 font to use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 set ch=2 " Make command line two lines high
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 set mousehide " Hide the mouse when typing text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " Make shift-insert work like in Xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 map <S-Insert> <MiddleMouse>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 map! <S-Insert> <MiddleMouse>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " Only do this for Vim version 5.0 and later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 if version >= 500
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " Switch on syntax highlighting if it wasn't on yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 if !exists("syntax_on")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syntax on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " For Win32 version, have "K" lookup the keyword in a help file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 "if has("win32")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " let winhelpfile='windows.hlp'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " map K :execute "!start winhlp32 -k <cword> " . winhelpfile <CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 "endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Set nice colors
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 " background for normal text is light grey
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 " Text below the last line is darker grey
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 " Cursor is green, Cyan when ":lmap" mappings are active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 " Constants are not underlined but have a slightly lighter background
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 highlight Normal guibg=grey90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 highlight Cursor guibg=Green guifg=NONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 highlight lCursor guibg=Cyan guifg=NONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 highlight NonText guibg=grey80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 highlight Constant gui=NONE guibg=grey95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 highlight Special gui=NONE guibg=grey95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 endif