aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2024-06-29 14:20:02 +0800
committerWe-unite <3205135446@qq.com>2024-06-29 14:26:46 +0800
commitc4e535792c80118074b502e583690e9df0aa23c0 (patch)
tree5ace915de19fc8958de029ff7b5c7690cebfe26b /tools
parentafa8fcdfd84544356a052ea0673b04fd5018bd41 (diff)
downloadPardon-main.tar.gz
Pardon-main.zip
updatemain
Diffstat (limited to 'tools')
-rw-r--r--tools/.clang-format121
-rwxr-xr-xtools/compile_vim.sh94
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---
2Language: Cpp
3# BasedOnStyle: LLVM
4AccessModifierOffset: -2
5AlignAfterOpenBracket: Align
6AlignConsecutiveAssignments: false
7AlignConsecutiveDeclarations: false
8AlignEscapedNewlines: Right
9AlignOperands: true
10AlignTrailingComments: true
11AllowAllParametersOfDeclarationOnNextLine: true
12AllowShortBlocksOnASingleLine: false
13AllowShortCaseLabelsOnASingleLine: false
14AllowShortFunctionsOnASingleLine: All
15AllowShortIfStatementsOnASingleLine: false
16AllowShortLoopsOnASingleLine: false
17AlwaysBreakAfterDefinitionReturnType: None
18AlwaysBreakAfterReturnType: None
19AlwaysBreakBeforeMultilineStrings: false
20AlwaysBreakTemplateDeclarations: MultiLine
21BinPackArguments: true
22BinPackParameters: true
23BraceWrapping:
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
39BreakBeforeBinaryOperators: None
40BreakBeforeBraces: Attach
41BreakBeforeInheritanceComma: false
42BreakInheritanceList: BeforeColon
43BreakBeforeTernaryOperators: true
44BreakConstructorInitializersBeforeComma: false
45BreakConstructorInitializers: BeforeColon
46BreakAfterJavaFieldAnnotations: false
47BreakStringLiterals: true
48ColumnLimit: 80
49CommentPragmas: '^ IWYU pragma:'
50CompactNamespaces: false
51ConstructorInitializerAllOnOneLineOrOnePerLine: false
52ConstructorInitializerIndentWidth: 4
53ContinuationIndentWidth: 4
54Cpp11BracedListStyle: true
55DerivePointerAlignment: false
56DisableFormat: false
57ExperimentalAutoDetectBinPacking: false
58FixNamespaceComments: true
59ForEachMacros:
60 - foreach
61 - Q_FOREACH
62 - BOOST_FOREACH
63IncludeBlocks: Preserve
64IncludeCategories:
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
71IncludeIsMainRegex: '(Test)?$'
72IndentCaseLabels: false
73IndentPPDirectives: None
74IndentWidth: 4
75IndentWrappedFunctionNames: false
76JavaScriptQuotes: Leave
77JavaScriptWrapImports: true
78KeepEmptyLinesAtTheStartOfBlocks: true
79MacroBlockBegin: ''
80MacroBlockEnd: ''
81MaxEmptyLinesToKeep: 1
82NamespaceIndentation: None
83ObjCBinPackProtocolList: Auto
84ObjCBlockIndentWidth: 2
85ObjCSpaceAfterProperty: false
86ObjCSpaceBeforeProtocolList: true
87PenaltyBreakAssignment: 2
88PenaltyBreakBeforeFirstCallParameter: 19
89PenaltyBreakComment: 300
90PenaltyBreakFirstLessLess: 120
91PenaltyBreakString: 1000
92PenaltyBreakTemplateDeclaration: 10
93PenaltyExcessCharacter: 1000000
94PenaltyReturnTypeOnItsOwnLine: 60
95PointerAlignment: Right
96ReflowComments: true
97SortIncludes: true
98SortUsingDeclarations: true
99SpaceAfterCStyleCast: false
100SpaceAfterTemplateKeyword: true
101SpaceBeforeAssignmentOperators: true
102SpaceBeforeCpp11BracedList: false
103SpaceBeforeCtorInitializerColon: true
104SpaceBeforeInheritanceColon: true
105SpaceBeforeParens: ControlStatements
106SpaceBeforeRangeBasedForLoopColon: true
107SpaceInEmptyParentheses: false
108SpacesBeforeTrailingComments: 1
109SpacesInAngles: false
110SpacesInContainerLiterals: true
111SpacesInCStyleCastParentheses: false
112SpacesInParentheses: false
113SpacesInSquareBrackets: false
114Standard: Cpp11
115StatementMacros:
116 - Q_UNUSED
117 - QT_REQUIRE_VERSION
118TabWidth: 8
119UseTab: 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
3set -e # exit when error
4# environment variables here
5
6VIMRUNTIME=/usr/share/vim/vim91
7color_file=industry.vim
8
9# write a function to install sth,the parameter of the func is the packages
10function 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
20if [ $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
23fi
24
25cd ~
26# if this is the first time to compile vim
27if [ $# -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
36else
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
42fi
43
44# get the default python version
45python_version=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1"."$2}')
46if [ -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}')
51fi
52# if gtk installed, remove it
53if [ -d /usr/local/include/gtk-2.0 ]; then
54 sudo apt remove libgtk2.0-dev
55fi
56
57echo -e "\033[32mPython version: $python_version\033[0m"
58
59echo -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
77echo -e "\033[32mCompiling vim...\033[0m"
78make
79
80echo -e "\033[32mInstalling vim...\033[0m"
81sudo make install
82
83echo -e "\033[32;36mCompile done!\033[0m"
84vim --version | head -n 3
85
86# test if the terminal support 256 colors, if so, configure the color file
87if [ $(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
92fi
93
94echo -e "\033[32;36mDone.\033[0m"