forked from adaptee/pinyin-completion
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡ Use cpp-pinyin to replace pypinyin
- Loading branch information
Showing
135 changed files
with
137,011 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
*.zwc | ||
/tests/_output/ | ||
|
||
.cache/ | ||
*.zwc | ||
# cd module/ | ||
# Src/mkmakemod.sh Src/zi Makefile | ||
!module/Src/zi/Makefile.in | ||
COMPILED_AT | ||
compile_commands.json | ||
*.mdh | ||
*.mdhs | ||
*.mdhi | ||
*.export | ||
*.epro | ||
*.pro | ||
*.syms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# [:ascii:] need | ||
setopt rematchpcre | ||
local -A _punctuation_map=( | ||
[~]=~ | ||
[!]=! | ||
[@]=@ | ||
[#]='#' | ||
[$]=$ | ||
[%]=% | ||
[&]='&' | ||
[*]=* | ||
[(]='(' | ||
[)]=')' | ||
[_]=_ | ||
[-]=- | ||
[+]=+ | ||
[[]='[' | ||
[]]=']' | ||
[「]='[' | ||
[」]=']' | ||
[【]='[' | ||
[】]=']' | ||
[〔]='[' | ||
[〕]=']' | ||
[<]='<' | ||
[>]='>' | ||
[《]='<' | ||
[》]='>' | ||
[«]='<' | ||
[»]='>' | ||
[‹]='<' | ||
[›]='>' | ||
[?]=? | ||
[,]=, | ||
[。]=. | ||
[/]=/ | ||
[\]=\\ | ||
[、]=\\ | ||
[…]=... | ||
) | ||
|
||
# unix file names can contain '\n', so use '\0' to separate them | ||
local IFS=$'\0' suffix='' file result k v | ||
local -a files results | ||
if [ "$words[1]" = cd ] ; then | ||
suffix=/ | ||
fi | ||
# print -N use '\0' to separate outputs | ||
for file in $(print -nN ${1:h}/*"$suffix"); do | ||
file="${file#./}" | ||
result="$file" | ||
if [[ $result =~ [^[:ascii:]] ]]; then | ||
for k v in ${(kv)FUZZY} ${(kv)_punctuation_map}; do | ||
result="${result//$k/$v}" | ||
done | ||
zpinyin hanziToPinyin $result result | ||
results=(${(s. .)result}) | ||
result= | ||
for v in $results; do | ||
k=${v[-1]} | ||
if [[ $k == 1 || $k == 2 || $k == 3 || $k == 4 ]]; then | ||
v="${v[1]}" | ||
fi | ||
result="$result$v" | ||
done | ||
fi | ||
if [[ $result == $1* ]]; then | ||
reply+=(${(q)file}) | ||
fi | ||
done | ||
|
||
# ex: filetype=zsh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#compdef zpinyin | ||
local subcommands=( | ||
setDictionaryPath | ||
hanziToPinyin | ||
) | ||
|
||
_arguments -s -S \ | ||
": :(($subcommands))" \ | ||
'*:: :->option-or-argument' | ||
|
||
if [[ $state != option-or-argument ]]; then | ||
return | ||
fi | ||
local curcontext=${curcontext%:*:*}:zpinyin-$words[1]: | ||
case $words[1] in | ||
setDictionaryPath) | ||
_dirs | ||
;; | ||
hanziToPinyin) | ||
_arguments -s -S \ | ||
{-t,--man_tone_style}"[Pinyin::ManTone::Style]:(0 1 2 8)" \ | ||
{-e,--error}"[Pinyin::Error]:(default ignore)" \ | ||
{-c,--candidates}"[display candidates]" \ | ||
{-v,--v_to_u}"[convert v to u]" \ | ||
":hanzi" \ | ||
":\$pinyin" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Makefile | ||
META-FAQ | ||
config.cache | ||
config.h | ||
config.h.in | ||
config.log | ||
config.modules | ||
config.modules.sh | ||
config.status | ||
configure | ||
cscope.out | ||
stamp-h | ||
stamp-h.in | ||
autom4te.cache | ||
*.swp | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DISTFILES_SRC=' | ||
META-FAQ | ||
configure config.h.in stamp-h.in | ||
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Space or Tabs? | ||
# https://stackoverflow.com/questions/35649847/objective-reasons-for-using-spaces-instead-of-tabs-for-indentation | ||
# https://stackoverflow.com/questions/12093748/how-to-use-tabs-instead-of-spaces-in-a-shell-script | ||
# https://github.com/editorconfig/editorconfig-defaults/blob/master/editorconfig-defaults.json | ||
# | ||
# 1. What happens when I press the Tab key in my text editor? | ||
# 2. What happens when I request my editor to indent one or more lines? | ||
# 3. What happens when I view a file containing U+0009 HORIZONTAL TAB characters? | ||
# | ||
# Answers: | ||
# | ||
# 1. Pressing the Tab key should indent the current line (or selected lines) one additional level. | ||
# 2. As a secondary alternative, I can also tolerate an editor that, | ||
# like Emacs, uses this key for a context-sensitive fix-my-indentation command. | ||
# 3. Indenting one or more lines should follow the reigning convention, if consensus is sufficiently strong; otherwise, | ||
# I greatly prefer 2-space indentation at each level. U+0009 characters should shift subsequent characters to the next tab stop. | ||
# | ||
# Note: VIM users should use alternate marks [[[ and ]]] as the original ones can confuse nested substitutions, e.g.: ${${${VAR}}} | ||
# | ||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | ||
# vim: ft=zsh sw=2 ts=2 et | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.sln] | ||
indent_style = tab | ||
|
||
[*.{md,mdx,rst}] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{cmd,bat}] | ||
end_of_line = crlf | ||
|
||
[*za-*] | ||
end_of_line = lf | ||
|
||
[*.{sh,bash,zsh,fish}] | ||
end_of_line = lf | ||
|
||
[Makefile] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.{py,rb}] | ||
indent_size = 4 | ||
|
||
[*.{go,java,scala,groovy,kotlin}] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.{cs,csx,cake,vb,vbx}] | ||
# Default Severity for all .NET Code Style rules below | ||
dotnet_analyzer_diagnostic.severity = warning |
Oops, something went wrong.