20180214 update:
第一个版本已经比较久了,于是更新一下,顺便写了个脚本orz
1pacman-mirrors -c China
2echo " [archlinuxcn] " >> /etc/pacman.conf
3echo " SigLevel = Optional TrustedOnly " >> /etc/pacman.conf
4echo " Server = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch" >> /etc/pacman.conf
5
6
7echo "[arch4edu]" >> /etc/pacman.conf
8echo "SigLevel = Never" >> /etc/pacman.conf
9echo "Server = http://mirrors.tuna.tsinghua.edu.cn/arch4edu/\$arch " >> /etc/pacman.conf
10pacman -Syyu
11pacman -S archlinuxcn-keyring
12
13pacman -S yakuake fish gvim
14pacman -S google-chrome chromium
15pacman -S wget aria2 remarkable netease-cloud-music
16pacman -S fcitx fcitx-configtool fcitx-sogoupinyin fcitx-im kcm-fcitx
17pacman -S shadowsocks-qt5
18pacman -S wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts
19
20cat >> ~/.xprofile <<EOF
21export GTK_IM_MODULE=fcitx
22export QT_IM_MODULE=fcitx
23export XMODIFIERS="@im=fcitx"
24EOF出于目前对manjaro的依赖,以及没有找到很简单易行的备份系统的方案的原因,决定详细记录一下系统安装的过程,以防哪天系统挂掉了,可以快速恢复。
1.关于更换源#
坑点主要在系统默认的源是国外源,如何切换成中国源,网上有很多教程,但这些教程都是针对Arch的,弄来弄去也很不容易搞好,而且胡乱修改会把Manjaro的源破坏掉(不要问我怎么知道的)。 其实网上有个 blog 的方法很方便,附上链接
就两行命令搞定:
1sudo pacman-mirrors -c China //选择中国源并更新
2sudo pacman -Syyu //更新系统2.安装搜狗输入法
具体为,安装fcitx,安装fcitx-sogoupinyin,安装kcm-fcitx
然后
~/.xprofile 文件中添加如下内容
1export GTK_IM_MODULE=fcitx
2export QT_IM_MODULE=fcitx
3export XMODIFIERS="@im=fcitx"由于初始安装系统时选择的是英文,在安装搜狗输入法之前先安装了 chrome,导致在 chrome 中无法输入中文(而在 firefox 中可以),解决办法是,删除掉 .config 中 google-chrome 文件夹即可
3 添加archlinuxcn源
在 /etc/pacman.conf 文件末尾添加以下两行:
1[archlinuxcn]
2SigLevel = Optional TrustedOnly
3Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch之后安装 archlinuxcn-keyring 包以导入 GPG key。
4 添加arch4edu源
在/etc/pacman.conf 文件末尾添加
1[arch4edu]
2SigLevel = Never
3Server = http://mirrors.tuna.tsinghua.edu.cn/arch4edu/$arch5 安装常用软件
- guake
- fish
- vim
- shadowsocks-qt5
- google-chrome
- wget,aria2
- franz,telegram-desktop
- remarkable (markdown编辑器,轻量级)
6.proxychains-ng
1dynamic_chain
2chain_len = 1
3proxy_dns
4remote_dns_subnet 224
5tcp_read_time_out 15000
6tcp_connect_time_out 8000
7[ProxyList]
8socks5 127.0.0.1 1080就很气,配置文件经常失效,再记录一份好了
1quiet_mode
2dynamic_chain
3chain_len = 1 #round_robin_chain和random_chain使用
4proxy_dns
5remote_dns_subnet 224
6tcp_read_time_out 15000
7tcp_connect_time_out 8000
8localnet 127.0.0.0/255.0.0.0
9localnet 10.0.0.0/255.0.0.0
10localnet 172.16.0.0/255.240.0.0
11localnet 192.168.0.0/255.255.0.0
12
13[ProxyList]
14socks5 127.0.0.1 1080
15http 127.0.0.1 10877 vim 配置
8 修改键盘映射
1keysym XF86Back = Page_Up
2keysym XF86Forward = Page_Down9 安装中文字体:
1sudo pacman -S wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts- anaconda with fish
anaconda 默认的环境变量是bash,对于fish,需要修改~/.config/fish/config.fish 如下
1#export LD_LIBRARY_PATH=/usr/local/cuda/lib64/
2set -x LD_LIBRARY_PATH /usr/local/cuda/lib64/
3
4# added by Anaconda2 4.4.0 installer
5#export PATH="/home/sensetime/anaconda2/bin:$PATH"
6set -x PATH /home/sensetime/anaconda2/bin $PATH11 youcompleteme
详细代码
1# This file is NOT licensed under the GPLv3, which is the license for the rest
2# of YouCompleteMe.
3#
4# Here's the license text for this file:
5#
6# This is free and unencumbered software released into the public domain.
7#
8# Anyone is free to copy, modify, publish, use, compile, sell, or
9# distribute this software, either in source code form or as a compiled
10# binary, for any purpose, commercial or non-commercial, and by any
11# means.
12#
13# In jurisdictions that recognize copyright laws, the author or authors
14# of this software dedicate any and all copyright interest in the
15# software to the public domain. We make this dedication for the benefit
16# of the public at large and to the detriment of our heirs and
17# successors. We intend this dedication to be an overt act of
18# relinquishment in perpetuity of all present and future rights to this
19# software under copyright law.
20#
21# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27# OTHER DEALINGS IN THE SOFTWARE.
28#
29# For more information, please refer to <http://unlicense.org/>
30
31import os
32import ycm_core
33
34# These are the compilation flags that will be used in case there's no
35# compilation database set (by default, one is not set).
36# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
37flags = [
38'-Wall',
39'-Wextra',
40'-Werror',
41'-Wnoc++98-compat',
42'-Wno-long-long',
43'-Wno-variadic-macros',
44'-fexceptions',
45'-DNDEBUG',
46#'-stdlib=libc++',
47# You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM
48# source code needs it.
49'-DUSE_CLANG_COMPLETER',
50# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
51# language to use when compiling headers. So it will guess. Badly. So C++
52# headers will be compiled as C headers. You don't want that so ALWAYS specify
53# a "-std=<something>".
54# For a C project, you would set this to something like 'c99' instead of
55# 'c++11'.
56'-std=c++11',
57# ...and the same thing goes for the magic -x option which specifies the
58# language that the files to be compiled are written in. This is mostly
59# relevant for c++ headers.
60# For a C project, you would set this to 'c' instead of 'c++'.
61'-x',
62'c++',
63'-isystem',
64'../BoostParts',
65'-isystem',
66# This path will only work on OS X, but extra paths that don't exist are not
67# harmful
68'/System/Library/Frameworks/Python.framework/Headers',
69'-isystem',
70'../llvm/include',
71'-isystem',
72'../llvm/tools/clang/include',
73'-I',
74'.',
75'-I',
76'./ClangCompleter',
77'-isystem',
78'./tests/gmock/gtest',
79'-isystem',
80'./tests/gmock/gtest/include',
81'-isystem',
82'./tests/gmock',
83'-isystem',
84'./tests/gmock/include',
85#'-isystem',
86#'/usr/local/include/c++/5.1.0',
87#'-isystem',
88#'/usr/local/include',
89#'-isystem',
90#'/usr/include',
91]
92
93
94# Set this to the absolute path to the folder (NOT the file!) containing the
95# compile_commands.json file to use that instead of 'flags'. See here for
96# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
97#
98# You can get CMake to generate this file for you by adding:
99# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
100# to your CMakeLists.txt file.
101#
102# Most projects will NOT need to set this to anything; you can just change the
103# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
104compilation_database_folder = ''
105
106if os.path.exists( compilation_database_folder ):
107 database = ycm_core.CompilationDatabase( compilation_database_folder )
108else:
109 database = None
110
111SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
112
113def DirectoryOfThisScript():
114 return os.path.dirname( os.path.abspath( __file__ ) )
115
116
117def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
118 if not working_directory:
119 return list( flags )
120 new_flags = []
121 make_next_absolute = False
122 path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
123 for flag in flags:
124 new_flag = flag
125
126 if make_next_absolute:
127 make_next_absolute = False
128 if not flag.startswith( '/' ):
129 new_flag = os.path.join( working_directory, flag )
130
131 for path_flag in path_flags:
132 if flag == path_flag:
133 make_next_absolute = True
134 break
135
136 if flag.startswith( path_flag ):
137 path = flag[ len( path_flag ): ]
138 new_flag = path_flag + os.path.join( working_directory, path )
139 break
140
141 if new_flag:
142 new_flags.append( new_flag )
143 return new_flags
144
145
146def IsHeaderFile( filename ):
147 extension = os.path.splitext( filename )[ 1 ]
148 return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
149
150
151def GetCompilationInfoForFile( filename ):
152 # The compilation_commands.json file generated by CMake does not have entries
153 # for header files. So we do our best by asking the db for flags for a
154 # corresponding source file, if any. If one exists, the flags for that file
155 # should be good enough.
156 if IsHeaderFile( filename ):
157 basename = os.path.splitext( filename )[ 0 ]
158 for extension in SOURCE_EXTENSIONS:
159 replacement_file = basename + extension
160 if os.path.exists( replacement_file ):
161 compilation_info = database.GetCompilationInfoForFile(
162 replacement_file )
163 if compilation_info.compiler_flags_:
164 return compilation_info
165 return None
166 return database.GetCompilationInfoForFile( filename )
167
168
169def FlagsForFile( filename, **kwargs ):
170 if database:
171 # Bear in mind that compilation_info.compiler_flags_ does NOT return a
172 # python list, but a "list-like" StringVec object
173 compilation_info = GetCompilationInfoForFile( filename )
174 if not compilation_info:
175 return None
176
177 final_flags = MakeRelativePathsInFlagsAbsolute(
178 compilation_info.compiler_flags_,
179 compilation_info.compiler_working_dir_ )
180
181 # NOTE: This is just for YouCompleteMe; it's highly likely that your project
182 # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
183 # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
184 try:
185 final_flags.remove( '-stdlib=libc++' )
186 pass
187 except ValueError:
188 pass
189 else:
190 relative_to = DirectoryOfThisScript()
191 final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
192
193 return {
194 'flags': final_flags,
195 'do_cache': True
196 }12.关于vim 剪贴板的问题
How do I use the system clipboard with Vim in Arch Linux?
uninstall vim, install gvim, and use vim instead of gvim
13 vim 配色文件 molokai.vim(透明背景修改)
详细代码
1" Vim color file
2"
3" Author: Tomas Restrepo <tomas@winterdom.com>
4" https://github.com/tomasr/molokai
5"
6" Note: Based on the Monokai theme for TextMate
7" by Wimer Hazenberg and its darker variant
8" by Hamish Stuart Macpherson
9"
10
11hi clear
12
13if version > 580
14 " no guarantees for version 5.8 and below, but this makes it stop
15 " complaining
16 hi clear
17 if exists("syntax_on")
18 syntax reset
19 endif
20endif
21let g:colors_name="molokai"
22
23if exists("g:molokai_original")
24 let s:molokai_original = g:molokai_original
25else
26 let s:molokai_original = 0
27endif
28
29
30hi Boolean guifg=#AE81FF
31hi Character guifg=#E6DB74
32hi Number guifg=#AE81FF
33hi String guifg=#E6DB74
34hi Conditional guifg=#F92672 gui=bold
35hi Constant guifg=#AE81FF gui=bold
36hi Cursor guifg=#000000 guibg=#F8F8F0
37hi iCursor guifg=#000000 guibg=#F8F8F0
38hi Debug guifg=#BCA3A3 gui=bold
39hi Define guifg=#66D9EF
40hi Delimiter guifg=#8F8F8F
41hi DiffAdd guibg=#13354A
42hi DiffChange guifg=#89807D guibg=#4C4745
43hi DiffDelete guifg=#960050 guibg=#1E0010
44hi DiffText guibg=#4C4745 gui=italic,bold
45
46hi Directory guifg=#A6E22E gui=bold
47hi Error guifg=#E6DB74 guibg=#1E0010
48hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
49hi Exception guifg=#A6E22E gui=bold
50hi Float guifg=#AE81FF
51hi FoldColumn guifg=#465457 guibg=#000000
52hi Folded guifg=#465457 guibg=#000000
53hi Function guifg=#A6E22E
54hi Identifier guifg=#FD971F
55hi Ignore guifg=#808080 guibg=bg
56hi IncSearch guifg=#C4BE89 guibg=#000000
57
58hi Keyword guifg=#F92672 gui=bold
59hi Label guifg=#E6DB74 gui=none
60hi Macro guifg=#C4BE89 gui=italic
61hi SpecialKey guifg=#66D9EF gui=italic
62
63hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
64hi ModeMsg guifg=#E6DB74
65hi MoreMsg guifg=#E6DB74
66hi Operator guifg=#F92672
67
68" complete menu
69hi Pmenu guifg=#66D9EF guibg=#000000
70hi PmenuSel guibg=#808080
71hi PmenuSbar guibg=#080808
72hi PmenuThumb guifg=#66D9EF
73
74hi PreCondit guifg=#A6E22E gui=bold
75hi PreProc guifg=#A6E22E
76hi Question guifg=#66D9EF
77hi Repeat guifg=#F92672 gui=bold
78hi Search guifg=#000000 guibg=#FFE792
79" marks
80hi SignColumn guifg=#A6E22E guibg=#232526
81hi SpecialChar guifg=#F92672 gui=bold
82hi SpecialComment guifg=#7E8E91 gui=bold
83hi Special guifg=#66D9EF guibg=bg gui=italic
84if has("spell")
85 hi SpellBad guisp=#FF0000 gui=undercurl
86 hi SpellCap guisp=#7070F0 gui=undercurl
87 hi SpellLocal guisp=#70F0F0 gui=undercurl
88 hi SpellRare guisp=#FFFFFF gui=undercurl
89endif
90hi Statement guifg=#F92672 gui=bold
91hi StatusLine guifg=#455354 guibg=fg
92hi StatusLineNC guifg=#808080 guibg=#080808
93hi StorageClass guifg=#FD971F gui=italic
94hi Structure guifg=#66D9EF
95hi Tag guifg=#F92672 gui=italic
96hi Title guifg=#ef5939
97hi Todo guifg=#FFFFFF guibg=bg gui=bold
98
99hi Typedef guifg=#66D9EF
100hi Type guifg=#66D9EF gui=none
101hi Underlined guifg=#808080 gui=underline
102
103hi VertSplit guifg=#808080 guibg=#080808 gui=bold
104hi VisualNOS guibg=#403D3D
105hi Visual guibg=#403D3D
106hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
107hi WildMenu guifg=#66D9EF guibg=#000000
108
109hi TabLineFill guifg=#1B1D1E guibg=#1B1D1E
110hi TabLine guibg=#1B1D1E guifg=#808080 gui=none
111
112if s:molokai_original == 1
113 hi Normal guifg=#F8F8F2 guibg=NONE
114 hi Comment guifg=#75715E
115 hi CursorLine guibg=#3E3D32
116 hi CursorLineNr guifg=#FD971F gui=none
117 hi CursorColumn guibg=#3E3D32
118 hi ColorColumn guibg=#3B3A32
119 hi LineNr guifg=#BCBCBC guibg=#3B3A32
120 hi NonText guifg=#75715E
121 hi SpecialKey guifg=#75715E
122else
123 hi Normal guifg=#F8F8F2 guibg=NONE
124 hi Comment guifg=#7E8E91
125 hi CursorLine guibg=#293739
126 hi CursorLineNr guifg=#FD971F gui=none
127 hi CursorColumn guibg=#293739
128 hi ColorColumn guibg=#232526
129 hi LineNr guifg=#465457 guibg=#232526
130 hi NonText guifg=#465457
131 hi SpecialKey guifg=#465457
132end
133
134"
135" Support for 256-color terminal
136"
137if &t_Co > 255
138 if s:molokai_original == 1
139 hi Normal ctermbg=NONE
140 hi CursorLine ctermbg=235 cterm=none
141 hi CursorLineNr ctermfg=208 cterm=none
142 else
143 hi Normal ctermfg=252 ctermbg=NONE
144 hi CursorLine ctermbg=234 cterm=none
145 hi CursorLineNr ctermfg=208 cterm=none
146 endif
147 hi Boolean ctermfg=135
148 hi Character ctermfg=144
149 hi Number ctermfg=135
150 hi String ctermfg=144
151 hi Conditional ctermfg=161 cterm=bold
152 hi Constant ctermfg=135 cterm=bold
153 hi Cursor ctermfg=16 ctermbg=253
154 hi Debug ctermfg=225 cterm=bold
155 hi Define ctermfg=81
156 hi Delimiter ctermfg=241
157
158 hi DiffAdd ctermbg=24
159 hi DiffChange ctermfg=181 ctermbg=239
160 hi DiffDelete ctermfg=162 ctermbg=53
161 hi DiffText ctermbg=102 cterm=bold
162
163 hi Directory ctermfg=118 cterm=bold
164 hi Error ctermfg=219 ctermbg=89
165 hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
166 hi Exception ctermfg=118 cterm=bold
167 hi Float ctermfg=135
168 hi FoldColumn ctermfg=67 ctermbg=16
169 hi Folded ctermfg=67 ctermbg=16
170 hi Function ctermfg=118
171 hi Identifier ctermfg=208 cterm=none
172 hi Ignore ctermfg=244 ctermbg=232
173 hi IncSearch ctermfg=193 ctermbg=16
174
175 hi keyword ctermfg=161 cterm=bold
176 hi Label ctermfg=229 cterm=none
177 hi Macro ctermfg=193
178 hi SpecialKey ctermfg=81
179
180 hi MatchParen ctermfg=233 ctermbg=208 cterm=bold
181 hi ModeMsg ctermfg=229
182 hi MoreMsg ctermfg=229
183 hi Operator ctermfg=161
184
185 " complete menu
186 hi Pmenu ctermfg=81 ctermbg=16
187 hi PmenuSel ctermfg=255 ctermbg=242
188 hi PmenuSbar ctermbg=232
189 hi PmenuThumb ctermfg=81
190
191 hi PreCondit ctermfg=118 cterm=bold
192 hi PreProc ctermfg=118
193 hi Question ctermfg=81
194 hi Repeat ctermfg=161 cterm=bold
195 hi Search ctermfg=0 ctermbg=222 cterm=NONE
196
197 " marks column
198 hi SignColumn ctermfg=118 ctermbg=235
199 hi SpecialChar ctermfg=161 cterm=bold
200 hi SpecialComment ctermfg=245 cterm=bold
201 hi Special ctermfg=81
202 if has("spell")
203 hi SpellBad ctermbg=52
204 hi SpellCap ctermbg=17
205 hi SpellLocal ctermbg=17
206 hi SpellRare ctermfg=none ctermbg=none cterm=reverse
207 endif
208 hi Statement ctermfg=161 cterm=bold
209 hi StatusLine ctermfg=238 ctermbg=253
210 hi StatusLineNC ctermfg=244 ctermbg=232
211 hi StorageClass ctermfg=208
212 hi Structure ctermfg=81
213 hi Tag ctermfg=161
214 hi Title ctermfg=166
215 hi Todo ctermfg=231 ctermbg=232 cterm=bold
216
217 hi Typedef ctermfg=81
218 hi Type ctermfg=81 cterm=none
219 hi Underlined ctermfg=244 cterm=underline
220
221 hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
222 hi VisualNOS ctermbg=238
223 hi Visual ctermbg=235
224 hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
225 hi WildMenu ctermfg=81 ctermbg=16
226
227 hi Comment ctermfg=59
228 hi CursorColumn ctermbg=236
229 hi ColorColumn ctermbg=236
230 hi LineNr ctermfg=250 ctermbg=236
231 hi NonText ctermfg=59
232
233 hi SpecialKey ctermfg=59
234
235 if exists("g:rehash256") && g:rehash256 == 1
236 hi Normal ctermfg=252 ctermbg=NONE
237 hi CursorLine ctermbg=236 cterm=none
238 hi CursorLineNr ctermfg=208 cterm=none
239
240 hi Boolean ctermfg=141
241 hi Character ctermfg=222
242 hi Number ctermfg=141
243 hi String ctermfg=222
244 hi Conditional ctermfg=197 cterm=bold
245 hi Constant ctermfg=141 cterm=bold
246
247 hi DiffDelete ctermfg=125 ctermbg=233
248
249 hi Directory ctermfg=154 cterm=bold
250 hi Error ctermfg=222 ctermbg=233
251 hi Exception ctermfg=154 cterm=bold
252 hi Float ctermfg=141
253 hi Function ctermfg=154
254 hi Identifier ctermfg=208
255
256 hi Keyword ctermfg=197 cterm=bold
257 hi Operator ctermfg=197
258 hi PreCondit ctermfg=154 cterm=bold
259 hi PreProc ctermfg=154
260 hi Repeat ctermfg=197 cterm=bold
261
262 hi Statement ctermfg=197 cterm=bold
263 hi Tag ctermfg=197
264 hi Title ctermfg=203
265 hi Visual ctermbg=238
266
267 hi Comment ctermfg=244
268 hi LineNr ctermfg=239 ctermbg=235
269 hi NonText ctermfg=239
270 hi SpecialKey ctermfg=239
271 endif
272end
273
274" Must be at the end, because of ctermbg=234 bug.
275" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ
276set background=dark