Mercurial > vim
view runtime/syntax/lftp.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 | 1218c5353e2b |
children |
line wrap: on
line source
" Vim syntax file " Language: lftp(1) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Revision: 2007-06-17 if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim setlocal iskeyword+=- syn region lftpComment display oneline start='#' end='$' \ contains=lftpTodo,@Spell syn keyword lftpTodo contained TODO FIXME XXX NOTE syn region lftpString contained display \ start=+"+ skip=+\\$\|\\"+ end=+"+ end=+$+ syn match lftpNumber contained display '\<\d\+\(\.\d\+\)\=\>' syn keyword lftpBoolean contained yes no on off true false syn keyword lftpInterval contained infinity inf never forever syn match lftpInterval contained '\<\(\d\+\(\.\d\+\)\=[dhms]\)\+\>' syn keyword lftpKeywords alias anon at bookmark cache cat cd chmod close \ cls command debug du echo exit fg find get \ get1 glob help history jobs kill lcd lftp \ lpwd ls mget mirror mkdir module more mput \ mrm mv nlist open pget put pwd queue quote \ reget recls rels renlist repeat reput rm \ rmdir scache site source suspend user version \ wait zcat zmore syn region lftpSet matchgroup=lftpKeywords \ start="set" end=";" end="$" \ contains=lftpString,lftpNumber,lftpBoolean, \ lftpInterval,lftpSettingsPrefix,lftpSettings syn match lftpSettingsPrefix contained '\<\%(bmk\|cache\|cmd\|color\|dns\):' syn match lftpSettingsPrefix contained '\<\%(file\|fish\|ftp\|hftp\):' syn match lftpSettingsPrefix contained '\<\%(http\|https\|mirror\|module\):' syn match lftpSettingsPrefix contained '\<\%(net\|sftp\|ssl\|xfer\):' " bmk: syn keyword lftpSettings contained save-p[asswords] " cache: syn keyword lftpSettings contained cache-em[pty-listings] en[able] \ exp[ire] siz[e] " cmd: syn keyword lftpSettings contained at[-exit] cls-c[ompletion-default] \ cls-d[efault] cs[h-history] \ default-p[rotocol] default-t[itle] syn keyword lftpSettings contained fai[l-exit] in[teractive] \ lo[ng-running] ls[-default] mo[ve-background] \ prom[pt] \ rem[ote-completion] \ save-c[wd-history] save-r[l-history] \ set-t[erm-status] statu[s-interval] \ te[rm-status] verb[ose] verify-h[ost] \ verify-path verify-path[-cached] " color: syn keyword lftpSettings contained dir[-colors] use-c[olor] " dns: syn keyword lftpSettings contained S[RV-query] cache-en[able] \ cache-ex[pire] cache-s[ize] \ fat[al-timeout] o[rder] use-fo[rk] " file: syn keyword lftpSettings contained ch[arset] " fish: syn keyword lftpSettings contained connect[-program] sh[ell] " ftp: syn keyword lftpSettings contained acct anon-p[ass] anon-u[ser] \ au[to-sync-mode] b[ind-data-socket] \ ch[arset] cli[ent] dev[ice-prefix] \ fi[x-pasv-address] fxp-f[orce] \ fxp-p[assive-source] h[ome] la[ng] \ list-e[mpty-ok] list-o[ptions] \ nop[-interval] pas[sive-mode] \ port-i[pv4] port-r[ange] prox[y] \ rest-l[ist] rest-s[tor] \ retry-530 retry-530[-anonymous] \ sit[e-group] skey-a[llow] \ skey-f[orce] ssl-allow \ ssl-allow[-anonymous] ssl-au[th] \ ssl-f[orce] ssl-protect-d[ata] \ ssl-protect-l[ist] stat-[interval] \ sy[nc-mode] timez[one] use-a[bor] \ use-fe[at] use-fx[p] use-hf[tp] \ use-mdtm use-mdtm[-overloaded] \ use-ml[sd] use-p[ret] use-q[uit] \ use-site-c[hmod] use-site-i[dle] \ use-site-u[time] use-siz[e] \ use-st[at] use-te[lnet-iac] \ verify-a[ddress] verify-p[ort] \ w[eb-mode] " hftp: syn keyword lftpSettings contained w[eb-mode] cache prox[y] \ use-au[thorization] use-he[ad] use-ty[pe] " http: syn keyword lftpSettings contained accept accept-c[harset] \ accept-l[anguage] cache coo[kie] \ pos[t-content-type] prox[y] \ put-c[ontent-type] put-m[ethod] ref[erer] \ set-c[ookies] user[-agent] " https: syn keyword lftpSettings contained prox[y] " mirror: syn keyword lftpSettings contained exc[lude-regex] o[rder] \ parallel-d[irectories] \ parallel-t[ransfer-count] use-p[get-n] " module: syn keyword lftpSettings contained pat[h] " net: syn keyword lftpSettings contained connection-l[imit] \ connection-t[akeover] id[le] limit-m[ax] \ limit-r[ate] limit-total-m[ax] \ limit-total-r[ate] max-ret[ries] no-[proxy] \ pe[rsist-retries] reconnect-interval-b[ase] \ reconnect-interval-ma[x] \ reconnect-interval-mu[ltiplier] \ socket-bind-ipv4 socket-bind-ipv6 \ socket-bu[ffer] socket-m[axseg] timeo[ut] " sftp: syn keyword lftpSettings contained connect[-program] \ max-p[ackets-in-flight] prot[ocol-version] \ ser[ver-program] size-r[ead] size-w[rite] " ssl: syn keyword lftpSettings contained ca-f[ile] ca-p[ath] ce[rt-file] \ crl-f[ile] crl-p[ath] k[ey-file] \ verify-c[ertificate] " xfer: syn keyword lftpSettings contained clo[bber] dis[k-full-fatal] \ eta-p[eriod] eta-t[erse] mak[e-backup] \ max-red[irections] ra[te-period] hi def link lftpComment Comment hi def link lftpTodo Todo hi def link lftpString String hi def link lftpNumber Number hi def link lftpBoolean Boolean hi def link lftpInterval Number hi def link lftpKeywords Keyword hi def link lftpSettingsPrefix PreProc hi def link lftpSettings Type let b:current_syntax = "lftp" let &cpo = s:cpo_save unlet s:cpo_save