Linux

Linux系统和软件配置。

非常耗时,不能把精力用在这上面,学OI才是正事。

VIM

置换ESCCapsLock

/usr/share/X11/xkb/symbols/pc中调换key <ESC>key <CAPS>两行中括号中的内容。

安装xclip来让nvim支持系统剪切板。

临时:

1
xmodmap -e 'clear Lock' -e 'keycode x042=Escape'

安装Plug插件

1
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

平时的Neovim配置(安装vim实时预览插件需要安装nodejs和npm,详见说明):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
set number ignorecase smartindent noswapfile termguicolors expandtab
set mouse=a history=1000 shiftwidth=4 tabstop=4 scrolloff=5

inoremap {<CR> {<Esc>o}<Esc>O
noremap ; :
noremap j gj
noremap gj j
noremap k gk
noremap gk k
noremap <F8> ggVG"+y
autocmd FileType cpp noremap <F4> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< <CR>
autocmd FileType cpp inoremap <F4> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< <CR>
autocmd FileType cpp noremap <F5> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< && time ./%< <CR>
autocmd FileType cpp inoremap <F5> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< && time ./%< <CR>
autocmd FileType cpp noremap <F7> <Esc>:w<CR>:!g++ % -Og -g -Wall -Wshadow -o %< <CR>
autocmd FileType cpp inoremap <F7> <Esc>:w<CR>:!g++ % -Og -g -Wall -Wshadow -o %< <CR>

"------------------------------------------------------------------------------"
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-commentary'
Plug 'w0rp/ale'
Plug 'vim-scripts/fcitx.vim'
Plug 'plasticboy/vim-markdown'
Plug 'suan/vim-instant-markdown'
Plug 'joker1007/vim-markdown-quote-syntax'
Plug 'hzchirs/vim-material'
call plug#end()

"Material
let g:material_style = 'palenight'
colorscheme vim-material
hi Normal guibg=NONE ctermbg=NONE

"Markdown
let g:vim_markdown_math = 1

"Airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1

"Ale
let g:ale_sign_column_always = 1
let g:ale_lint_on_text_changed = 'never'

考试的配置(考场上用缩写):

1
2
3
4
5
6
7
8
9
10
set number ruler ignorecase showcmd expandtab
set autoread autoindent smartindent
set mouse=a history=1000 shiftwidth=4 tabstop=4 scrolloff=5
imap {<CR> {<Esc>o}<Esc>O
map ; :
map <F4> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< <CR>
imap <F4> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< <CR>
map <F5> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< && time ./%< <CR>
imap <F5> <Esc>:w<CR>:!g++ % -O2 -Wall -Wshadow -o %< && time ./%< <CR>
map <F7> <Esc>:w<CR>:!g++ % -Og -g -Wall -Wshadow -o %< <CR>

更新python-nvim

1
2
3
sudo pacman -S python-pip python3-pip
pip install neovim --upgrade
pip3 install neovim --upgrade

函数名高亮:在/usr/share/nvim/syntax/c.vim后添加

1
2
3
4
"highlight Functions
syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2
syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1
hi cFunctions gui=NONE cterm=bold ctermfg=blue

挂载磁盘

建好文件夹,在fstab中加入

1
2
/dev/sda2 /D ntfs defaults 0 0
/dev/sda3 /E ntfs defaults 0 0

软件源

配置官方镜像源

1
sudo pacman-mirrors -i -c China -m rank

在配置文件/etc/pacman.conf后添加

1
2
3
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch

导入GPG key

1
2
sudo pacman -Syyu
sudo pacman -S archlinuxcn-keyring

清理无用软件和缓存

1
2
sudo pacman -R $(pacman -Qdtq)
sudo pacman -Scc

软件和插件

安装软件

1
2
3
4
5
6
qt
xsel
fcitx
pakku
xorg-xrandr
gnome-terminal-transparency //终端透明

Gnome插件

1
2
3
4
5
AlternateTab 
Applications Menu
Dash to Panel
TopIcons Plus
User Themes

字体

把字体复制到/usr/share/fonts/,刷新缓存

1
sudo fc-cache -fv

输入法

1
2
3
sudo pacman -S fcitx-sogoupinyin
sudo pacman -S fcitx-im
sudo pacman -S fcitx-configtool

在配置文件~/.xprofile后添加

1
2
3
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"

修改grub

修改配置文件/boot/grub/grub.cfg

Zsh

安装oh-my-zsh

1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

更改默认shell

1
2
sudo chsh -s /bin/zsh vozeo
sudo chsh -s /bin/zsh

~/.zshrc中修改

1
2
3
4
agnoster
sudo
alias vim='nvim'
alias pc='proxychains'

刷新

1
source ~/.zshrc

代理

ProxySwitch中更改gfwlist

用代理在终端中打开

1
chromium --proxy_server="socks5://127.0.0.1:1080"

/etc/proxychains.conf最下方添加

1
socks5 127.0.0.1 1080