diff options
author | 2024-06-29 14:20:02 +0800 | |
---|---|---|
committer | 2024-06-29 14:26:46 +0800 | |
commit | c4e535792c80118074b502e583690e9df0aa23c0 (patch) | |
tree | 5ace915de19fc8958de029ff7b5c7690cebfe26b /tools | |
parent | afa8fcdfd84544356a052ea0673b04fd5018bd41 (diff) | |
download | Pardon-main.tar.gz Pardon-main.zip |
updatemain
Diffstat (limited to 'tools')
-rw-r--r-- | tools/.clang-format | 121 | ||||
-rwxr-xr-x | tools/compile_vim.sh | 94 |
2 files changed, 215 insertions, 0 deletions
diff --git a/tools/.clang-format b/tools/.clang-format new file mode 100644 index 0000000..a1054a5 --- /dev/null +++ b/tools/.clang-format | |||
@@ -0,0 +1,121 @@ | |||
1 | --- | ||
2 | Language: Cpp | ||
3 | # BasedOnStyle: LLVM | ||
4 | AccessModifierOffset: -2 | ||
5 | AlignAfterOpenBracket: Align | ||
6 | AlignConsecutiveAssignments: false | ||
7 | AlignConsecutiveDeclarations: false | ||
8 | AlignEscapedNewlines: Right | ||
9 | AlignOperands: true | ||
10 | AlignTrailingComments: true | ||
11 | AllowAllParametersOfDeclarationOnNextLine: true | ||
12 | AllowShortBlocksOnASingleLine: false | ||
13 | AllowShortCaseLabelsOnASingleLine: false | ||
14 | AllowShortFunctionsOnASingleLine: All | ||
15 | AllowShortIfStatementsOnASingleLine: false | ||
16 | AllowShortLoopsOnASingleLine: false | ||
17 | AlwaysBreakAfterDefinitionReturnType: None | ||
18 | AlwaysBreakAfterReturnType: None | ||
19 | AlwaysBreakBeforeMultilineStrings: false | ||
20 | AlwaysBreakTemplateDeclarations: MultiLine | ||
21 | BinPackArguments: true | ||
22 | BinPackParameters: true | ||
23 | BraceWrapping: | ||
24 | AfterClass: false | ||
25 | AfterControlStatement: false | ||
26 | AfterEnum: false | ||
27 | AfterFunction: false | ||
28 | AfterNamespace: false | ||
29 | AfterObjCDeclaration: false | ||
30 | AfterStruct: false | ||
31 | AfterUnion: false | ||
32 | AfterExternBlock: false | ||
33 | BeforeCatch: false | ||
34 | BeforeElse: false | ||
35 | IndentBraces: false | ||
36 | SplitEmptyFunction: true | ||
37 | SplitEmptyRecord: true | ||
38 | SplitEmptyNamespace: true | ||
39 | BreakBeforeBinaryOperators: None | ||
40 | BreakBeforeBraces: Attach | ||
41 | BreakBeforeInheritanceComma: false | ||
42 | BreakInheritanceList: BeforeColon | ||
43 | BreakBeforeTernaryOperators: true | ||
44 | BreakConstructorInitializersBeforeComma: false | ||
45 | BreakConstructorInitializers: BeforeColon | ||
46 | BreakAfterJavaFieldAnnotations: false | ||
47 | BreakStringLiterals: true | ||
48 | ColumnLimit: 80 | ||
49 | CommentPragmas: '^ IWYU pragma:' | ||
50 | CompactNamespaces: false | ||
51 | ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
52 | ConstructorInitializerIndentWidth: 4 | ||
53 | ContinuationIndentWidth: 4 | ||
54 | Cpp11BracedListStyle: true | ||
55 | DerivePointerAlignment: false | ||
56 | DisableFormat: false | ||
57 | ExperimentalAutoDetectBinPacking: false | ||
58 | FixNamespaceComments: true | ||
59 | ForEachMacros: | ||
60 | - foreach | ||
61 | - Q_FOREACH | ||
62 | - BOOST_FOREACH | ||
63 | IncludeBlocks: Preserve | ||
64 | IncludeCategories: | ||
65 | - Regex: '^"(llvm|llvm-c|clang|clang-c)/' | ||
66 | Priority: 2 | ||
67 | - Regex: '^(<|"(gtest|gmock|isl|json)/)' | ||
68 | Priority: 3 | ||
69 | - Regex: '.*' | ||
70 | Priority: 1 | ||
71 | IncludeIsMainRegex: '(Test)?$' | ||
72 | IndentCaseLabels: false | ||
73 | IndentPPDirectives: None | ||
74 | IndentWidth: 4 | ||
75 | IndentWrappedFunctionNames: false | ||
76 | JavaScriptQuotes: Leave | ||
77 | JavaScriptWrapImports: true | ||
78 | KeepEmptyLinesAtTheStartOfBlocks: true | ||
79 | MacroBlockBegin: '' | ||
80 | MacroBlockEnd: '' | ||
81 | MaxEmptyLinesToKeep: 1 | ||
82 | NamespaceIndentation: None | ||
83 | ObjCBinPackProtocolList: Auto | ||
84 | ObjCBlockIndentWidth: 2 | ||
85 | ObjCSpaceAfterProperty: false | ||
86 | ObjCSpaceBeforeProtocolList: true | ||
87 | PenaltyBreakAssignment: 2 | ||
88 | PenaltyBreakBeforeFirstCallParameter: 19 | ||
89 | PenaltyBreakComment: 300 | ||
90 | PenaltyBreakFirstLessLess: 120 | ||
91 | PenaltyBreakString: 1000 | ||
92 | PenaltyBreakTemplateDeclaration: 10 | ||
93 | PenaltyExcessCharacter: 1000000 | ||
94 | PenaltyReturnTypeOnItsOwnLine: 60 | ||
95 | PointerAlignment: Right | ||
96 | ReflowComments: true | ||
97 | SortIncludes: true | ||
98 | SortUsingDeclarations: true | ||
99 | SpaceAfterCStyleCast: false | ||
100 | SpaceAfterTemplateKeyword: true | ||
101 | SpaceBeforeAssignmentOperators: true | ||
102 | SpaceBeforeCpp11BracedList: false | ||
103 | SpaceBeforeCtorInitializerColon: true | ||
104 | SpaceBeforeInheritanceColon: true | ||
105 | SpaceBeforeParens: ControlStatements | ||
106 | SpaceBeforeRangeBasedForLoopColon: true | ||
107 | SpaceInEmptyParentheses: false | ||
108 | SpacesBeforeTrailingComments: 1 | ||
109 | SpacesInAngles: false | ||
110 | SpacesInContainerLiterals: true | ||
111 | SpacesInCStyleCastParentheses: false | ||
112 | SpacesInParentheses: false | ||
113 | SpacesInSquareBrackets: false | ||
114 | Standard: Cpp11 | ||
115 | StatementMacros: | ||
116 | - Q_UNUSED | ||
117 | - QT_REQUIRE_VERSION | ||
118 | TabWidth: 8 | ||
119 | UseTab: Never | ||
120 | ... | ||
121 | |||
diff --git a/tools/compile_vim.sh b/tools/compile_vim.sh new file mode 100755 index 0000000..47115a9 --- /dev/null +++ b/tools/compile_vim.sh | |||
@@ -0,0 +1,94 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | set -e # exit when error | ||
4 | # environment variables here | ||
5 | |||
6 | VIMRUNTIME=/usr/share/vim/vim91 | ||
7 | color_file=industry.vim | ||
8 | |||
9 | # write a function to install sth,the parameter of the func is the packages | ||
10 | function install() { | ||
11 | sudo apt update | ||
12 | sudo apt upgrade | ||
13 | sudo apt remove vim* | ||
14 | sudo apt install -y git libatk1.0-dev libcairo2-dev liblua5.1-0-dev \ | ||
15 | libncurses5-dev libperl-dev libx11-dev libxpm-dev \ | ||
16 | libxt-dev lua5.1 python3-dev ruby-dev | ||
17 | } | ||
18 | |||
19 | # check current user is root or not, if is, warn the user | ||
20 | if [ $UID -eq 0 ]; then | ||
21 | echo -e "\033[31mYou are root, I recommand to use a normal user to run this script.\033[0m" | ||
22 | exit | ||
23 | fi | ||
24 | |||
25 | cd ~ | ||
26 | # if this is the first time to compile vim | ||
27 | if [ $# -eq 1 ] && [ $1 == "first" ]; then | ||
28 | install | ||
29 | if ! [ -d app ]; then | ||
30 | mkdir app | ||
31 | fi | ||
32 | cd app | ||
33 | echo -e "\033[32mGetting vim source code...\033[0m" | ||
34 | git clone https://github.com/vim/vim | ||
35 | cd vim/src | ||
36 | else | ||
37 | cd app/vim/src | ||
38 | sudo make uninstall | ||
39 | make distclean | ||
40 | echo -e "\033[32mGetting vim source code...\033[0m" | ||
41 | git pull | ||
42 | fi | ||
43 | |||
44 | # get the default python version | ||
45 | python_version=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1"."$2}') | ||
46 | if [ -z $python_version ]; then | ||
47 | echo -e "\033[31mInstalling python3...\033[0m" | ||
48 | sudo apt update && sudo apt upgrade | ||
49 | sudo apt install python3 | ||
50 | python_version=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1"."$2}') | ||
51 | fi | ||
52 | # if gtk installed, remove it | ||
53 | if [ -d /usr/local/include/gtk-2.0 ]; then | ||
54 | sudo apt remove libgtk2.0-dev | ||
55 | fi | ||
56 | |||
57 | echo -e "\033[32mPython version: $python_version\033[0m" | ||
58 | |||
59 | echo -e "\033[32mConfiguring compile environment...\033[0m" | ||
60 | ./configure \ | ||
61 | --with-features=huge \ | ||
62 | --enable-multibyte \ | ||
63 | --enable-rubyinterp=dynamic \ | ||
64 | --with-ruby-command=/usr/bin/ruby \ | ||
65 | --enable-luainterp\ | ||
66 | --enable-python3interp=dynamic \ | ||
67 | --with-python3-command=$(which python$python_version) \ | ||
68 | --with-python3-config-dir=$(python$python_version-config --configdir) \ | ||
69 | --enable-perlinterp=dynamic \ | ||
70 | --enable-largefile \ | ||
71 | --enable-cscope \ | ||
72 | --with-compiledby="An Ordinary Communist weunite1848@gmail.com" \ | ||
73 | --enable-fail-if-missing \ | ||
74 | --disable-gui \ | ||
75 | --prefix=/usr | ||
76 | |||
77 | echo -e "\033[32mCompiling vim...\033[0m" | ||
78 | make | ||
79 | |||
80 | echo -e "\033[32mInstalling vim...\033[0m" | ||
81 | sudo make install | ||
82 | |||
83 | echo -e "\033[32;36mCompile done!\033[0m" | ||
84 | vim --version | head -n 3 | ||
85 | |||
86 | # test if the terminal support 256 colors, if so, configure the color file | ||
87 | if [ $(tput colors) -ge 256 ]; then | ||
88 | color_file=$VIMRUNTIME/colors/$color_file | ||
89 | echo -e "\033[32mConfiguring $color_file as transparent...\033[0m" | ||
90 | sudo sed -i '/if s:t_Co >= 256/,/hi Normal/{s/hi Normal/" hi/}' $color_file | ||
91 | sudo sed -i '/if s:t_Co >= 256/,/hi EndOfBuffer/{s/hi EndOfBuffer/" hi/}' $color_file | ||
92 | fi | ||
93 | |||
94 | echo -e "\033[32;36mDone.\033[0m" | ||