Re: [vim/vim] Broken link on :h thesaurus (#629)

徐嘉糧 (Vim Github Repository) <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/issues/629/[email protected]>
gubonlucid-com left a comment (vim/vim#629)

> 
> Thesaurus Zip Attached:
> [thesaurus_pkg.zip](https://github.com/vim/vim/files/2634525/thesaurus_pkg.zip)
> 
> The attached thesaurus_pkg.zip contains a thesaurus.txt in the vim space-separated 
> format derived from the Wordnet/MyThes-1 sources. 
> 
> Can the thesaurus.txt be made available on the the ftp site?
> 
> The thesaurus.pkg.zip contains these files:
> 1. A patch file to modify MyThes-1.0 and generate the thesarus.txt file
> thesaurus_pkg/thesaurus-for-vim.patch
> 
> 2. A thesaurus file in the vim format
> thesaurus_pkg/thesaurus.txt
> 
> 3. The WordNet and MyThes-1 licences
> thesaurus_pkg/WordNet_license.txt
> thesaurus_pkg/license.readme
> 
> 
> Notes:
> 1. All distinct terms made of multiple words were removed because the space
> between the words conflicts with the default term delimiter which is a space.
> 
> 2. All terms that didn't have any synonyms were removed.
> 
> 
> Patch File:
> Here is the patch file thesaurus_pkg/thesaurus-for-vim.patch for MyThes-1:
> 
> ```diff
> diff -ruN MyThes-1.0/Makefile MyThes-1.0-vim/Makefile
> --- MyThes-1.0/Makefile	2003-12-08 14:42:33.000000000 -0700
> +++ MyThes-1.0-vim/Makefile	2018-11-30 07:48:21.000000000 -0700
> @@ -21,7 +21,7 @@
>  	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
>  
>  example: example.o $(LIBS)
> -	$(CXX) $(CXXFLAGS) -o $@ example.o $(LDFLAGS)
> +	$(CXX) -o $@ example.o $(LDFLAGS)
>  
>  %.o: %.cxx 
>  	$(CXX) $(CXXFLAGS) -c $<
> diff -ruN MyThes-1.0/README-VIM-THESAURUS MyThes-1.0-vim/README-VIM-THESAURUS
> --- MyThes-1.0/README-VIM-THESAURUS	1969-12-31 17:00:00.000000000 -0700
> +++ MyThes-1.0-vim/README-VIM-THESAURUS	2018-11-30 10:04:10.000000000 -0700
> @@ -0,0 +1,21 @@
> +To create a thesaurus file formatted for vim's thesaurus run:
> +bash ./mk-vim-thesaurus.sh
> +
> +The file 'thesaurus.txt' will be created.
> +
> +Here are the steps that mk-vim-thesaurus.sh takes:
> +
> +1. Extract term list from MyThes-1.0 th_en_US_new.dat file:
> +# Note: This will remove complex words with spaces in them because space is the
> +# default delimiter for vim's thesaurus format.
> +grep -v "^(" th_en_US_new.dat | awk -F"|" '{print $1}' | grep -v ' ' | grep -v 'ISO8859-1' > words-without-spaces.lst
> +
> +2. make example
> +make
> +
> +3. Run mk_vim_thesaurus_format:
> +# Note: While extracting synonyms, multiple word synonyms with spaces are excluded.
> +./example th_en_US_new.idx th_en_US_new.dat words-without-spaces.lst  > raw-list
> +
> +4. Remove entries that don't have synonyms:
> +grep -v "^\w\+$" raw-list > thesaurus.txt 
> diff -ruN MyThes-1.0/example.cxx MyThes-1.0-vim/example.cxx
> --- MyThes-1.0/example.cxx	2003-12-08 14:37:13.000000000 -0700
> +++ MyThes-1.0-vim/example.cxx	2018-11-30 09:00:44.000000000 -0700
> @@ -70,16 +70,20 @@
>        // or count since needed for CleanUpAfterLookup routine
>        mentry* pm = pmean;
>        if (count) {
> -        fprintf(stdout,"%s has %d meanings\n",buf,count);
> -	for (int  i=0; i < count; i++) {
> -          fprintf(stdout,"   meaning %d: %s\n",i,pm->defn);
> +        // initial word
> +        fprintf(stdout,"%s",buf);
> +        for (int  i=0; i < count; i++) {
>            for (int j=0; j < pm->count; j++) {
> -	    fprintf(stdout,"       %s\n",pm->psyns[j]);
> +            // only output the word if it doesn't have spaces
> +            // because space is the standard delimiter in the 
> +            // vim thesaurus file format.
> +            if (strchr(pm->psyns[j], ' ') == NULL)  {
> +              fprintf(stdout," %s",pm->psyns[j]);
> +            }
>            }
> -          fprintf(stdout,"\n");
>            pm++;
> -	}
> -        fprintf(stdout,"\n\n");
> +        }
> +        fprintf(stdout,"\n");
>          // now clean up all allocated memory 
>          pMT->CleanUpAfterLookup(&pmean,count);
>        } else {
> diff -ruN MyThes-1.0/mk-vim-thesaurus.sh MyThes-1.0-vim/mk-vim-thesaurus.sh
> --- MyThes-1.0/mk-vim-thesaurus.sh	1969-12-31 17:00:00.000000000 -0700
> +++ MyThes-1.0-vim/mk-vim-thesaurus.sh	2018-11-30 08:51:15.000000000 -0700
> @@ -0,0 +1,13 @@
> +
> +# Extract term list from MyThes-1.0 th_en_US_new.dat file:
> +grep -v "^(" th_en_US_new.dat | awk -F"|" '{print $1}' | grep -v ' ' | grep -v 'ISO8859-1' > words-without-spaces.lst
> +
> +# make example
> +make
> +
> +#  Run mk_vim_thesaurus_format:
> +./example th_en_US_new.idx th_en_US_new.dat words-without-spaces.lst  > raw-list
> +
> +#  Remove entries that don't have synonyms:
> +grep -v '^\w\+$' raw-list > thesaurus.txt 
> +
> diff -ruN MyThes-1.0/mythes.cxx MyThes-1.0-vim/mythes.cxx
> --- MyThes-1.0/mythes.cxx	2003-12-08 14:40:27.000000000 -0700
> +++ MyThes-1.0-vim/mythes.cxx	2018-11-28 13:12:29.000000000 -0700
> @@ -25,7 +25,7 @@
>  // return index of char in string
>  int mystr_indexOfChar(const char * d, int c)
>  {
> -  char * p = strchr(d,c);
> +  const char * p = strchr(d,c);
>    if (p) return (int)(p-d);
>    return -1;
>  }
> 
> ```

" Vim syntax file
" Language:        Vim help file
" Maintainer:        Bram Moolenaar ([email protected])
" Last Change:        2021 Jun 13

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

syn match helpHeadline                "^[-A-Z .][-A-Z0-9 .()_]*\ze\(\s\+\*\|$\)"
syn match helpSectionDelim        "^===.*===$"
syn match helpSectionDelim        "^---.*--$"
if has("conceal")
  syn region helpExample        matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<" concealends
else
  syn region helpExample        matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<"
endif
syn match helpHyperTextJump        "\\\@<!|[#-)!+-~]\+|" contains=helpBar
syn match helpHyperTextEntry        "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
syn match helpHyperTextEntry        "\*[#-)!+-~]\+\*$" contains=helpStar
if has("conceal")
  syn match helpBar                contained "|" conceal
  syn match helpBacktick        contained "`" conceal
  syn match helpStar                contained "\*" conceal
else
  syn match helpBar                contained "|"
  syn match helpBacktick        contained "`"
  syn match helpStar                contained "\*"
endif
syn match helpNormal                "|.*====*|"
syn match helpNormal                "|||"
syn match helpNormal                ":|vim:|"        " for :help modeline
syn match helpVim                "\<Vim version [0-9][0-9.a-z]*"
syn match helpVim                "VIM REFERENCE.*"
syn match helpVim                "NVIM REFERENCE.*"
syn match helpOption                "'[a-z]\{2,\}'"
syn match helpOption                "'t_..'"
syn match helpCommand                "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
syn match helpCommand                "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
syn match helpHeader                "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
syn match helpGraphic                ".* \ze`$" nextgroup=helpIgnore
if has("conceal")
  syn match helpIgnore                "." contained conceal
else
  syn match helpIgnore                "." contained
endif
syn keyword helpNote                note Note NOTE note: Note: NOTE: Notes Notes:
syn keyword helpWarning                WARNING WARNING: Warning:
syn keyword helpDeprecated        DEPRECATED DEPRECATED: Deprecated:
syn match helpSpecial                "\<N\>"
syn match helpSpecial                "\<N\.$"me=e-1
syn match helpSpecial                "\<N\.\s"me=e-2
syn match helpSpecial                "(N\>"ms=s+1

syn match helpSpecial                "\[N]"
" avoid highlighting N  N in help.txt
syn match helpSpecial                "N  N"he=s+1
syn match helpSpecial                "Nth"me=e-2
syn match helpSpecial                "N-1"me=e-2
syn match helpSpecial                "{[-_a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
syn match helpSpecial                "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
syn match helpSpecial                "<[-a-zA-Z0-9_]\+>"
syn match helpSpecial                "<[SCM]-.>"
syn match helpNormal                "<---*>"
syn match helpSpecial                "\[range]"
syn match helpSpecial                "\[line]"
syn match helpSpecial                "\[count]"
syn match helpSpecial                "\[offset]"
syn match helpSpecial                "\[cmd]"
syn match helpSpecial                "\[num]"
syn match helpSpecial                "\[+num]"
syn match helpSpecial                "\[-num]"
syn match helpSpecial                "\[+cmd]"
syn match helpSpecial                "\[++opt]"
syn match helpSpecial                "\[arg]"
syn match helpSpecial                "\[arguments]"
syn match helpSpecial                "\[ident]"
syn match helpSpecial                "\[addr]"
syn match helpSpecial                "\[group]"
" Don't highlight [converted] and others that do not have a tag
syn match helpNormal                "\[\(readonly\|fifo\|socket\|converted\|crypted\)]"

syn match helpSpecial                "CTRL-."
syn match helpSpecial                "CTRL-SHIFT-."
syn match helpSpecial                "CTRL-Break"
syn match helpSpecial                "CTRL-PageUp"
syn match helpSpecial                "CTRL-PageDown"
syn match helpSpecial                "CTRL-Insert"
syn match helpSpecial                "CTRL-Del"
syn match helpSpecial                "CTRL-{char}"
syn match helpSpecial                "META-."
syn match helpSpecial                "ALT-."

" Highlight group items in their own color.
syn match helpComment                "\t[* ]Comment\t\+[a-z].*"
syn match helpConstant                "\t[* ]Constant\t\+[a-z].*"
syn match helpString                "\t[* ]String\t\+[a-z].*"
syn match helpCharacter                "\t[* ]Character\t\+[a-z].*"
syn match helpNumber                "\t[* ]Number\t\+[a-z].*"
syn match helpBoolean                "\t[* ]Boolean\t\+[a-z].*"
syn match helpFloat                "\t[* ]Float\t\+[a-z].*"
syn match helpIdentifier        "\t[* ]Identifier\t\+[a-z].*"
syn match helpFunction                "\t[* ]Function\t\+[a-z].*"
syn match helpStatement                "\t[* ]Statement\t\+[a-z].*"
syn match helpConditional        "\t[* ]Conditional\t\+[a-z].*"
syn match helpRepeat                "\t[* ]Repeat\t\+[a-z].*"
syn match helpLabel                "\t[* ]Label\t\+[a-z].*"
syn match helpOperator                "\t[* ]Operator\t\+["a-z].*"
syn match helpKeyword                "\t[* ]Keyword\t\+[a-z].*"
syn match helpException                "\t[* ]Exception\t\+[a-z].*"
syn match helpPreProc                "\t[* ]PreProc\t\+[a-z].*"
syn match helpInclude                "\t[* ]Include\t\+[a-z].*"
syn match helpDefine                "\t[* ]Define\t\+[a-z].*"
syn match helpMacro                "\t[* ]Macro\t\+[a-z].*"
syn match helpPreCondit                "\t[* ]PreCondit\t\+[a-z].*"
syn match helpType                "\t[* ]Type\t\+[a-z].*"
syn match helpStorageClass        "\t[* ]StorageClass\t\+[a-z].*"
syn match helpStructure                "\t[* ]Structure\t\+[a-z].*"
syn match helpTypedef                "\t[* ]Typedef\t\+[Aa-z].*"
syn match helpSpecial                "\t[* ]Special\t\+[a-z].*"
syn match helpSpecialChar        "\t[* ]SpecialChar\t\+[a-z].*"
syn match helpTag                "\t[* ]Tag\t\+[a-z].*"
syn match helpDelimiter                "\t[* ]Delimiter\t\+[a-z].*"
syn match helpSpecialComment        "\t[* ]SpecialComment\t\+[a-z].*"
syn match helpDebug                "\t[* ]Debug\t\+[a-z].*"
syn match helpUnderlined        "\t[* ]Underlined\t\+[a-z].*"
syn match helpError                "\t[* ]Error\t\+[a-z].*"
syn match helpTodo                "\t[* ]Todo\t\+[a-z].*"

syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'         <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'         <>"]+)[a-zA-Z0-9/]`

" Additionally load a language-specific syntax file "help_ab.vim".
let s:i = match(expand("%"), '\.\a\ax$')
if s:i > 0
  exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
endif

" Italian
if v:lang =~ '\<IT\>' || v:lang =~ '_IT\>' || v:lang =~? "italian"
  syn keyword helpNote                nota Nota NOTA nota: Nota: NOTA: notare Notare NOTARE notare: Notare: NOTARE:
  syn match helpSpecial                "Nma"me=e-2
  syn match helpSpecial                "Nme"me=e-2
  syn match helpSpecial                "Nmi"me=e-2
  syn match helpSpecial                "Nmo"me=e-2
  syn match helpSpecial                "\[interv.]"
endif

syn sync minlines=40


" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link helpIgnore                Ignore
hi def link helpHyperTextJump        Identifier
hi def link helpBar                Ignore
hi def link helpBacktick        Ignore
hi def link helpStar                Ignore
hi def link helpHyperTextEntry        String
hi def link helpHeadline        Statement
hi def link helpHeader                PreProc
hi def link helpSectionDelim        PreProc
hi def link helpVim                Identifier
hi def link helpCommand                Comment
hi def link helpExample                Comment
hi def link helpOption                Type
hi def link helpSpecial                Special
hi def link helpNote                Todo
hi def link helpWarning                Todo
hi def link helpDeprecated        Todo

hi def link helpComment                Comment
hi def link helpConstant        Constant
hi def link helpString                String
hi def link helpCharacter        Character
hi def link helpNumber                Number
hi def link helpBoolean                Boolean
hi def link helpFloat                Float
hi def link helpIdentifier        Identifier
hi def link helpFunction        Function
hi def link helpStatement        Statement
hi def link helpConditional        Conditional
hi def link helpRepeat                Repeat
hi def link helpLabel                Label
hi def link helpOperator        Operator
hi def link helpKeyword                Keyword
hi def link helpException        Exception
hi def link helpPreProc                PreProc
hi def link helpInclude                Include
hi def link helpDefine                Define
hi def link helpMacro                Macro
hi def link helpPreCondit        PreCondit
hi def link helpType                Type
hi def link helpStorageClass        StorageClass
hi def link helpStructure        Structure
hi def link helpTypedef                Typedef
hi def link helpSpecialChar        SpecialChar
hi def link helpTag                Tag
hi def link helpDelimiter        Delimiter
hi def link helpSpecialComment        SpecialComment
hi def link helpDebug                Debug
hi def link helpUnderlined        Underlined
hi def link helpError                Error
hi def link helpTodo                Todo
hi def link helpURL                String

let b:current_syntax = "help"

let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8 sw=2


-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/issues/629#issuecomment-5369678217
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/issues/629/[email protected]>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/629/5369678217%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.