From :h :tcl:
:tc[l] {cmd} Execute Tcl command {cmd}. A simple check if
:tcl
is working: >
:tcl puts "Hello"
:[range]tc[l] << [trim] [{endmarker}]
{script}
{endmarker}
Execute Tcl script {script}.
Note: This command doesn't work when the Tcl feature
wasn't compiled in. To avoid errors, see
|script-here|.
The help says that :tc is the abbreviation of :tcl. That might have been true in the past, but that's no longer the case; now, :tc is the abbreviation of :tcd (introduced in 8.1.1218).
Patch fixing the documentation:
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 1351d4e96..ef45e61fb 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1320,8 +1320,8 @@ present in 'cpoptions' and "!" is not used in the command. *:chd* *:chdir* :chd[ir][!] [path] Same as |:cd|. - *:tcd* -:tcd[!] {path} Like |:cd|, but only set the directory for the current + *:tc* *:tcd* +:tc[d][!] {path} Like |:cd|, but only set the directory for the current tab. The current window will also use this directory. The current directory is not changed for windows in other tabs and for windows in the current tab that @@ -1331,7 +1331,7 @@ present in 'cpoptions' and "!" is not used in the command. :tch[dir][!] Same as |:tcd|. *:tcd-* -:tcd[!] - Change to the previous current directory, before the +:tc[d][!] - Change to the previous current directory, before the last ":tcd {path}" command. *:lc* *:lcd* diff --git a/runtime/doc/if_tcl.txt b/runtime/doc/if_tcl.txt index 90dec9dba..8290f7ba0 100644 --- a/runtime/doc/if_tcl.txt +++ b/runtime/doc/if_tcl.txt @@ -25,12 +25,12 @@ comments, ideas etc to <Ingo....@informatik.uni-oldenburg.de> ============================================================================== 1. Commands *tcl-ex-commands* *E571* *E572* - *:tcl* *:tc* -:tc[l] {cmd} Execute Tcl command {cmd}. A simple check if `:tcl` + *:tcl* +:tcl {cmd} Execute Tcl command {cmd}. A simple check if `:tcl` is working: > :tcl puts "Hello" -:[range]tc[l] << [trim] [{endmarker}] +:[range]tcl << [trim] [{endmarker}] {script} {endmarker} Execute Tcl script {script}.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Good catch. Out of curiosity: did you detect this by luck or do you have an automated way of finding whether the doc is inconsistent with the actual command being run? I wonder whether we'd find other similar discrepancies if we wrote a script to check this.
did you detect this by luck or do you have an automated way of finding whether the doc is inconsistent with the actual command being run?
I guess it's a bit of both (luck + automated way). I'm rewriting the default Vim syntax plugin to get a better highlighting in Vim9 scripts (e.g. the types are not highlighted). In doing so, I'm trying to build programmatically the command responsible for the vimCommand syntax group. For the moment, this is what I have:
vim9script def Func(): string var cmds: list<string> for cmd in getcompletion('', 'command') ->filter((_, v: string): bool => v =~ '^[a-z]') var l: number for len in strcharlen(cmd)->range()->reverse() if len == 0 continue endif if cmd->slice(0, len)->fullcommand() != cmd l = len break endif endfor if l == cmd->strcharlen() - 1 cmds += [cmd] else cmds += [cmd[: l] .. '[' .. cmd[l + 1 :] .. ']'] endif endfor # TODO: Why is `mapclear` in `vimMap` while `vmapclear` is in `vimCommand`? var to_remove: list<string> =<< trim END a[ppend] ab[breviate] au[tocmd] aug[roup] c[hange] ca[bbrev] cm[ap] cno[remap] cnorea[bbrev] com[mand] cu[nmap] do[autocmd] doautoa[ll] echoh[l] final finall[y] g[lobal] im[ap] hi[ghlight] i[nsert] ia[bbrev] ino[remap] inorea[bbrev] iu[nmap] keepalt keepjumps keepmarks keeppatterns let lm[ap] ln[oremap] lu[nmap] map mapc[lear] nm[ap] nn[oremap] no[remap] norea[bbrev] norm[al] nun[map] o[pen] om[ap] ono[remap] ou[nmap] s[ubstitute] smap smapc[lear] snor[emap] sunm[ap] sy[ntax] t unm[ap] v[global] vm[ap] vn[oremap] vu[nmap] xm[ap] xn[oremap] xu[nmap] END for c in to_remove var i: number = cmds->index(c) if i == -1 continue endif cmds->remove(i) endfor var missing: list<string> =<< trim END addd fina[lly] in kee[pmarks] keepa[lt] keepj[umps] keepp[atterns] END cmds += missing # TODO: Once this issue is fixed: # https://github.com/vim/vim/issues/8256#issuecomment-847668403 # Remove all references to `:keep*` commands from this function. return cmds->join() enddef echo Func()
To check how reliable the function is, I've diff'ed its output against the command names of the default Vim syntax plugin. In particular, the diff showed this name in the original plugin:
tc[l]
tcd
While my function showed this:
tc[d]
tcl
Since the lines are different, I wanted to know which ones were right, so I ran :tc which prints the tab-local working directory, contradicting the help. There might be a way to automate this kind of check, but I'm not sure.
Closed #8258.