Sub: Re migrate notes

Body:

==== End ====
This commit is contained in:
Soundwave 2022-10-20 08:52:18 +08:00
parent c57b1f1355
commit cffe5b3233
297 changed files with 54943 additions and 1 deletions

332
.gitignore vendored Normal file
View File

@ -0,0 +1,332 @@
*~
pkg/*
*.html
*.exe
_book
*.epub
*.pdf
.DS_Store
.vscode/
.idea/
.git
.ipynb_checkpoints
**/*.out
*.so
*.swp
*.swo
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
*.vim/
**/.ropeproject/**
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

View File

@ -1,2 +1,9 @@
# notes # Notes
This project mainly stores config files for development, such as vim, zsh, tmux and so on.
Here are the contents:
1. config: Configuration files of Linux, MacOS, and Windows.
2. snippet: Some snippets.
3. article: Knowledge and experience summary.

20
article/adb.md Normal file
View File

@ -0,0 +1,20 @@
# adb 使用小结
## 查看设备
```bash
adb devices
```
## 查看设备安装的应用列表
```bash
adb shell pm list packages
```
## 卸载设备上的 app
```bash
adb shell pm uninstall --user 0 com.xxx.xxx
```

70
article/conda/conda.md Normal file
View File

@ -0,0 +1,70 @@
# conda usage
## Update conda
```bash
conda update --all
```
clean unused pkgs after update
```bash
conda clean -p
```
## Python virtual envs
### Create env with specified Python version
```bash
conda create -n $name python=3.x
```
Create env from yaml file
```bash
conda env create -f environment.yml
```
Export env to yaml file
```bash
conda env export > env.yml
```
### List conda virtual envs
```bash
conda env list
```
### Activation and Deactivation
```bash
source activate $name
source deactivate
```
### Install Python packages
```bash
conda install -n $name $pkg1 $pkg2 ...
```
Install Python packages from requirements
```bash
conda install --yes --file requirements.txt
```
### Remove Python packages
```bash
conda remove --name $name $pkg1 $pkg2 ...
```
### Remove virtual env
```bash
conda remove -n $name --all
```

26
article/dev/php.md Normal file
View File

@ -0,0 +1,26 @@
# php notes
## Install php on centos 6
First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems
Use this command to install epel-release yum repository
```bash
yum install epel-release
```
and now execute one of the following commands as per your operating system version to install Remi repository.
```bash
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
```
Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.
```bash
yum --enablerepo=remi-php73 install php
yum --enablerepo=remi-php72 install php
yum --enablerepo=remi-php71 install php
```

View File

@ -0,0 +1,94 @@
# dotnet 调用算法方案
## 1. Python 开发算法内核
### 1.1 跨服务调用
#### 方案说明
将 Python 算法封装为服务,提供 HTTP 接口dotnet 作为客户端调用服务。
#### 优点 & 缺点
优点
- 客户机不需要有较高的配置,也不需要安装 Python 环境,服务端可采用 Linux配置 cuda 等 GPU 计算环境,服务端一直处于热部署状态,性能较好;
- 通过联网对客户有更好的控制;
- 软件架构分为客户端和服务端,开发成本低,各端定位问题比较简单;
- 保密性好
缺点
- 架构较复杂,需要客户端联网才能使用;
- 需要考虑服务端成本;
### 1.2 封装为动态链接库
#### 方案说明
将 Python 功能封装为 dll 提供给 C# 调用
#### 优点 & 缺点
优点
- 客户端不需要联网,使用比较方便
- Python 开发成本较低
缺点
- Python 自带包里的方法封装为 dll 是可行的,但对于依赖大量通过 pip 安装的包来说,是否可行需要调研,相较于上一个方案,开发成本较高;
- 客户端软件+硬件安装较复杂,需要安装 Python 环境,甚至需要安装 cuda 驱动、配置 GPU 计算环境;
### 1.3 不封装或者封装为可执行文件
#### 方案说明
使用 Python 开发算法内核,将源文件放在 C# 工程中,客户端配置好 Python(or Anaconda) 环境,直接调用 Python 解释器执行脚本,或者将脚本封装为 exe 调用,参考 https://github.com/Nuitka/Nuitka 将 Python 源码编译为 exe 文件。
#### 优点 & 缺点
优点
- 开发成本低
缺点
- 保密性不好,客户端有可能查看到算法源代码(待定,目前调研 Blender 是用 Nuitka 封装的)
## 2 C++/C# 开发算法内核
#### 方案说明
使用 C++/C# 开发算法内核,并封装为 dll 提供给 C# 调用。已知一个 C++ 可用的分类代码库https://github.com/dsteinberg/libcluster
#### 优点 & 缺点
优点
- 运行效率高
- 难以被反编译
缺点
- 开发成本较高
- C++ GPU 编程需调研
## 3 Matlab 提供算法
#### 方案说明
使用 Matlab 开发算法内核,封装为 dll 提供给 C# 调用。
#### 优点 & 缺点
优点
- 运行效率高
- 难以被反编译
- 开发成本可控
缺点
- GPU 开发需要调研
- 使用 Matlab 可能需要授权

101
article/git/git.md Normal file
View File

@ -0,0 +1,101 @@
# git 配置
## 账号配置
### 配置密钥
按邮箱生成密钥
```bash
ssh-keygen -t rsa -f ~/.ssh/id_rsa_your_custom_name -C "your email"
```
添加密钥
```bash
ssh-add ~/.ssh/id_rsa_your_custom_name
```
编辑 `~/.ssh/config` 文件,添加如下内容:
```text
Host github.com
HostName github.com
User Your_Custom_name
IdentityFile ~/.ssh/id_rsa_your_custom_name
```
### 配置单用户
cd 到项目的根目录,查看 git 配置:
```bash
git config --list
```
看一下 `user.name``user.email` 是否和希望上传的账号匹配,否则使用如下命令进行修改:
```bash
git config user.email "your@email.com"
git config user.name "your name"
```
### 配置多用户
File `~/.ssh/config` is also very useful when you have to work with multiple git accounts.
```config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github
Host github_as_alice
HostName github.com
User git
IdentityFile ~/.ssh/github_alice
Host github_as_bob
HostName github.com
User git
IdentityFile ~/.ssh/github_bob
```
Default `github.com` will work by default.
For alice: replace 'git@github.com' with 'git@github\_as\_alice' when you use `git clone` or `git remote add origin`.
For bob: replace 'git@github.com' with 'git@github\_as\_bob' when you use `git clone` or `git remote add origin`.
## 跨平台提交代码配置
在 windows 系统中设置
```bash
git config --global core.autocrlf input
git config --global core.safecrlf true
git config --global core.eol lf
```
## 设置编辑器
```bash
git config --global core.editor vim
git config --global merge.tool vimdiff
```
## 编译高版本 git
```bash
yum -y install zlib-devel curl-devel openssl-devel perl cpio expat-devel gettext-devel openssl zlib autoconf tk perl-ExtUtils-MakeMaker
```
下面的命令将 git 安装到 `/usr/local/bin/` 中,可以自行设置 `--prefix`
```bash
cd /path/to/git/source
./configure --prefix=/usr/local
make
make install
```

13
article/golang/module.md Normal file
View File

@ -0,0 +1,13 @@
# module usage
## init a package
```bash
go mod init
```
## remove unused packages
```bash
go mod tidy
```

10
article/golang/vim-go.md Normal file
View File

@ -0,0 +1,10 @@
# Vim-go Usage
## vim-go: : packages.Load error
Type the commands bellow:
```bash
go clean -cache
```

View File

@ -0,0 +1,54 @@
# Graphviz markdown doc example
## basic dot example
```graphviz
digraph example {
node [shape="diamond"]
edge [style="dashed"]
a[style="filled", color="green"]
b
c
d
a -> b
b -> d
c -> d[color="red"]
}
```
## struct example
> Not supporting so well
```graphviz
digraph structs {
node [shape=plaintext]
struct1 [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR>
</TABLE>>];
struct2 [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD PORT="f0">one</TD><TD>two</TD></TR>
</TABLE>>];
struct3 [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD ROWSPAN="3">hello<BR/>world</TD>
<TD COLSPAN="3">b</TD>
<TD ROWSPAN="3">g</TD>
<TD ROWSPAN="3">h</TD>
</TR>
<TR>
<TD>c</TD><TD PORT="here">d</TD><TD>e</TD>
</TR>
<TR>
<TD COLSPAN="3">f</TD>
</TR>
</TABLE>>];
struct1:f1 -> struct2:f0;
struct1:f2 -> struct3:here;
}
```

View File

@ -0,0 +1,18 @@
typedef struct st_hash_type {
int (*compare) ();
int (*hash) ();
} st_hash_type;
typedef struct st_table_entry {
unsigned int hash;
char *key;
char *record;
st_table_entry *next;
} st_table_entry;
typedef struct st_table {
struct st_hash_type *type;
int num_bins; /* slot count */
int num_entries; /* total number of entries */
struct st_table_entry **bins; /* slot */
} st_table;

View File

@ -0,0 +1,13 @@
digraph hashmap {
rankdir = TB
node[color="skyblue", shape="record"]
edge[color="crimson"]
st_hash_type[label="{<head>st_hash_type|(*compare)|(*hash)}"]
st_table_entry[label="{<head>st_table_entry|hash|key|record|<next>next}"]
st_table[label="{st_table|<type>type|num_bins|num_entries|<bins>bins}"]
st_table:bins -> st_table_entry:head
st_table:type -> st_hash_type:head
st_table_entry:next -> st_table_entry:head[style="dashed", color="forestgreen"]
}

View File

@ -0,0 +1,28 @@
digraph structs {
node [shape=plaintext]
struct1 [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR>
</TABLE>>];
struct2 [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD PORT="f0">one</TD><TD>two</TD></TR>
</TABLE>>];
struct3 [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD ROWSPAN="3">hello<BR/>world</TD>
<TD COLSPAN="3">b</TD>
<TD ROWSPAN="3">g</TD>
<TD ROWSPAN="3">h</TD>
</TR>
<TR>
<TD>c</TD><TD PORT="here">d</TD><TD>e</TD>
</TR>
<TR>
<TD COLSPAN="3">f</TD>
</TR>
</TABLE>>];
struct1:f1 -> struct2:f0;
struct1:f2 -> struct3:here;
}

View File

@ -0,0 +1,9 @@
digraph structs {
rankdir=TB
node [shape="record"]
struct1 [label="<f0> left | <f1> middle | <f2> right"]
struct2 [label="<f0> one | <f1> two"]
struct3 [label="hello\nworld | {b | {c | <here> d | e} | f} | g | h"]
struct1:f1 -> struct2:f0
struct1:f2 -> struct3:here
}

3916
article/ipv4.txt Normal file

File diff suppressed because it is too large Load Diff

1030
article/ipv6.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
# Deploy jupyter notebook on server
## Configuration
Generate jupyter config file using
```bash
jupyter notebook --generate-config
```
if root is needed, then
```bash
jupyter notebook --generate-config --allow-config
```
Generate password in `jupyter_notebook_config.json`
```python
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:bfd19efa9f26:95beb6e644bf1c0472def724538f6458efa9976f'
```
Modify `jupyter_notebook_config.py`
```python
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:xxxxxx'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
```
Install gophernotes
```bash
go get -u github.com/gopherdata/gophernotes
mkdir -p ~/.local/share/jupyter/kernels/gophernotes
cp $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes
```

54
article/mermaid.md Normal file
View File

@ -0,0 +1,54 @@
# Markdown documents using mermaid
## Flowchart
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
## Sequence Diagram
```mermaid
sequenceDiagram
Alice->>Bob: Hello Bob, how are you?
alt is sick
Bob->>Alice: Not so good :(
else is well
Bob->>Alice: Feeling fresh like a daisy
end
opt Extra response
Bob->>Alice: Thanks for asking
end
```
## Class Diagram
```mermaid
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck {
+String beakColor
+swim()
+quack()
}
class Fish {
-int sizeInFeet
-canEat()
}
class Zebra {
+bool is_wild
+run()
}
```

21
article/mitmproxy.md Normal file
View File

@ -0,0 +1,21 @@
# mitmproxy
## Installation
```bash
yay -S mitmproxy
```
## Usage
### Preparation
Activate mitmproxy and listen to port:
```bash
mitmproxy -p 8888
```
Set your wifi connection to manual proxy, IP address can be found using `ip address` or `ifconfig`, and set port to 8888.
Then open your browser and locate to `mitm.it` and choose cert. For example, I choose Android.

33
article/mysql/backup.md Normal file
View File

@ -0,0 +1,33 @@
# Mysql Config
## Backup and recover
### Backup
Backup all databases schema with data:
```bash
mysqldump -uroot -p123456 -h localhost -P 3306 --all-databases --default-character-set=utf8 --single-transaction > all.sql
```
Bakcup specified database
### Restore Databases
```bash
mysql -uroot -p123456 < all.sql
```
## User Config
### Creation
```bash
create user 'work'@'%' identified by '123456';
```
### Grant privileges
```bash
grant all on *.* to 'work'@'%';
```

37
article/mysql/mariadb.md Normal file
View File

@ -0,0 +1,37 @@
# Mariadb Memo
## Initialize Mariadb
Basic user and dir config, using:
```bash
mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
```
## Security Configuration
```bash
mysql_secure_installation
```
Mariadb can login as system user root without password. Usually root can only be allowed to login from localhost.
## Create Operation Users
Create a user with CRUD access:
```bash
create user demo_rw@'%' IDENTIFIED by 'your password';
```
Then grant access:
```bash
grant select, insert, update, delete on `demo`.* to 'demo_rw'@'%';
```
And refresh privilages:
```bash
flush privileges;
```

View File

@ -0,0 +1,17 @@
# apifox
## Create desktop icon
```bash
cat > ~/.local/share/applications/Apifox.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Apifox
Exec=apifox
Icon=/opt/apifox/resources/app/dist/renderer/static/logo-pure.72d6fd6f.png
Terminal=false
Type=Application
Categories=Development;
EOL
```

View File

@ -0,0 +1,176 @@
# Archlinux Installation based on BIOS/MBR
## 1 安装准备
下载 archlinux 安装镜像,并刻录到 U 盘windows 可以用 Etcher 刻录Linux 系统可以直接用命令刻录:
```bash
dd if=archlinux.iso of=/dev/sdx bs=512k
```
## 2 进入 Live 系统
安装 Archlinux 需要联网,如果是有线网并且路由器支持 DHCP插上网线后执行 `dhcpcd` 获取 IP 地址。
更新系统时间:
```bash
timedatectl set-ntp true
```
## 3 分区
查看磁盘:
```bash
fdisk -l
```
选择磁盘,创建 MBR 分区,将 `sdx` 更改为自己的磁盘,如 `sda`, `sdb` ...
```bash
fdisk /dev/sdx
```
我个人习惯分三个区:`/boot`, `/`, `/home`
1. 输入 `n` 创建一个新的分区,首先输入起始扇区,选择默认就好,然后输入分区大小,这里输入 `+512m` 创建引导分区;
2. 输入 `n` 创建第二个分区,选择默认起始扇区,输入 `+20g`;
3. 输入 `n` 创建第三个分区,选择默认起始扇区,直接回车使用默认大小;
输入 `w` 将分区的改动写入磁盘,并执行格式化。注意引导分区要格式化成 FAT32 的格式。
```bash
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
```
## 4 安装
挂载分区:
```bash
mount /dev/sda2 /mnt
mkdir /mnt/boot /mnt/home
mount /dev/sda1 /mnt/boot
mount /dev/sda3 /mnt/home
```
选择镜像源:
```bash
vim /etc/pacman.d/mirrorlist
```
或者手动输入(这里选择了清华的镜像)
```bash
Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
```
接下来安装基本的组件:
```bash
pacstrap /mnt base base-devel linux-lts414 dhcpcd
```
这里选择的 linux 内核版本是 4.14 LTS 版,想安装其他版本的内核只需要改下名称(`linux`, `linux-lts`),例如 linux 表示最新版本的内核linux-lts 表示最新版本的 LTS 版内核。这一步需要等下载完成后安装。
## 5 配置
### 5.1 配置 fstab
执行下面的命令,生成自动挂载分区的 fstab 文件:
```bash
genfstab -L /mnt >> /mnt/etc/fstab
```
检查生成的文件是否正确:
```bash
cat /mnt/etc/fstab
```
## 5.2 配置系统
```bash
arch-chroot /mnt
```
如果系统出现问题,只要插入 U 盘启动,然后将系统根分区挂载到 `/mnt` 下,再通过命令即可进行修复。
### 设置时区
```bash
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
```
### 安装必须的软件包
```bash
pacman -S vim dialog wpa_supplicant ntfs-3g networkmanager
```
### 设置 locale
```bash
vim /etc/locale.gen
```
设置 `en_US.UTF-8` 然后执行 `locale-gen`
```bash
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo $hostname >> /etc/hostname
```
### 设置 hosts
编辑 `/etc/hosts`,加入
```text
127.0.0.1 localhost
::1 localhost
```
### 设置 root 密码
```bash
passwd
```
### 安装 intel-ucode
非 intel CPU 跳过
```bash
pacman -S intel-ucode
```
### 配置 boot
```bash
pacman -S os-prober ntfs-3g grub
```
部署 grub
```bash
grub-install --target=i386-pc /dev/sdx
```
生成配置文件:
```bash
grub-mkconfig -o /boot/grub/grub.cfg
```
### 重启
```bash
exit
reboot
```

View File

@ -0,0 +1,143 @@
# Debtap Convert DEB Packages Into Arch Linux Packages
For this purpose, we are going to use an utility called “Debtap”. It stands DEB To Arch (Linux) Package. Debtap is available in AUR, so you can install it using the AUR helper tools such as Yay.
To unstall debtap using pacaur, run:
```bash
$ yay -S debtap
```
And, make sure your Arch system should have bash, binutils, pkgfile and fakeroot packages installed.
After installing Debtap and all above mentioned dependencies, run the following command to create/update pkgfile and debtap database.
```bash
$ sudo debtap -u
```
Sample output would be:
```bash
==> Synchronizing pkgfile database...
:: Updating 6 repos...
download complete: archlinuxfr [ 151.7 KiB 67.5K/s 5 remaining]
download complete: multilib [ 319.5 KiB 36.2K/s 4 remaining]
download complete: core [ 707.7 KiB 49.5K/s 3 remaining]
download complete: testing [ 1716.3 KiB 58.2K/s 2 remaining]
download complete: extra [ 7.4 MiB 109K/s 1 remaining]
download complete: community [ 16.9 MiB 131K/s 0 remaining]
:: download complete in 131.47s < 27.1 MiB 211K/s 6 files >
:: waiting for 1 process to finish repacking repos...
==> Synchronizing debtap database...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 34.1M 100 34.1M 0 0 206k 0 0:02:49 0:02:49 --:--:-- 180k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 814k 100 814k 0 0 101k 0 0:00:08 0:00:08 --:--:-- 113k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 120k 100 120k 0 0 61575 0 0:00:02 0:00:02 --:--:-- 52381
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35.4M 100 35.4M 0 0 175k 0 0:03:27 0:03:27 --:--:-- 257k
==> Downloading latest virtual packages list...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 149 0 149 0 0 49 0 --:--:-- 0:00:03 --:--:-- 44
100 11890 0 11890 0 0 2378 0 --:--:-- 0:00:05 --:--:-- 8456
==> Downloading latest AUR packages list...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 264k 0 264k 0 0 30128 0 --:--:-- 0:00:09 --:--:-- 74410
==> Generating base group packages list...
==> All steps successfully completed!
```
You must run the above command at least once.
Now, its time for package conversion.
To convert any DEB package, say Quadrapassel, to Arch Linux package using debtap, do:
```bash
$ debtap quadrapassel_3.22.0-1.1_arm64.deb
```
The above command will convert the given .deb file into a Arch Linux package. You will be asked to enter the name of the package maintainer and license. Just enter them and hit ENTER key to start the conversion process.
The package conversion will take from a few seconds to several minutes depending upon your CPU speed. Grab a cup of coffee.
Sample output would be:
```bash
==> Extracting package data...
==> Fixing possible directories structure differencies...
==> Generating .PKGINFO file...
:: Enter Packager name:
quadrapassel
:: Enter package license (you can enter multiple licenses comma separated):
GPL
*** Creation of .PKGINFO file in progress. It may take a few minutes, please wait...
Warning: These dependencies (depend = fields) could not be translated into Arch Linux packages names:
gsettings-backend
==> Checking and generating .INSTALL file (if necessary)...
:: If you want to edit .PKGINFO and .INSTALL files (in this order), press (1) For vi (2) For nano (3) For default editor (4) For a custom editor or any other key to continue:
==> Generating .MTREE file...
==> Creating final package...
==> Package successfully created!
==> Removing leftover files...
```
Note: Quadrapassel package is already available in the Arch Linux official repositories. I used it just for demonstration purpose.
If you dont want to answer any questions during package conversion, use -q flag to bypass all questions, except for editing metadata file(s).
```bash
$ debtap -q quadrapassel_3.22.0-1.1_arm64.deb
```
To bypass all questions (not recommended though), use -Q flag.
```bash
$ debtap -Q quadrapassel_3.22.0-1.1_arm64.deb
```
Once the conversion is done, you can install the newly converted package using “pacman” in your Arch system as shown below.
```bash
$ sudo pacman -U <package-name>
```
To display the help section, use *-h* flag:
```bash
$ debtap -h
Syntax: debtap [options] package_filename
Options:
-h --h -help --help Prints this help message
-u --u -update --update Update debtap database
-q --q -quiet --quiet Bypass all questions, except for editing metadata file(s)
-Q --Q -Quiet --Quiet Bypass all questions (not recommended)
-s --s -pseudo --pseudo Create a pseudo-64-bit package from a 32-bit .deb package
-w --w -wipeout --wipeout Wipeout versions from all dependencies, conflicts etc.
-p --p -pkgbuild --pkgbuild Additionally generate a PKGBUILD file
-P --P -Pkgbuild --Pkgbuild Generate a PKGBUILD file only
```
And, thats all for now folks. Hope this utility helps. If you find our guides useful, please spend a moment to share them on your social, professional networks and support OSTechNix!
More good stuffs to come. Stay tuned!
Cheers!

View File

@ -0,0 +1,104 @@
# Install some useful tool on CentOS 6u3
## Compile and install tmux v2.3
```bash
if [[ $(fs --version) =~ "afs" ]] && fs whereis "$HOME/..local" ; then
NCURSES_OPTION=" --enable-symlinks"
else
NCURSES_OPTION=""
fi
./configure CFLAGS="-I$HOME/.local/include -I$HOME/.local/include/ncurses" LDFLAGS="-L$HOME/.local/lib -L$HOME/.local/include/ncurses -L$HOME/.local/include" CPPFLAGS="-I$HOME/.local/include -I$HOME/.local/include/ncurses" LDFLAGS="-static -L$HOME/.local/include -L$HOME/.local/include/ncurses -L$HOME/.local/lib" --prefix=$HOME/.local
make
make install
```
## Compile vim 8.1
### Based on system Python
```bash
./configure \
--disable-nls \
--enable-cscope \
--enable-gui=no \
--enable-multibyte \
--prefix=$HOME/.local/vim \
--with-features=huge \
--enable-python3interp=yes \
--with-python3-config-dir=$HOME/.local/python-3.7/lib/python3.7/config-3.7m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-rubyinterp=yes \
--with-tlib=ncurses \
--without-x
```
### Base on Anaconda Python
```bash
./configure --enable-terminal --enable-gui=auto \
--with-features=huge \
--enable-multibyte \
--enable-cscope --enable-terminal --enable-gui=auto \
--prefix=$HOME/.local \
--enable-python3interp \
--with-python3-config-dir=$HOME/.local/anaconda3/lib/python3.6/config \
--includedir=$HOME/.local/anaconda3/include \
LDFLAGS=" -L$HOME/.local/anaconda3/lib -L$HOME/.local/anaconda3/lib/python3.6/config-3.6m-x86_64-linux-gnu"
make
make install
```
如果 `make install` 显示写入 `/usr/local` 目录无权限,进入 `vim-$(version)/src` 文件夹,编辑 Makefile 文件,修改 prefix 路径为 `$HOME/.local` 即可。 安装完成后vim 的位置是 `$HOME/.local/bin/vim`
### Base on Anaconda Python 3.8
```bash
VIM_CODE=$HOME/download/vim-8.2.2767
CONF=$VIM_CODE/configure
$CONF \
--enable-terminal \
--enable-gui=no \
--with-features=huge \
--enable-multibyte \
--enable-cscope=yes \
--prefix=$HOME/.local/vim \
--enable-python3interp=yes \
--with-python3-config-dir="$HOME/.local/anaconda3/lib/python3.8/config-3.8-x86_64-linux-gnu" \
--includedir="$HOME/.local/anaconda3/include" \
LDFLAGS=" -L/usr/lib -L/usr/local/lib -L/usr/lib64 -L$HOME/.local/anaconda3/lib -L$HOME/.local/anaconda3/lib/python3.8/config-3.8-x86_64-linux-gnu"
# --with-tlib=ncurses \
```
## Compile git version 2.27
### Install reliance
<color red>root is required!</color>
```bash
yum -y install zlib-devel curl-devel openssl-devel perl cpio expat-devel gettext-devel openssl zlib autoconf tk perl-ExtUtils-MakeMaker
```
### Compile git
```bash
cd /path/to/git/source
./configure --prefix=/usr
make
make install
```
## Compile Redis
```bash
$ wget http://download.redis.io/releases/redis-5.0.7.tar.gz
$ tar xzf redis-5.0.7.tar.gz
$ cd redis-5.0.7
$ make
# make install
```

View File

@ -0,0 +1,10 @@
# Protect Specified Folder on Linux
## chattr
Just type the following command to protect your folder or file `$path` from being removed by command `rm` or `sudo rm -rf`.
```bash
chattr -R +i $path
```

View File

@ -0,0 +1,11 @@
# crontab usage
## Get yesterday
`%` 需要做转义
```
0 9 * * * python2.6 $HOME/.local/cron/disk_monitor.py
9 0 * * * curl "http://localhost:8000/sync?query_date=$(date -d 'yesterday' +\%Y-\%m-\%d)"
```

19
article/os/linux/cuda.md Normal file
View File

@ -0,0 +1,19 @@
# Cuda Config
## Nvidia Driver Installation
Open settings and install selected nvidia driver, then install essential packages required by cuda.
> PS: Here I'm using linux54 with nvidia driver version 450xx
```bash
yay -S linux54-nvidia-450xx nvidia-450xx-utils opencl-nvidia-450xx lib32-nvidia-450xx-utils
```
## Cuda Installation
```bash
yay -S cuda
```
Run `nvidia-smi` to check nvidia driver.

18
article/os/linux/file.md Normal file
View File

@ -0,0 +1,18 @@
# Linux
## 匿名映射
使用映射区完成文件的读写十分方便,父子进程间通信也容易,但缺陷是每次创建映射区一定要依赖一个文件才能实现。通常为了创建映射区要 open 一个 temp 文件,创建好了再进行 unlink、close这样比较麻烦可以直接使用匿名映射来替代。Linux 系统提供了创建匿名映射区的方法,无需依赖文件即可创建映射区,同样需要借助标志位参数 flags 来指定。使用 `MAP_ANONYMOUS`(or `MAP_ANON`) 如:
```c
int *p = mmap(NULL, 4, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
```
4 是举例表明该位置表大小,可依据实际需要填写。
需要注意的是 `MAP_ANONYMOUS` 是 Linux 操作系统特有的宏,在类 Unix 系统中如果没有该宏的定义,可使用如下两步完成匿名映射区的建立:
```c
fd = open("/dev/zero", O_RDWR);
p = mmap(NULL, 4, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
```

View File

@ -0,0 +1,21 @@
# Detect wlans
```bash
airmon-ng
```
Start monitor mode
```bash
airmon-ng start wlan1
ifconfig
airodump-ng wlan1mon
airodump-ng -w /path/to/save/files/ -c 1 --bssid WL:AN:MAC wlan1mon
aireplay-ng -0 10 -a WLAN:MAC -c DEVICE:MAC wlan1mon
```
Stop monitor mode
```bash
airmon-ng stop wlan1mon
```

34
article/os/linux/kali.md Normal file
View File

@ -0,0 +1,34 @@
# Kali Config
## openvpn config
```bash
sudo apt install openresolv
```
## add user
```bash
useradd -m username
passwd username
usermod -a -G sudo username
chsh -s /bin/zsh username
```
## change group name
```bash
groupmod -n admin $old_name
```
## add sudo group
```bash
groupadd sudo
```
## add user to group
```bash
usermod -aG sudo ${USER}
```

View File

@ -0,0 +1,22 @@
# Install Postman app on Linux based on Debian
```bash
sudo tar -xzf postman.tar.gz -C /opt
rm postman.tar.gz
sudo ln -s /opt/Postman/Postman /usr/bin/postman
```
Create a desktop file for launcher
```bash
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL
```

29
article/os/linux/scp.md Normal file
View File

@ -0,0 +1,29 @@
# 在线上机器和本机互传文件
## 上传
```bash
scp localfile target_machine:target_path
```
example:
```bash
scp ./filename.txt server.com:~/Files/
```
## 下载
```bash
scp target_machine:target_file local_path
```
example:
```bash
scp server.com:~/Files/filename.txt ~/files/
```
```bash
scp username@server.com:~/Files/filename.txt ~/files/
```

38
article/os/linux/tpp.md Normal file
View File

@ -0,0 +1,38 @@
# Text Powerpoint
## Installation On Debian
```bash
sudo apt-get install libncurses5-dev libncursesw5-dev
sudo gem install ncurses-ruby
```
## Usage
```tpp
--fgcolor black
--bgcolor white
--title FG/BG tests
--author Andreas Krennmair
--date today
This is the abstract. Bla, bla.
--newpage
--heading bla bla bla
* bla
* bla
---
--beginslideleft
* bla
--endslideleft
--beginslidetop
* bla
--endslidetop
more bla bla bla.
```

View File

@ -0,0 +1,6 @@
# xfce Config
## Clipman
`xfce4-popup-clipman` is used to popup clipman board, which can be mapped to key shortcut `meta+v`.

96
article/os/mac/MacOS.md Normal file
View File

@ -0,0 +1,96 @@
# MacOS
## Write Protect File From Command Line
### Change File Flags With the chflags Command
The chflags command modifies the file flags. First, open the terminal and to set system immutable flag type the following command:
```bash
sudo chflags schg fileName
```
The owner can set the user immutable flag as follows (no need to use sudo or superuser password):
```bash
chflags uchg fileName
```
In this, example set user immutable flag on resume.txt file, enter:
```bash
chflags uchg resume.txt
```
To list flags, enter:
```bash
ls -lO resume.txt
```
Sample outputs:
```bash
-rw-r--r-- 1 vivek wheel uchg 18424 Jun 2 18:48 resume.txt
```
Now, try deleting or writing to the same file, enter:
```bash
rm resume.txt
```
Sample outputs:
```bash
override rw-r--r-- vivek/wheel uchg for resume.txt? y
rm: resume.txt: Operation not permitted
```
### How Do I Remove User Immutable Flag?
Use the command as follows:
```bash
chflags nouchg resume.txt
ls -lO resume.txt
```
Sample outputs:
```bash
-rw-r--r-- 1 vivek wheel - 18424 Jun 2 18:48 resume.txt
```
Putting the letters no before causes the flag to be cleared.
### How Do I Remove System Immutable Flag?
Use the command as follows:
```bash
sudo chflags noschg resume.txt
ls -lO resume.txt<
```
Please note that above commands works on both the file and folder (remember, under UNIX everything is file).
## Remove jdk
Remove JDK
```bash
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
```
Remove plugins
```bash
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
sudo rm -rf /Library/LaunchDaemons/com.oracle.java.Helper-Tool.plist
sudo rm -rf /Library/Preferences/com.oracle.java.Helper-Tool.plist
```

40
article/os/mac/brew.md Normal file
View File

@ -0,0 +1,40 @@
# MAC 配置 brew
## 更改 brew 源为中科院镜像
```bash
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
```
## 把 homebrew-core 的镜像地址设为中科院的国内镜像
```bash
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
```
## 更改为清华镜像
```bash
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
```
## 恢复为 github
```bash
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core
```
更换为国内源
```bash
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
```

43
article/os/win10/wsl.md Normal file
View File

@ -0,0 +1,43 @@
# 修复 WSL 子系统文件权限
## 创建 wsl.conf 文件
```sh
$ vim /etc/wsl.conf
```
写入
```text
[automount]
enabled = true
# root = /mnt/
options = "metadata,umask=22,fmask=11"
# mountFsTab = false
```
## 配置 bashrc 或者 zshrc
```sh
if [ "$(umask)" = "0000" ]; then
umask 0022
fi
```
> 参考[文章](https://www.turek.dev/post/fix-wsl-file-permissions/)
## 备份和恢复
### 备份
打开 powershell
```ps
wsl --export Debian debian.tar
```
### 恢复
```ps
wsl --import Debian debian.tar
```

42
article/tex/cone.tex Normal file
View File

@ -0,0 +1,42 @@
% A cone in 3D
% Author: Marco Daniel
\documentclass{article}
\usepackage{tikz}
%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>
\begin{comment}
:Title: A Cone in 3D
:Tags: 2D,geometry,mathematics
:Author: Marco Daniel
:Slug: cone
\end{comment}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{0}
\begin{tikzpicture}[tdplot_main_coords]
\def\RI{2}
\def\RII{1.25}
\draw[thick] (\RI,0)
\foreach \x in {0,300,240,180} { -- (\x:\RI) node at (\x:\RI) (R1-\x) {} };
\draw[dashed,thick] (R1-0.center)
\foreach \x in {60,120,180} { -- (\x:\RI) node at (\x:\RI) (R1-\x) {} };
\path[fill=gray!30] (\RI,0)
\foreach \x in {0,60,120,180,240,300} { -- (\x:\RI)};
\begin{scope}[yshift=2cm]
\draw[thick,fill=gray!30,opacity=0.2] (\RII,0)
\foreach \x in {0,60,120,180,240,300,360} { -- (\x:\RII) node at (\x:\RII) (R2-\x) {}};
\end{scope}
\foreach \x in {0,180,240,300} { \draw (R1-\x.center)--(R2-\x.center); };
\foreach \x in {60,120} { \draw[dashed] (R1-\x.center)--(R2-\x.center); };
\end{tikzpicture}
\end{document}

View File

@ -0,0 +1,17 @@
# Wireshark installation
```bash
yay -S wireshark-gtk
```
## add user to group
```bash
gpasswd -a $(whoami) wireshark
```
exec wireshark without relogin
```bash
newgrp wireshark
```

View File

@ -0,0 +1,908 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Import additional configuration files
#
# Imports are loaded in order, skipping all missing files, with the importing
# file being loaded last. If a field is already present in a previous import, it
# will be replaced.
#
# All imports must either be absolute paths starting with `/`, or paths relative
# to the user's home directory starting with `~/`.
#import:
# - /path/to/alacritty.yml
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
#env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.
#TERM: alacritty
window:
# Window dimensions (changes require restart)
#
# Number of lines/columns (not pixels) in the terminal. The number of columns
# must be at least `2`, while using a value of `0` for columns and lines will
# fall back to the window manager's recommended size.
dimensions:
columns: 0
lines: 0
# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
#position:
# x: 0
# y: 0
# Window padding (changes require restart)
#
# Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides.
#padding:
# x: 0
# y: 0
# Spread additional padding evenly around the terminal content.
#dynamic_padding: false
# Window decorations
#
# Values for `decorations`:
# - full: Borders and title bar
# - none: Neither borders nor title bar
#
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background and no title bar buttons
decorations: none
# Background opacity
#
# Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque.
#opacity: 1.0
# Startup Mode (changes require restart)
#
# Values for `startup_mode`:
# - Windowed
# - Maximized
# - Fullscreen
#
# Values for `startup_mode` (macOS only):
# - SimpleFullscreen
startup_mode: Maximized
# Window title
#title: Alacritty
# Allow terminal applications to change Alacritty's window title.
dynamic_title: true
# Window class (Linux/BSD only):
#class:
# Application instance name
#instance: Alacritty
# General application class
#general: Alacritty
# GTK theme variant (Linux/BSD only)
#
# Override the variant of the GTK theme. Commonly supported values are `dark`
# and `light`. Set this to `None` to use the default theme variant.
#gtk_theme_variant: None
#scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
history: 10000
# Scrolling distance multiplier.
multiplier: 3
# Font configuration
font:
# Normal (roman) font face
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: "MesloLGL Nerd Font"
# The `style` can be specified to pick a specific face.
#style: Regular
# Bold font face
bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
family: "MesloLGL Nerd Font"
# The `style` can be specified to pick a specific face.
#style: Bold
# Italic font face
italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
family: "MesloLGL Nerd Font"
# The `style` can be specified to pick a specific face.
#style: Italic
# Bold italic font face
bold_italic:
# Font family
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
family: "MesloLGL Nerd Font"
# The `style` can be specified to pick a specific face.
#style: Bold Italic
# Point size
size: 12.0
# Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter
# spacing.
#offset:
# x: 0
# y: 0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increasing `x` moves the glyph to the
# right, increasing `y` moves the glyph upward.
#glyph_offset:
# x: 0
# y: 0
# Thin stroke font rendering (macOS only)
#
# Thin strokes are suitable for retina displays, but for non-retina screens
# it is recommended to set `use_thin_strokes` to `false`.
#use_thin_strokes: true
# If `true`, bold text is drawn using the bright color variants.
#draw_bold_text_with_bright_colors: false
# Colors (Tomorrow Night)
#colors:
# Default colors
#primary:
# background: '#1d1f21'
# foreground: '#c5c8c6'
# Bright and dim foreground colors
#
# The dimmed foreground color is calculated automatically if it is not
# present. If the bright foreground color is not set, or
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground
# color will be used.
#dim_foreground: '#828482'
#bright_foreground: '#eaeaea'
# Cursor colors
#
# Colors which should be used to draw the terminal cursor.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#cursor:
# text: CellBackground
# cursor: CellForeground
# Vi mode cursor colors
#
# Colors for the cursor when the vi mode is active.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#vi_mode_cursor:
# text: CellBackground
# cursor: CellForeground
# Search colors
#
# Colors used for the search bar and match highlighting.
#search:
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#matches:
# foreground: '#000000'
# background: '#ffffff'
#focused_match:
# foreground: '#ffffff'
# background: '#000000'
#bar:
# background: '#c5c8c6'
# foreground: '#1d1f21'
# Keyboard regex hints
#hints:
# First character in the hint label
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#start:
# foreground: '#1d1f21'
# background: '#e9ff5e'
# All characters after the first one in the hint label
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#end:
# foreground: '#e9ff5e'
# background: '#1d1f21'
# Line indicator
#
# Color used for the indicator displaying the position in history during
# search and vi mode.
#
# By default, these will use the opposing primary color.
#line_indicator:
# foreground: None
# background: None
# Selection colors
#
# Colors which should be used to draw the selection area.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#selection:
# text: CellBackground
# background: CellForeground
# Normal colors
#normal:
# black: '#1d1f21'
# red: '#cc6666'
# green: '#b5bd68'
# yellow: '#f0c674'
# blue: '#81a2be'
# magenta: '#b294bb'
# cyan: '#8abeb7'
# white: '#c5c8c6'
# Bright colors
#bright:
# black: '#666666'
# red: '#d54e53'
# green: '#b9ca4a'
# yellow: '#e7c547'
# blue: '#7aa6da'
# magenta: '#c397d8'
# cyan: '#70c0b1'
# white: '#eaeaea'
# Dim colors
#
# If the dim colors are not set, they will be calculated automatically based
# on the `normal` colors.
#dim:
# black: '#131415'
# red: '#864343'
# green: '#777c44'
# yellow: '#9e824c'
# blue: '#556a7d'
# magenta: '#75617b'
# cyan: '#5b7d78'
# white: '#828482'
# Indexed Colors
#
# The indexed colors include all colors from 16 to 256.
# When these are not set, they're filled with sensible defaults.
#
# Example:
# `- { index: 16, color: '#ff00ff' }`
#
#indexed_colors: []
# Transparent cell backgrounds
#
# Whether or not `window.opacity` applies to all cell backgrounds or only to
# the default background. When set to `true` all cells will be transparent
# regardless of their background color.
#transparent_background_colors: false
# Colors (Solarized Dark)
colors:
# Default colors
primary:
background: '#002b36' # base03
foreground: '#839496' # base0
# Cursor colors
cursor:
text: '#002b36' # base03
cursor: '#839496' # base0
# Normal colors
normal:
black: '#073642' # base02
red: '#dc322f' # red
green: '#859900' # green
yellow: '#b58900' # yellow
blue: '#268bd2' # blue
magenta: '#d33682' # magenta
cyan: '#2aa198' # cyan
white: '#eee8d5' # base2
# Bright colors
bright:
black: '#002b36' # base03
red: '#cb4b16' # orange
green: '#586e75' # base01
yellow: '#657b83' # base00
blue: '#839496' # base0
magenta: '#6c71c4' # violet
cyan: '#93a1a1' # base1
white: '#fdf6e3' # base3
# Bell
#
# The bell is rung every time the BEL control character is received.
bell:
# Visual Bell Animation
#
# Animation effect for flashing the screen when the visual bell is rung.
#
# Values for `animation`:
# - Ease
# - EaseOut
# - EaseOutSine
# - EaseOutQuad
# - EaseOutCubic
# - EaseOutQuart
# - EaseOutQuint
# - EaseOutExpo
# - EaseOutCirc
# - Linear
animation: EaseOutExpo
# Duration of the visual bell flash in milliseconds. A `duration` of `0` will
# disable the visual bell animation.
duration: 0
# Visual bell animation color.
#color: '#ffffff'
# Bell Command
#
# This program is executed whenever the bell is rung.
#
# When set to `command: None`, no command will be executed.
#
# Example:
# command:
# program: notify-send
# args: ["Hello, World!"]
#
#command: None
selection:
# This string contains all characters that are used as separators for
# "semantic words" in Alacritty.
semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard: true
cursor:
# Cursor style
style:
# Cursor shape
#
# Values for `shape`:
# - ▇ Block
# - _ Underline
# - | Beam
shape: Block
# Cursor blinking state
#
# Values for `blinking`:
# - Never: Prevent the cursor from ever blinking
# - Off: Disable blinking by default
# - On: Enable blinking by default
# - Always: Force the cursor to always blink
blinking: Off
# Vi mode cursor style
#
# If the vi mode cursor style is `None` or not specified, it will fall back to
# the style of the active value of the normal cursor.
#
# See `cursor.style` for available options.
#vi_mode_style: None
# Cursor blinking interval in milliseconds.
#blink_interval: 750
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
#unfocused_hollow: true
# Thickness of the cursor relative to the cell width as floating point number
# from `0.0` to `1.0`.
#thickness: 0.15
# Live config reload (changes require restart)
#live_config_reload: true
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g.
# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the
# shell.
#
# Default:
# - (macOS) /bin/bash --login
# - (Linux/BSD) user login shell
# - (Windows) powershell
#shell:
# program: /bin/bash
# args:
# - --login
# Startup directory
#
# Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used.
#working_directory: None
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true
# Offer IPC using `alacritty msg` (unix only)
#ipc_socket: true
mouse:
# Click settings
#
# The `double_click` and `triple_click` settings control the time
# alacritty should wait for accepting multiple clicks as one double
# or triple click.
double_click: { threshold: 300 }
triple_click: { threshold: 300 }
# If this is `true`, the cursor is temporarily hidden when typing.
hide_when_typing: false
# Regex hints
#
# Terminal hints can be used to find text in the visible part of the terminal
# and pipe it to other applications.
#hints:
# Keys used for the hint labels.
#alphabet: "jfkdls;ahgurieowpq"
# List with all available hints
#
# Each hint must have a `regex` and either an `action` or a `command` field.
# The fields `mouse`, `binding` and `post_processing` are optional.
#
# The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and
# `mouse.mods` accept the same values as they do in the `key_bindings` section.
#
# The `mouse.enabled` field controls if the hint should be underlined while
# the mouse with all `mouse.mods` keys held or the vi mode cursor is above it.
#
# If the `post_processing` field is set to `true`, heuristics will be used to
# shorten the match if there are characters likely not to be part of the hint
# (e.g. a trailing `.`). This is most useful for URIs.
#
# Values for `action`:
# - Copy
# Copy the hint's text to the clipboard.
# - Paste
# Paste the hint's text to the terminal or search.
# - Select
# Select the hint's text.
# - MoveViModeCursor
# Move the vi mode cursor to the beginning of the hint.
#enabled:
# - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\
# [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
# command: xdg-open
# post_processing: true
# mouse:
# enabled: true
# mods: None
# binding:
# key: U
# mods: Control|Shift
# Mouse bindings
#
# Mouse bindings are specified as a list of objects, much like the key
# bindings further below.
#
# To trigger mouse bindings when an application running within Alacritty
# captures the mouse, the `Shift` modifier is automatically added as a
# requirement.
#
# Each mouse binding will specify a:
#
# - `mouse`:
#
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# - `action` (see key bindings for actions not exclusive to mouse mode)
#
# - Mouse exclusive actions:
#
# - ExpandSelection
# Expand the selection to the current mouse cursor location.
#
# And optionally:
#
# - `mods` (see key bindings)
#mouse_bindings:
# - { mouse: Right, action: ExpandSelection }
# - { mouse: Right, mods: Control, action: ExpandSelection }
# - { mouse: Middle, mode: ~Vi, action: PasteSelection }
# Key bindings
#
# Key bindings are specified as a list of objects. For example, this is the
# default paste binding:
#
# `- { key: V, mods: Control|Shift, action: Paste }`
#
# Each key binding will specify a:
#
# - `key`: Identifier of the key pressed
#
# - A-Z
# - F1-F24
# - Key0-Key9
#
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
#
# Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a
# decimal number. This command will allow you to display the hex scancodes
# for certain keys:
#
# `showkey --scancodes`.
#
# Then exactly one of:
#
# - `chars`: Send a byte sequence to the running application
#
# The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences. To find escape codes for bindings
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
# of tmux. Note that applications use terminfo to map escape sequences back
# to keys. It is therefore required to update the terminfo when changing an
# escape sequence.
#
# - `action`: Execute a predefined action
#
# - ToggleViMode
# - SearchForward
# Start searching toward the right of the search origin.
# - SearchBackward
# Start searching toward the left of the search origin.
# - Copy
# - Paste
# - IncreaseFontSize
# - DecreaseFontSize
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
# - ScrollHalfPageUp
# - ScrollHalfPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
# Remove the terminal's scrollback history.
# - Hide
# Hide the Alacritty window.
# - Minimize
# Minimize the Alacritty window.
# - Quit
# Quit Alacritty.
# - ToggleFullscreen
# - SpawnNewInstance
# Spawn a new instance of Alacritty.
# - CreateNewWindow
# Create a new Alacritty window from the current process.
# - ClearLogNotice
# Clear Alacritty's UI warning and error notice.
# - ClearSelection
# Remove the active selection.
# - ReceiveChar
# - None
#
# - Vi mode exclusive actions:
#
# - Open
# Perform the action of the first matching hint under the vi mode cursor
# with `mouse.enabled` set to `true`.
# - ToggleNormalSelection
# - ToggleLineSelection
# - ToggleBlockSelection
# - ToggleSemanticSelection
# Toggle semantic selection based on `selection.semantic_escape_chars`.
#
# - Vi mode exclusive cursor motion actions:
#
# - Up
# One line up.
# - Down
# One line down.
# - Left
# One character left.
# - Right
# One character right.
# - First
# First column, or beginning of the line when already at the first column.
# - Last
# Last column, or beginning of the line when already at the last column.
# - FirstOccupied
# First non-empty cell in this terminal row, or first non-empty cell of
# the line when already at the first cell of the row.
# - High
# Top of the screen.
# - Middle
# Center of the screen.
# - Low
# Bottom of the screen.
# - SemanticLeft
# Start of the previous semantically separated word.
# - SemanticRight
# Start of the next semantically separated word.
# - SemanticLeftEnd
# End of the previous semantically separated word.
# - SemanticRightEnd
# End of the next semantically separated word.
# - WordLeft
# Start of the previous whitespace separated word.
# - WordRight
# Start of the next whitespace separated word.
# - WordLeftEnd
# End of the previous whitespace separated word.
# - WordRightEnd
# End of the next whitespace separated word.
# - Bracket
# Character matching the bracket at the cursor's location.
# - SearchNext
# Beginning of the next match.
# - SearchPrevious
# Beginning of the previous match.
# - SearchStart
# Start of the match to the left of the vi mode cursor.
# - SearchEnd
# End of the match to the right of the vi mode cursor.
#
# - Search mode exclusive actions:
# - SearchFocusNext
# Move the focus to the next search match.
# - SearchFocusPrevious
# Move the focus to the previous search match.
# - SearchConfirm
# - SearchCancel
# - SearchClear
# Reset the search regex.
# - SearchDeleteWord
# Delete the last word in the search regex.
# - SearchHistoryPrevious
# Go to the previous regex in the search history.
# - SearchHistoryNext
# Go to the next regex in the search history.
#
# - macOS exclusive actions:
# - ToggleSimpleFullscreen
# Enter fullscreen without occupying another space.
#
# - Linux/BSD exclusive actions:
#
# - CopySelection
# Copy from the selection buffer.
# - PasteSelection
# Paste from the selection buffer.
#
# - `command`: Fork and execute a specified command plus arguments
#
# The `command` field must be a map containing a `program` string and an
# `args` array of command line parameter strings. For example:
# `{ program: "alacritty", args: ["-e", "vttest"] }`
#
# And optionally:
#
# - `mods`: Key modifiers to filter binding actions
#
# - Command
# - Control
# - Option
# - Super
# - Shift
# - Alt
#
# Multiple `mods` can be combined using `|` like this:
# `mods: Control|Shift`.
# Whitespace and capitalization are relevant and must match the example.
#
# - `mode`: Indicate a binding for only specific terminal reported modes
#
# This is mainly used to send applications the correct escape sequences
# when in different modes.
#
# - AppCursor
# - AppKeypad
# - Search
# - Alt
# - Vi
#
# A `~` operator can be used before a mode to apply the binding whenever
# the mode is *not* active, e.g. `~Alt`.
#
# Bindings are always filled by default, but will be replaced when a new
# binding with the same triggers is defined. To unset a default binding, it can
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
# a no-op if you do not wish to receive input characters for that binding.
#
# If the same trigger is assigned to multiple actions, all of them are executed
# in the order they were defined in.
#key_bindings:
#- { key: Paste, action: Paste }
#- { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, }
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, }
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
#- { key: Y, mode: Vi|~Search, action: Copy }
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
#- { key: Return, mode: Vi|~Search, action: Open }
#- { key: K, mode: Vi|~Search, action: Up }
#- { key: J, mode: Vi|~Search, action: Down }
#- { key: H, mode: Vi|~Search, action: Left }
#- { key: L, mode: Vi|~Search, action: Right }
#- { key: Up, mode: Vi|~Search, action: Up }
#- { key: Down, mode: Vi|~Search, action: Down }
#- { key: Left, mode: Vi|~Search, action: Left }
#- { key: Right, mode: Vi|~Search, action: Right }
#- { key: Key0, mode: Vi|~Search, action: First }
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
#- { key: W, mode: Vi|~Search, action: SemanticRight }
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
#- { key: N, mode: Vi|~Search, action: SearchNext }
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
#- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward }
#- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Plus, mods: Control, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Control, action: IncreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
# (Windows only)
#- { key: Return, mods: Alt, action: ToggleFullscreen }
# (macOS only)
#- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory }
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Plus, mods: Command, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection }
#- { key: H, mods: Command, action: Hide }
#- { key: H, mods: Command|Alt, action: HideOtherApplications }
#- { key: M, mods: Command, action: Minimize }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: N, mods: Command, action: SpawnNewInstance }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
#debug:
# Display the time it takes to redraw each frame.
#render_timer: false
# Keep the log file after quitting Alacritty.
#persistent_logging: false
# Log level
#
# Values for `log_level`:
# - Off
# - Error
# - Warn
# - Info
# - Debug
# - Trace
#log_level: Warn
# Print all received window events.
#print_events: false

96
config/aria2/aria2.conf Normal file
View File

@ -0,0 +1,96 @@
## `#`开头为注释内容, 选项都有相应的注释说明, 根据需要修改 ##
## 被注释的选项填写的是默认值, 建议在需要修改时再取消注释 ##
## 如果出现`Initializing EpollEventPoll failed.`之类的
## 错误提示, 可以取消event-poll选项的注释 ##
## 文件保存相关 ##
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
dir="~/Downloads"
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
disk-cache=32M
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
# 预分配所需时间: none < falloc ? trunc < prealloc
# falloc和trunc则需要文件系统和内核支持, NTFS建议使用falloc, EXT3/4建议trunc
file-allocation=falloc
# 断点续传
continue=true
## 下载连接相关 ##
# 最大同时下载任务数, 运行时可修改, 默认:5
max-concurrent-downloads=1
# 同一服务器连接数, 添加时可指定, 默认:1
max-connection-per-server=5
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载
min-split-size=10M
# 单个任务最大线程数, 添加时可指定, 默认:5
split=5
# 整体下载速度限制, 运行时可修改, 默认:0
# max-overall-download-limit=0
# 单个任务下载速度限制, 默认:0
# max-download-limit=0
# 整体上传速度限制, 运行时可修改, 默认:0
# max-overall-upload-limit=0
# 单个任务上传速度限制, 默认:0
# max-upload-limit=0
# 禁用IPv6, 默认:false
disable-ipv6=false
## 进度保存相关 ##
# 从会话文件中读取下载任务
input-file=aria2.session
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
save-session=aria2.session
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
save-session-interval=60
## RPC相关设置 ##
# 启用RPC, 默认:false
enable-rpc=true
# 允许所有来源, 默认:false
rpc-allow-origin-all=true
# 允许非外部访问, 默认:false
rpc-listen-all=true
# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同
# event-poll=select
# RPC监听端口, 端口被占用时可以修改, 默认:6800
# rpc-listen-port=6800
## BT/PT下载相关 ##
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
# follow-torrent=true
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
# listen-port=51413
# 单个种子最大连接数, 默认:55
# bt-max-peers=55
# 打开DHT功能, PT需要禁用, 默认:true
enable-dht=false
# 打开IPv6 DHT功能, PT需要禁用
# enable-dht6=false
# DHT网络监听端口, 默认:6881-6999
# dht-listen-port=6881-6999
# 本地节点查找, PT需要禁用, 默认:false
# bt-enable-lpd=false
# 种子交换, PT需要禁用, 默认:true
enable-peer-exchange=false
# 每个种子限速, 对少种的PT很有用, 默认:50K
# bt-request-peer-speed-limit=50K
# 客户端伪装, PT需要
peer-id-prefix=-TR2770-
user-agent=Transmission/2.77
# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0
seed-ratio=0
# 强制保存会话, 话即使任务已经完成, 默认:false
# 较新的版本开启后会在任务完成后依然保留.aria2文件
# force-save=false
# BT校验相关, 默认:true
# bt-hash-check-seed=true
# 继续之前的BT任务时, 无需再次校验, 默认:false
bt-seed-unverified=true
# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false
bt-save-metadata=true

5
config/aria2/aria2.md Normal file
View File

@ -0,0 +1,5 @@
# aria2 usage
1. Modify download path;
2. Copy aria2/aria2.conf to download path;
3. Use `aria2c --conf-path=$path $url` to download files;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,63 @@
{
"backgrounds": [{
"id": "f9557eb3-0562-4e68-a342-5bc0b1d898c0",
"key": "background/unsplash",
"active": true,
"display": {
"luminosity": 0,
"blur": 0
}
}],
"widgets": [{
"id": "500aa99d-b545-43da-b2a8-15207e16f1d1",
"key": "widget/time",
"active": true,
"display": {
"position": "middleCentre"
}
}, {
"id": "fbaadb83-bd3f-44df-9e19-218619f63ee7",
"key": "widget/search",
"active": true,
"display": {
"position": "middleCentre",
"fontSize": 38
}
}],
"data": {
"bc5e264c-6377-47c8-b26f-d966227c72c0": {
"expand": false,
"nsfw": false,
"tag": "pattern"
},
"bd54b819-160e-4974-85a2-00910953dc3d": {
"by": "official",
"collections": "",
"featured": false,
"search": "",
"timeout": 86400
},
"f9557eb3-0562-4e68-a342-5bc0b1d898c0": {
"by": "official",
"collections": "",
"featured": false,
"search": "",
"timeout": 86400
},
"500aa99d-b545-43da-b2a8-15207e16f1d1": {
"mode": "digital",
"hour12": false,
"showDate": false,
"showMinutes": true,
"showSeconds": true,
"showDayPeriod": true,
"timeZone": "Asia/Shanghai"
}
},
"locale": "en",
"timeZone": "Asia/Shanghai",
"_persist": {
"version": -1,
"rehydrated": true
}
}

View File

@ -0,0 +1,235 @@
{
"keymaps": {
"0": {
"type": "scroll.home"
},
":": {
"type": "command.show"
},
"o": {
"type": "command.show.open",
"alter": false
},
"O": {
"type": "command.show.open",
"alter": true
},
"t": {
"type": "command.show.tabopen",
"alter": false
},
"T": {
"type": "command.show.tabopen",
"alter": true
},
"w": {
"type": "command.show.winopen",
"alter": false
},
"W": {
"type": "command.show.winopen",
"alter": true
},
"b": {
"type": "command.show.buffer"
},
"a": {
"type": "command.show.addbookmark",
"alter": true
},
"k": {
"type": "scroll.vertically",
"count": -1
},
"j": {
"type": "scroll.vertically",
"count": 1
},
"h": {
"type": "scroll.horizonally",
"count": -1
},
"l": {
"type": "scroll.horizonally",
"count": 1
},
"<C-U>": {
"type": "scroll.pages",
"count": -0.5
},
"<C-D>": {
"type": "scroll.pages",
"count": 0.5
},
"<C-B>": {
"type": "scroll.pages",
"count": -1
},
"<C-F>": {
"type": "scroll.pages",
"count": 1
},
"gg": {
"type": "scroll.top"
},
"G": {
"type": "scroll.bottom"
},
"$": {
"type": "scroll.end"
},
"d": {
"type": "tabs.close",
"select": "right"
},
"D": {
"type": "tabs.close",
"select": "left"
},
"x$": {
"type": "tabs.close.right"
},
"!d": {
"type": "tabs.close.force"
},
"u": {
"type": "tabs.reopen"
},
"K": {
"type": "tabs.prev"
},
"J": {
"type": "tabs.next"
},
"gT": {
"type": "tabs.prev"
},
"gt": {
"type": "tabs.next"
},
"g0": {
"type": "tabs.first"
},
"g$": {
"type": "tabs.last"
},
"<C-6>": {
"type": "tabs.prevsel"
},
"r": {
"type": "tabs.reload",
"cache": false
},
"R": {
"type": "tabs.reload",
"cache": true
},
"zp": {
"type": "tabs.pin.toggle"
},
"zd": {
"type": "tabs.duplicate"
},
"zi": {
"type": "zoom.in"
},
"zo": {
"type": "zoom.out"
},
"zz": {
"type": "zoom.neutral"
},
"f": {
"type": "follow.start",
"newTab": false,
"background": true
},
"F": {
"type": "follow.start",
"newTab": true,
"background": false
},
"m": {
"type": "mark.set.prefix"
},
"'": {
"type": "mark.jump.prefix"
},
"H": {
"type": "navigate.history.prev"
},
"L": {
"type": "navigate.history.next"
},
"[[": {
"type": "navigate.link.prev"
},
"]]": {
"type": "navigate.link.next"
},
"gu": {
"type": "navigate.parent"
},
"gU": {
"type": "navigate.root"
},
"gi": {
"type": "focus.input"
},
"gf": {
"type": "page.source"
},
"gh": {
"type": "page.home",
"newTab": false
},
"gH": {
"type": "page.home",
"newTab": true
},
"y": {
"type": "urls.yank"
},
"p": {
"type": "urls.paste",
"newTab": false
},
"P": {
"type": "urls.paste",
"newTab": true
},
"/": {
"type": "find.start"
},
"n": {
"type": "find.next"
},
"N": {
"type": "find.prev"
},
".": {
"type": "repeat.last"
},
"<S-Esc>": {
"type": "addon.toggle.enabled"
}
},
"search": {
"default": "google",
"engines": {
"google": "https://google.com/search?q={}",
"yahoo": "https://search.yahoo.com/search?p={}",
"bing": "https://www.bing.com/search?q={}",
"duckduckgo": "https://duckduckgo.com/?q={}",
"twitter": "https://twitter.com/search?q={}",
"wikipedia": "https://en.wikipedia.org/w/index.php?search={}"
}
},
"properties": {
"hintchars": "abcdefghijklmnopqrstuvwxyz",
"smoothscroll": false,
"complete": "sbh",
"colorscheme": "system"
},
"blacklist": []
}

View File

@ -0,0 +1,101 @@
{
"name": "Vimium C",
"@time": "2022/6/14 20:36:57",
"time": 1655210217471,
"environment": {
"extension": "1.98.2",
"platform": "win",
"firefox": 101
},
"exclusionRules": [
{
"pattern": ":https://mail.google.com/",
"passKeys": ""
}
],
"ignoreKeyboardLayout": 1,
"keyMappings": [
"#!no-check",
"map b Vomnibar.activateBookmarksInNewTab",
"map B Vomnibar.activateBookmarks",
"map ct captureTab",
"map d removeTab",
"map D closeTabsOnRight",
"map f LinkHints.activateOpenInNewTab",
"map F LinkHints.activate",
"map <c-d> scrollPageDown",
"map <c-u> scrollPageUp",
"map o Vomnibar.activateInNewTab",
"map O Vomnibar.activate",
"map p openCopiedUrlInNewTab",
"map P openCopiedUrlInCurrentTab",
"map r reload",
"map sc sortTabs createTime",
"map sr sortTabs recency",
"map u restoreTab",
"map yf copyWindowInfo",
"map yt copyCurrentTitle",
"map yy copyCurrentUrl",
"map zd duplicateTab",
"map zp togglePinTab",
"map zi zoomIn",
"map zo zoomOut",
"map zz zoomReset"
],
"linkHintCharacters": "abcdefghijklmnopqrstuvwxyz",
"searchEngines": [
"ba|baidu|Baidu|百度: https://www.baidu.com/s?ie=utf-8&wd=%s \\",
" blank=https://www.baidu.com/ 百度",
"b|bi: https://www.bing.com/search?q=$s",
"b|bi|bing|Bing|必应: https://cn.bing.com/search?q=%s \\",
" blank=https://cn.bing.com/ 必应",
"g|go|gg|google|Google|谷歌: https://www.google.com/search?q=%s\\",
" www.google.com re=/^(?:\\.[a-z]{2,4})?\\/search\\b.*?[#&?]q=([^#&]*)/i\\",
" blank=https://www.google.com/ Google",
"br|brave: https://search.brave.com/search?q=%s Brave",
"d|dd|ddg|duckduckgo: https://duckduckgo.com/?q=%s DuckDuckGo",
"ec|ecosia: https://www.ecosia.org/search?q=%s Ecosia",
"qw|qwant: https://www.qwant.com/?q=%s Qwant",
"ya|yd|yandex: https://yandex.com/search/?text=%s Yandex",
"yh|yahoo: https://search.yahoo.com/search?p=%s Yahoo",
"maru|mailru|mail.ru: https://go.mail.ru/search?q=%s Mail.ru",
"",
"b.m|bm|map|b.map|bmap|地图|百度地图: \\",
" https://api.map.baidu.com/geocoder?output=html&address=%s&src=vimium-c\\",
" blank=https://map.baidu.com/",
"gd|gaode|高德地图: https://www.gaode.com/search?query=%s \\",
" blank=https://www.gaode.com",
"g.m|gm|g.map|gmap: https://www.google.com/maps?q=%s \\",
" blank=https://www.google.com/maps 谷歌地图",
"bili|bilibili|bz|Bili: https://search.bilibili.com/all?keyword=%s \\",
" blank=https://www.bilibili.com/ 哔哩哔哩",
"y|yt: https://www.youtube.com/results?search_query=%s \\",
" blank=https://www.youtube.com/ YouTube",
"",
"w|wiki: https://www.wikipedia.org/w/index.php?search=%s Wikipedia",
"b.x|b.xs|bx|bxs|bxueshu: https://xueshu.baidu.com/s?ie=utf-8&wd=%s \\",
" blank=https://xueshu.baidu.com/ 百度学术",
"gs|g.s|gscholar|g.x|gx|gxs: https://scholar.google.com/scholar?q=$s \\",
" scholar.google.com re=/^(?:\\.[a-z]{2,4})?\\/scholar\\b.*?[#&?]q=([^#&]*)/i\\",
" blank=https://scholar.google.com/ 谷歌学术",
"",
"t|tb|taobao|ali|淘宝: https://s.taobao.com/search?ie=utf8&q=%s \\",
" blank=https://www.taobao.com/ 淘宝",
"j|jd|jingdong|京东: https://search.jd.com/Search?enc=utf-8&keyword=%s\\",
" blank=https://jd.com/ 京东",
"az|amazon: https://www.amazon.com/s?k=%s \\",
" blank=https://www.amazon.com/ 亚马逊",
"",
"\\:i: vimium://sed/s/^//,lower\\ $S re= Lower case",
"v.m|math: vimium://math\\ $S re= 计算器",
"v.p: vimium://parse\\ $S re= Redo Search",
"gh|github: https://github.com/search?q=$s \\",
" blank=https://github.com/ GitHub 仓库",
"ge|gitee: https://search.gitee.com/?type=repository&q=$s \\",
" blank=https://gitee.com/ Gitee 仓库",
"js\\:|Js: javascript:\\ $S; JavaScript",
""
],
"searchUrl": "https://cn.bing.com/search?q=$s Bing",
"vimSync": false
}

View File

@ -0,0 +1,14 @@
# Linux Cisco client Installation
## Systemd config
place vpnagend.service to `/usr/lib/systemd/system/`
## Replacement
Cisco client can be replaced by `openconnect`. Just install it with pacman(or aur helper) if your linux distribution is based on Archlinux.
```bash
yay -S openconnect
```

View File

@ -0,0 +1,14 @@
[Unit]
Description=Cisco VPN Service
Wants=NetworkManager.service
After=NetworkManager.service
[Service]
Type=forking
ExecStart=/opt/cisco/anyconnect/bin/vpnagentd
PIDFile=/var/run/vpnagentd.pid
ExecReload=/usr/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

12
config/docker/config.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
group=docker
# create group docker if not exists
egrep "^$group" /etc/group >&/dev/null
if [ $? -ne 0 ]; then
groupadd $group
fi
# add user to group docker
sudo usermod -aG ${group} ${USER}

View File

@ -0,0 +1,6 @@
#!/bin/bash
cp -f ~/Projects/notes/config/rime/default.custom.yaml ~/.config/fcitx/rime/
cp -f ~/Projects/notes/config/rime/double_pinyin.custom.yaml ~/.config/fcitx/rime/
cp -f ~/Projects/notes/config/rime/double_pinyin_flypy.schema.yaml ~/.config/fcitx/rime/
cp -rf ~/Projects/notes/config/rime/opencc ~/.config/fcitx/rime/

14
config/fcitx/get-fcitx.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
yay -S fcitx fcitx-gtk2 fcitx-gtk3 fcitx-configtool fcitx-rime
conf_file=$HOME/.xprofile
if [ -f $conf_file ]; then
echo "$conf_file exists! Now it is moved to $HOME/.xprofile_bak"
mv $conf_file $HOME/.xprofile_bak
fi
echo 'export GTK_IM_MODULE=fcitx' >>$conf_file
echo 'export QT_IM_MODULE=fcitx' >>$conf_file
echo 'export XMODIFIERS=@im=fcitx' >>$conf_file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
# Vertical Candidate List
Vertical Candidate List=False
# Use Per Screen DPI
PerScreenDPI=False
# Use mouse wheel to go to prev or next page
WheelForPaging=True
# Font
Font="Source Han Sans CN 13"
# Menu Font
MenuFont="Source Han Sans CN 10"
# Use input method langauge to display text
UseInputMethodLangaugeToDisplayText=True
# Available Themes
#
# Material-Color-Pink
# Material-Color-Blue
# Material-Color-Brown
# Material-Color-DeepPurple
# Material-Color-Indigo
# Material-Color-Red
# Material-Color-Teal
# Material-Color-Black
# Material-Color-Orange
# Material-Color-SakuraPink
# Theme
Theme=Material-Color-Black

View File

@ -0,0 +1,3 @@
[HiddenNotifications]
0=fcitx-rime-deploy

View File

@ -0,0 +1,12 @@
# Show preedit within application
# 单行模式
PreeditInApplication=True
# Commit current text when deactivating
Commit when deactivate=True
# Load available plugins automatically
AutoloadPlugins=True
# Plugins
Plugins=
# Modules
Modules=

69
config/fcitx5/config Normal file
View File

@ -0,0 +1,69 @@
[Hotkey]
# Enumerate when press trigger key repeatedly
EnumerateWithTriggerKeys=True
# Skip first input method while enumerating
EnumerateSkipFirst=False
[Hotkey/TriggerKeys]
0=Multi_key
[Hotkey/AltTriggerKeys]
0=Shift_L
[Hotkey/EnumerateForwardKeys]
0=Control+Shift_L
[Hotkey/EnumerateBackwardKeys]
0=Control+Shift_R
[Hotkey/EnumerateGroupForwardKeys]
0=Super+space
[Hotkey/EnumerateGroupBackwardKeys]
0=Shift+Super+space
[Hotkey/ActivateKeys]
0=Multi_key
[Hotkey/DeactivateKeys]
0=Multi_key
[Hotkey/PrevPage]
0=Up
[Hotkey/NextPage]
0=Down
[Hotkey/PrevCandidate]
0=Shift+Tab
[Hotkey/NextCandidate]
0=Tab
[Hotkey/TogglePreedit]
0=Control+Alt+P
[Behavior]
# Active By Default
ActiveByDefault=False
# Share Input State
ShareInputState=No
# Show preedit in application
PreeditEnabledByDefault=True
# Show Input Method Information when switch input method
ShowInputMethodInformation=True
# Show Input Method Information when changing focus
showInputMethodInformationWhenFocusIn=False
# Show compact input method information
CompactInputMethodInformation=True
# Show first input method information
ShowFirstInputMethodInformation=True
# Default page size
DefaultPageSize=9
# Force Enabled Addons
EnabledAddons=
# Force Disabled Addons
DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True

23
config/fcitx5/profile Normal file
View File

@ -0,0 +1,23 @@
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=rime
[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=
[Groups/0/Items/1]
# Name
Name=rime
# Layout
Layout=
[GroupOrder]
0=Default

View File

@ -0,0 +1,58 @@
Sub:
Body:
==== End ====
# ## Help ##
#
# Subject line imperative uppercase verbs:
#
# Add = Create a capability e.g. feature, test, dependency.
# Drop = Delete a capability e.g. feature, test, dependency.
# Fix = Fix an issue e.g. bug, typo, accident, misstatement.
# Bump = Increase the version of something e.g. a dependency.
# Make = Change the build process, or tools, or infrastructure.
# Start = Begin doing something; e.g. enable a toggle, feature flag, etc.
# Stop = End doing something; e.g. disable a toggle, feature flag, etc.
# Optimize = A change that MUST be just about performance, e.g. speed up code.
# Document = A change that MUST be only in the documentation, e.g. help files.
# Refactor = A change that MUST be just refactoring.
# Reformat = A change that MUST be just format, e.g. indent line, trim space, etc.
# Rephrase = A change that MUST be just textual, e.g. edit a comment, doc, etc.
#
# For the subject line:
# * Use 50 characters maximum.
# * Do not use a sentence-ending period.
#
# For the body text:
# * Use as many lines as you like.
# * Use 72 characters maximum per line for typical word wrap text.
#
#
# ## About ##
#
# This is our team's starting point for our git commit messages.
# You can edit this template as you like, to customize it.
#
# For more information about git commit ideas and help:
# https://github.com/joelparkerhenderson/git_commit_message
#
#
# ## Usage ##
#
# Put the template file here:
#
# ~/.git_commit_template.txt
#
# Configure git to use the template file by running:
#
# git config --global commit.template ~/.git_commit_template.txt
#
# Or add the template file to the ~/.gitconfig file:
#
# [commit]
# template = ~/.git_commit_template.txt
#
# If you prefer other file locations or ways of working,
# you can freely adjust the usage as you like.

View File

@ -0,0 +1,54 @@
[user]
email = astroshot@outlook.com
name = Shockwave
[commit]
template = ~/.config/git/commit-template.txt
[pull]
rebase = true
# my vim is a soft link of nvim
[core]
editor = nvim
# pager = delta
[diff]
tool = nvimdiff
[difftool "nvimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c "$wincmd w" -c "wincmd J"
# merge UI in vim will be like:
# +-------------------------------------+
# | | | |
# | LOCAL | BASE | REMOTE |
# | | | |
# +-------------------------------------+
# | |
# | |
# | MERGED |
# | |
# | |
# +-------------------------------------+
[merge]
tool = nvimdiff
[mergetool]
cmd = nvim -d $LOCAL $BASE $REMOTE $MERGED -c "$wincmd w" -c "$wincmd J"
keepBackup = false
# Don't use pager when type `git branch`
[pager]
branch = false
# [interactive]
# diffFilter = delta --color-only
# [delta]
# features = side-by-side line-numbers decorations
# whitespace-error-style = 22 reverse
# plus-style = "syntax #012800"
# minus-style = "syntax #340001"
# syntax-theme = Monokai Extended
# navigate = true
# linenumbers = true
# [delta "decorations"]
# commit-decoration-style = bold yellow box ul
# file-style = bold yellow ul
# file-decoration-style = none

View File

@ -0,0 +1,25 @@
# Configuration file for the delve debugger.
# This is the default configuration file. Available options are provided, but disabled.
# Delete the leading hash mark to enable an item.
# Provided aliases will be added to the default aliases for a given command.
aliases:
# command: ["alias1", "alias2"]
# Define sources path substitution rules. Can be used to rewrite a source path stored
# in program's debug information, if the sources were moved to a different place
# between compilation and debugging.
# Note that substitution rules will not be used for paths passed to "break" and "trace"
# commands.
substitute-path:
# - {from: path, to: path}
# Maximum number of elements loaded from an array.
# max-array-values: 64
# Maximum loaded string length.
max-string-len: 99999
# Uncomment the following line to make the whatis command also print the DWARF location expression of its argument.
# show-location-expr: true

View File

@ -0,0 +1,31 @@
#!/bin/bash
mkdir -p $GOPATH/src/golang.org/x
git clone https://github.com/golang/tools.git $GOPATH/src/golang.org/x/tools
git clone https://github.com/golang/lint.git $GOPATH/src/golang.org/x/lint
git clone https://github.com/golang/net.git $GOPATH/src/golang.org/x/net
git clone https://github.com/golang/sys.git $GOPATH/src/golang.org/x/sys
go get github.com/nsf/gocode
go get github.com/stamblerre/gocode
go get github.com/uudashr/gopkgs/cmd/gopkgs
go get github.com/ramya-rao-a/go-outline
go get github.com/acroca/go-symbols
go get github.com/fatih/gomodifytags
go get github.com/haya14busa/goplay/cmd/goplay
go get github.com/josharian/impl
go get github.com/davidrjenni/reftools/cmd/fillstruct
go get github.com/rogpeppe/godef
go get golang.org/x/tools/cmd/godoc
go get github.com/sqs/goreturns
go get github.com/golang/lint/golint
go get github.com/kisielk/errcheck
go get github.com/klauspost/asmfmt/cmd/asmfmt
go get github.com/alecthomas/gometalinter
go get honnef.co/go/tools/cmd/keyify
go get github.com/cweill/gotests/...
go get golang.org/x/tools/cmd/guru
go get golang.org/x/tools/cmd/gorename
go get golang.org/x/tools/cmd/goimports
go get golang.org/x/tools/cmd/gopls
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

36
config/i3/Install.md Normal file
View File

@ -0,0 +1,36 @@
# Install i3
## Packages
```bash
sudo pacman -S i3-gaps xorg-servier xorg-init xorg-xrandr
```
## Fonts
```bash
sudo pacman -S wqy-microhei
```
## Polybar
```bash
yay -S nerd-fonts-meslo polybar bspwm xbacklight pulseaudio wlan battery temperature
```
## Adjust resolution
Input `cvt 1920 1080` and returns
```bash
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
```
Then
```bash
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode Virtual-1 1920x1080
xrandr --output Virtual-1 --mode 1920x1080
```

247
config/i3/config Normal file
View File

@ -0,0 +1,247 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
# bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
bindsym $mod+d exec rofi -show drun
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# bar {
# status_command i3status
# font pango: MesloLGLDZ Nerd Font 12
# }
# remove i3 title
new_window none
new_float normal
hide_edge_borders both
# polybar config
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
# -----------------------------------------------------------------------------
# i3-gaps
# -----------------------------------------------------------------------------
gaps inner 6
gaps outer 0
smart_gaps on
smart_borders on
set $mode_gaps gaps
set $mode_gaps_outer outer gaps
set $mode_gaps_inner inner gaps
bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym 0 mode "default", exec --no-startup-id i3-msg "gaps inner current set 0" && i3-msg "gaps outer current set 0"
bindsym d mode "default", exec --no-startup-id i3-msg "gaps inner current set $default_gaps_inner" && i3-msg "gaps outer current set $default_gaps_outer"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 mode "default", gaps inner current set 0
bindsym d mode "default", gaps inner current set $default_gaps_inner
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 mode "default", gaps inner all set 0
bindsym Shift+d mode "default", gaps inner all set $default_gaps_inner
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 mode "default", gaps outer current set 0
bindsym d mode "default", gaps outer current set $default_gaps_outer
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 mode "default", gaps outer all set 0
bindsym Shift+d mode "default", gaps outer all set $default_gaps_outer
bindsym Return mode "default"
bindsym Escape mode "default"
}

9
config/i3/config.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# adjust resolution
set -x
xrandr --newmode "1920x1080" $(cvt 1920 1080 | sed '1d' | sed 's/Modeline "1920x1080_60.00"//')
xrandr --addmode Virtual-1 1920x1080
xrandr --output Virtual-1 --mode 1920x1080

29
config/ide/create-idea.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
set -x
bin_file=/opt/idea/bin/idea.sh
echo '' >>$bin_file
echo '# chinese input settings' >>$bin_file
echo 'export GTK_IM_MODULE=fcitx' >>$bin_file
echo 'export QT_IM_MODULE=fcitx' >>$bin_file
echo 'export XMODIFIERS=@im=fcitx' >>$bin_file
if [[ ! -d ~/.local/share/applications ]]; then
mkdir -p ~/.local/share/applications
fi
if [[ ! -f ~/.local/share/applications/idea.desktop ]]; then
touch ~/.local/share/applications/idea.desktop
fi
cat >~/.local/share/applications/idea.desktop <<EOF
[Desktop Entry]
Type=Application
Name=IntelliJ IDEA Community Edition
Icon=/opt/idea/bin/idea.svg
Exec="/opt/idea/bin/idea.sh" %f
Comment=Capable and Ergonomic IDE for JVM
Terminal=false
Categories=Development;IDE;
Encoding=UTF-8
EOF

14
config/ide/create-postman.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -x
cat >~/.local/share/applications/postman.desktop <<EOF
[Desktop Entry]
Type=Application
Name=Postman
Exec="/opt/postman/Postman" %f
Icon=postman
Comment=Rest Client
Terminal=false
Categories=Development;IDE;
Encoding=UTF-8
EOF

30
config/ide/create-pycharm.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -x
bin_file=/opt/pycharm/bin/pycharm.sh
echo '' >>$bin_file
echo '# chinese input settings' >>$bin_file
echo 'export GTK_IM_MODULE=fcitx' >>$bin_file
echo 'export QT_IM_MODULE=fcitx' >>$bin_file
echo 'export XMODIFIERS=@im=fcitx' >>$bin_file
if [[ ! -d ~/.local/share/applications ]]; then
mkdir -p ~/.local/share/applications
fi
if [[ ! -f ~/.local/share/applications/pycharm.desktop ]]; then
touch ~/.local/share/applications/pycharm.desktop
fi
cat >~/.local/share/applications/pycharm.desktop <<EOF
[Desktop Entry]
Type=Application
Name=Pycharm
Icon=/opt/pycharm/bin/pycharm.svg
Exec="/opt/pycharm/bin/pycharm.sh" %f
Terminal=false
Comment=Python IDE for Professional Developers
Categories=Development;IDE;
Encoding=UTF-8
EOF

23
config/ide/idea.vmoptions Normal file
View File

@ -0,0 +1,23 @@
-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=512m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA Community Edition
Icon=/usr/share/idea/bin/idea.png
Exec="/usr/share/idea/bin/idea.sh" %f
Comment=Capable and Ergonomic IDE for JVM
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea-ce

15
config/ide/pycharm.md Normal file
View File

@ -0,0 +1,15 @@
# Install pycharm
```bash
sudo ln -s /opt/pycharm/bin/pycharm.sh /usr/bin/pycharm
cat > ~/.local/share/applications/pycharm.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=pycharm
Exec=pycharm
Icon=/opt/pycharm/bin/pycharm.png
Terminal=false
Type=Application
Categories=Development;
EOL
```

View File

@ -0,0 +1,19 @@
-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=512m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:ErrorFile=$USER_HOME/java_error_in_pycharm_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_pycharm.hprof

View File

@ -0,0 +1,39 @@
[Appearance]
BoldIntense=true
ColorScheme=Solarized Dark
Font=Hack,11,-1,5,50,0,0,0,0,0
LineSpacing=0
TabColor=24,25,29,0
UseFontLineChararacters=true
[General]
Command=/bin/zsh
DimWhenInactive=false
Environment=TERM=xterm-256color,COLORTERM=truecolor
InvertSelectionColors=true
LocalTabTitleFormat=[%#]%d : %n
Name=Ezio
Parent=FALLBACK/
RemoteTabTitleFormat=%u@%H
TerminalCenter=true
TerminalColumns=120
TerminalMargin=1
TerminalRows=30
[Interaction Options]
AutoCopySelectedText=true
CopyTextAsHTML=false
MouseWheelZoomEnabled=false
TrimLeadingSpacesInSelectedText=true
TrimTrailingSpacesInSelectedText=true
[Keyboard]
KeyBindings=default
[Scrolling]
ScrollBarPosition=1
[Terminal Features]
UrlHintsModifiers=67108864
VerticalLine=false
VerticalLineAtChar=98

View File

@ -0,0 +1,99 @@
[Background]
Color=0,43,54
[BackgroundFaint]
Color=0,43,54
[BackgroundIntense]
Color=7,54,66
[Color0]
Color=7,54,66
[Color0Faint]
Color=6,48,59
[Color0Intense]
Color=131,148,150
[Color1]
Color=220,50,47
[Color1Faint]
Color=147,33,31
[Color1Intense]
Color=203,75,22
[Color2]
Color=133,153,0
[Color2Faint]
Color=94,106,0
[Color2Intense]
Color=85,170,0
[Color3]
Color=181,137,0
[Color3Faint]
Color=138,103,0
[Color3Intense]
Color=170,170,0
[Color4]
Color=38,139,210
[Color4Faint]
Color=20,77,115
[Color4Intense]
Color=85,170,255
[Color5]
Color=211,54,130
[Color5Faint]
Color=120,30,75
[Color5Intense]
Color=108,113,196
[Color6]
Color=42,161,152
[Color6Faint]
Color=24,94,88
[Color6Intense]
Color=0,170,127
[Color7]
Color=238,232,213
[Color7Faint]
Color=171,167,154
[Color7Intense]
Color=253,246,227
[Foreground]
Color=131,148,150
[ForegroundFaint]
Color=106,119,121
[ForegroundIntense]
Color=147,161,161
[General]
Anchor=0.5,0.5
Blur=true
ColorRandomization=false
Description=Solarized Dark
FillStyle=Tile
Opacity=0.85
Wallpaper=
WallpaperOpacity=1

View File

@ -0,0 +1,100 @@
keyboard "Default (XFree 4)"
key Space+Ctrl : "\x00"
key F2+AnyModifier : "\EO*Q"
key F2-AnyModifier : "\EOQ"
key F1+AnyModifier : "\EO*P"
key F1-AnyModifier : "\EOP"
key F4+AnyModifier : "\EO*S"
key F4-AnyModifier : "\EOS"
key F3+AnyModifier : "\EO*R"
key F3-AnyModifier : "\EOR"
key F6+AnyModifier : "\E[17;*~"
key F6-AnyModifier : "\E[17~"
key F5+AnyModifier : "\E[15;*~"
key F5-AnyModifier : "\E[15~"
key F8+AnyModifier : "\E[19;*~"
key F8-AnyModifier : "\E[19~"
key F7+AnyModifier : "\E[18;*~"
key F7-AnyModifier : "\E[18~"
key F10+AnyModifier : "\E[21;*~"
key F10-AnyModifier : "\E[21~"
key F9+AnyModifier : "\E[20;*~"
key F9-AnyModifier : "\E[20~"
key F12+AnyModifier : "\E[24;*~"
key F12-AnyModifier : "\E[24~"
key F11+AnyModifier : "\E[23;*~"
key F11-AnyModifier : "\E[23~"
key Tab+Ctrl-Ansi : "\t"
key Tab+Ctrl+Ansi : "\E[27;5;9~"
key Tab+Shift-Ansi : "\t"
key Tab+Shift+Ansi : "\E[Z"
key Tab-Shift : "\t"
key Esc : "\E"
key Backspace+Ctrl : "\b"
key Backspace-Ctrl : "\x7f"
key Backtab+Ctrl-Ansi : "\t"
key Backtab+Ctrl+Ansi : "\E[27;6;9~"
key Backtab-Ansi : "\t"
key Backtab+Ansi : "\E[Z"
key Enter-NewLine : "\r"
key Enter+NewLine : "\r\n"
key Return+Shift : "\EOM"
key Return-Shift+NewLine : "\r\n"
key Return-Shift-NewLine : "\r"
key Del+AnyModifier : "\E[3;*~"
key Del-AnyModifier : "\E[3~"
key Del+KeyPad : "\E[3~"
key Ins+AnyModifier : "\E[2;*~"
key Ins-AnyModifier : "\E[2~"
key Ins+KeyPad : "\E[2~"
key Clear+KeyPad : "\E[E"
key End+Shift-AppScreen : ScrollDownToBottom
key End+AnyModifier : "\E[1;*F"
key End+AppCursorKeys-AnyModifier : "\EOF"
key End-AppCursorKeys-AnyModifier : "\E[F"
key End+KeyPad-AppCursorKeys : "\E[F"
key End+KeyPad+AppCursorKeys : "\EOF"
key Home+Shift-AppScreen : ScrollUpToTop
key Home+AnyModifier : "\E[1;*H"
key Home+AppCursorKeys-AnyModifier : "\EOH"
key Home-AppCursorKeys-AnyModifier : "\E[H"
key Home+KeyPad-AppCursorKeys : "\E[H"
key Home+KeyPad+AppCursorKeys : "\EOH"
key Up+Shift-AppScreen : ScrollLineUp
key Up-Shift+KeyPad+Ansi-AppCursorKeys : "\E[A"
key Up-Shift+KeyPad+Ansi+AppCursorKeys : "\EOA"
key Up+Shift+AppScreen : "\E[1;*A"
key Up-Shift+Ansi+AnyModifier : "\E[1;*A"
key Up-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[A"
key Up-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOA"
key Up-Shift-Ansi : "\EA"
key Left-Shift+KeyPad+Ansi-AppCursorKeys : "\E[D"
key Left-Shift+KeyPad+Ansi+AppCursorKeys : "\EOD"
key Left+Shift+AppScreen : "\E[1;*D"
key Left-Shift+Ansi+AnyModifier : "\E[1;*D"
key Left-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[D"
key Left-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOD"
key Left-Shift-Ansi : "\ED"
key Down+Shift-AppScreen : ScrollLineDown
key Down-Shift+KeyPad+Ansi-AppCursorKeys : "\E[B"
key Down-Shift+KeyPad+Ansi+AppCursorKeys : "\EOB"
key Down+Shift+AppScreen : "\E[1;*B"
key Down-Shift+Ansi+AnyModifier : "\E[1;*B"
key Down-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[B"
key Down-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOB"
key Down-Shift-Ansi : "\EB"
key Right-Shift+KeyPad+Ansi-AppCursorKeys : "\E[C"
key Right-Shift+KeyPad+Ansi+AppCursorKeys : "\EOC"
key Right+Shift+AppScreen : "\E[1;*C"
key Right-Shift+Ansi+AnyModifier : "\E[1;*C"
key Right-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[C"
key Right-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOC"
key Right-Shift-Ansi : "\EC"
key PgDown+Shift-AppScreen : ScrollPageDown
key PgDown-Shift+AnyModifier : "\E[6;*~"
key PgDown-Shift-AnyModifier : "\E[6~"
key PgDown-Shift+KeyPad : "\E[6~"
key PgUp+Shift-AppScreen : ScrollPageUp
key PgUp-Shift+AnyModifier : "\E[5;*~"
key PgUp-Shift-AnyModifier : "\E[5~"
key PgUp-Shift+KeyPad : "\E[5~"

11
config/kde/konsole/restore.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -x
$KONSOLE_CONF=$HOME/.local/share/konsole
if [[ -f $KONSOLE_CONF ]]; then
rm -rf $KONSOLE_CONF
fi
cp -rf $HOME/Projects/notes/config/kde/konsole $KONSOLE_CONF

2312
config/kitty/base.conf Normal file

File diff suppressed because it is too large Load Diff

23
config/kitty/config.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -x
BASE_CONF=$HOME/.config/kitty/base.conf
KITTY_CONF=$HOME/.config/kitty/kitty.conf
if [[ -f $BASE_CONF ]]; then
rm -f $BASE_CONF
fi
if [[ -f $KITTY_CONF ]]; then
rm -f $KITTY_CONF
fi
ln -s $HOME/Projects/notes/config/kitty/base.conf $BASE_CONF
if [[ $(uname -s) = "Darwin" ]]; then
ln -s $HOME/Projects/notes/config/kitty/macos.conf $KITTY_CONF
elif [[ $(uname -s) = "Linux" ]]; then
ln -s $HOME/Projects/notes/config/kitty/linux.conf $KITTY_CONF
fi

2294
config/kitty/kitty.conf.bak Normal file

File diff suppressed because it is too large Load Diff

8
config/kitty/linux.conf Normal file
View File

@ -0,0 +1,8 @@
include base.conf
font_family Hack
bold_font Hack Bold
italic_font Hack Italic
bold_italic_font Hack Bold Italic
font_size 11.0

8
config/kitty/macos.conf Normal file
View File

@ -0,0 +1,8 @@
include base.conf
font_family Hack Nerd Font Mono
bold_font Hack Nerd Font Mono Bold
italic_font Hack Nerd Font Mono Italic
bold_italic_font Hack Nerd Font Mono Bold Italic
font_size 14.0

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups />
<proxies />
<servers />
<localRepository>/home/ezio/.m2/repository</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库在中国的镜像 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>

View File

@ -0,0 +1,175 @@
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
# .include /usr/lib/systemd/system/mariadb.service
# ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# https://mariadb.com/kb/en/mariadb/systemd/
#
# Copyright notice:
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=MariaDB 10.9.2 database server
Documentation=man:mariadbd(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
##############################################################################
## Core requirements
##
Type=notify
# Setting this to true can break replication and the Type=notify settings
# See also bind-address mariadbd option.
PrivateNetwork=false
##############################################################################
## Package maintainers
##
User=mysql
Group=mysql
# CAP_IPC_LOCK To allow memlock to be used as non-root user
# CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
# does nothing for non-root, not needed if /etc/shadow is u+r
# CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
CapabilityBoundingSet=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
# PrivateDevices=true implies NoNewPrivileges=true and
# SUID auth_pam_tool suddenly doesn't do setuid anymore
PrivateDevices=false
# Prevent writes to /usr, /boot, and /etc
ProtectSystem=full
# Database dir: '/var/lib/mysql' should be writable even
# ProtectSystem=full prevents it
ReadWritePaths=-/data/mysql
# Doesn't yet work properly with SELinux enabled
# NoNewPrivileges=true
# Prevent accessing /home, /root and /run/user
ProtectHome=true
# Execute pre and post scripts as root, otherwise it does it as User=
PermissionsStartOnly=true
# Perform automatic wsrep recovery. When server is started without wsrep,
# galera_recovery simply returns an empty string. In any case, however,
# the script is not expected to return with a non-zero status.
# It is always safe to unset _WSREP_START_POSITION environment variable.
# Do not panic if galera_recovery script is not available. (MDEV-10538)
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] \
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
# Needed to create system tables etc.
# ExecStartPre=/usr/bin/mysql_install_db -u mysql
# Start main service
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
# Use the [Service] section and Environment="MYSQLD_OPTS=...".
# This isn't a replacement for my.cnf.
# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
ExecStart=/usr/bin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
# Unset _WSREP_START_POSITION environment variable.
ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
KillSignal=SIGTERM
# Don't want to see an automated SIGKILL ever
SendSIGKILL=no
# Restart crashed server only, on-failure would also restart, for example, when
# my.cnf contains unknown option
Restart=on-abort
RestartSec=5s
UMask=007
##############################################################################
## USERs can override
##
##
## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
## and adding/setting the following under [Service] will override this file's
## settings.
# Useful options not previously available in [mysqld_safe]
# Kernels like killing mariadbd when out of memory because its big.
# Lets temper that preference a little.
# OOMScoreAdjust=-600
# Explicitly start with high IO priority
# BlockIOWeight=1000
# If you don't use the /tmp directory for SELECT ... OUTFILE and
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=true
# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
# this is the same value as used in SysV init scripts in the past
# Galera might need a longer timeout, check the KB if you want to change this:
# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
TimeoutStartSec=900
TimeoutStopSec=900
##
## Options previously available to be set via [mysqld_safe]
## that now needs to be set by systemd config files as mysqld_safe
## isn't executed.
##
# Number of files limit. previously [mysqld_safe] open-files-limit
LimitNOFILE=32768
# Maximium core size. previously [mysqld_safe] core-file-size
# LimitCore=
# Nice priority. previously [mysqld_safe] nice
# Nice=-5
# Timezone. previously [mysqld_safe] timezone
# Environment="TZ=UTC"
# Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
# (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
# Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
Environment="LD_PRELOAD=/usr/lib/libjemalloc.so"
# Flush caches. previously [mysqld_safe] flush-caches=1
# ExecStartPre=sync
# ExecStartPre=sysctl -q -w vm.drop_caches=3
# numa-interleave=1 equalivant
# Change ExecStart=numactl --interleave=all /usr/bin/mariadbd......
# crash-script equalivent
# FailureAction=

36
config/mysql/my.cnf Normal file
View File

@ -0,0 +1,36 @@
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#
skip-grant-tables
bind-address = 0.0.0.0
port = 8306
[client]
socket=/var/lib/mysql/mysql.sock

41
config/mysql/my56.cnf Normal file
View File

@ -0,0 +1,41 @@
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = /home/work/.local/mysql
datadir = /data/work/.local/var/lib/mysql
log_bin=mysql-bin
binlog_format=Row
port = 8306
server_id = 1
socket = /data/work/.local/var/run/mysqld/mysql.sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
skip-character-set-client-handshake = true
# skip-grant-tables
[client]
default-character-set=utf8mb4
[mysql]
default-character-set = utf8mb4
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

64
config/mysql/my57-dev.cnf Normal file
View File

@ -0,0 +1,64 @@
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /home/work/.local/mysql-5.7.24
datadir = /data/work/.local/var/lib/mysql57
plugin-dir = /data/work/.local/mysql-5.7.24/lib/plugin
# user = work
log-error = /data/work/.local/var/log/mysql57/mysqld.log
pid-file = /data/work/.local/var/lib/mysql57/your.machine.com.mysql57.pid
port = 3306
socket = /data/work/.local/var/lib/mysql57/mysql.sock
server_id = 1
# disable ssl encryption
skip-ssl
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
# skip-character-set-client-handshake = true
default-storage-engine = InnoDB
# 对于mysql服务器最大连接数值的设置范围比较理想的是服务器响应的最大连接数值占服务器上限连接数值的比例值在10%以上如果在10%以下说明mysql服务器最大连接上限值设置过高。
max_connections = 200
max_user_connections = 100
max_allowed_packet = 256M
[client]
default-character-set=utf8mb4
socket = /data/work/.local/var/lib/mysql57/mysql.sock
[mysql]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
socket = /data/work/.local/var/lib/mysql57/mysql.sock
[mysqld_safe]
socket = /data/work/.local/var/lib/mysql57/mysql.sock
pid-file = /data/work/.local/var/lib/mysql57/your.machine.com.mysql57.pid
default-character-set = utf8mb4
[mysqldump]
# 开启快速导出
quick
default-character-set = utf8mb4
max_allowed_packet = 256M

3
config/mysql/mycli Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
$HOME/.virtualenvs/mycli/bin/mycli $*

189
config/mysql/myclirc Normal file
View File

@ -0,0 +1,189 @@
# vi: ft=dosini
[main]
# Enables context sensitive auto-completion. If this is disabled the all
# possible completions will be listed.
smart_completion = True
# Multi-line mode allows breaking up the sql statements into multiple lines. If
# this is set to True, then the end of the statements must have a semi-colon.
# If this is set to False then sql statements can't be split into multiple
# lines. End of line (return) is considered as the end of the statement.
multi_line = True
# Destructive warning mode will alert you before executing a sql statement
# that may cause harm to the database such as "drop table", "drop database"
# or "shutdown".
destructive_warning = True
# log_file location.
log_file = ~/.cache/mycli/mycli.log
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG". "NONE" disables logging.
log_level = INFO
# Log every query and its results to a file. Enable this by uncommenting the
# line below.
audit_log = ~/.cache/mycli/mycli-audit.log
# Timing of sql statments and table rendering.
timing = True
# Table format. Possible values: ascii, double, github,
# psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html,
# latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv.
# Recommended: ascii
table_format = simple
# Syntax coloring style. Possible values (many support the "-dark" suffix):
# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs,
# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default,
# fruity.
# Screenshots at http://mycli.net/syntax
# Can be further modified in [colors]
syntax_style = monokai
# Keybindings: Possible values: emacs, vi.
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
key_bindings = emacs
# Enabling this option will show the suggestions in a wider menu. Thus more items are suggested.
wider_completion_menu = True
# MySQL prompt
# \D - The full current date
# \d - Database name
# \h - Hostname of the server
# \m - Minutes of the current time
# \n - Newline
# \P - AM/PM
# \p - Port
# \R - The current time, in 24-hour military time (023)
# \r - The current time, standard 12-hour time (112)
# \s - Seconds of the current time
# \t - Product type (Percona, MySQL, MariaDB)
# \A - DSN alias name (from the [alias_dsn] section)
# \u - Username
# \x1b[...m - insert ANSI escape sequence
# prompt = '\x1b[1;33m[\x1b[1;31m\t \x1b[32m\u\x1b[37m@\x1b[34m\h:\x1b[36m\p\x1b[31m/\d\x1b[1;33m] \x1b[35m➜ '
prompt = '\x1b[37m# \x1b[1;33m\t \x1b[32m\u\x1b[37m@\x1b[34m\h\x1b[37m:\x1b[36m\p\x1b[37m/\x1b[31m\d \x1b[35m➜ '
prompt_continuation = ' '
# \x1b[0m 所有属性重设为默认值,通常出现在一串指令的最后
# \x1b[1m 设置粗体,高亮
# \x1b[2m 设置亮度减半(用一种颜色模拟另一种颜色)
# \x1b[4m 设置下划线,下划线的颜色由”\x1b]…“设置
# \x1b[5m 设置闪烁
# \x1b[7m 设置反显,前景色与背景色交换(字体颜色与背景颜色)
# \x1b[8m 隐藏,前景色与背景色同色
# \x1b[9m 设置删除线(示例效果:谁也逃不过王境泽定律
# \x1b[10m 重设选定映像,显示控制标记,反转元素标记
# \x1b[11m 选择空映像,设置显示控制标记,重设反转标记.
# \x1b[12m 选择空映像,设置显示控制标记,重设反转标记.(在完成映像表转换之前反转标记引起每一字节的高位反转.)
# \x1b[21m 设置正常亮度与ECMA-48 不兼容)
# \x1b[22m 设置正常亮度
# \x1b[24m 关闭下划线
# \x1b[25m 关闭闪烁
# \x1b[27m 关闭反显
# \x1b[28m 关闭影藏
# \x1b[29m 关闭删除线
# \x1b[30-37m 30黑色前景31红色前景32绿色前景33棕色前景34蓝色前景35品红前景36孔雀蓝前景37白色前景
# \x1b[38m 设置RGB前景色
# \x1b[39m 设置默认前景色
# \x1b[40-47m 40:黑色背景41红色背景42绿色背景43棕色背景44蓝色背景45品红背景46孔雀蓝背景47白色背景
# \x1b[48m 设置RGB背景色
# \x1b[53m 设置上划线
# \x1b[55m 关闭上划线
# \x1b[90-97m 设置前景色颜色同30-37亮度提升
# \x1b[100-107m 设置背景色颜色同41-47亮度提升
#
# SGR指令能够在一条指令中添加多个属性例如\x1b[5;9;30;41m 即为设置闪烁,下划线,黑色字体红色背景。
# 在Xterm KDE 的konsole以及支持libvte的终端上支持如下指令
# \x1b[38;2;r;g;bm 选择RGB前景色
# \x1b[48;2;r;g;bm 选择RGB背景色
# Skip intro info on startup and outro info on exit
less_chatty = False
# Use alias from --login-path instead of host name in prompt
login_path_as_host = False
# Cause result sets to be displayed vertically if they are too wide for the current window,
# and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.)
auto_vertical_output = False
# keyword casing preference. Possible values "lower", "upper", "auto"
keyword_casing = auto
# disabled pager on startup
enable_pager = False
# Custom colors for the completion menu, toolbar, etc.
[colors]
completion-menu.completion.current = 'bg:#ffffff #000000'
completion-menu.completion = 'bg:#008888 #ffffff'
completion-menu.meta.completion.current = 'bg:#44aaaa #000000'
completion-menu.meta.completion = 'bg:#448888 #ffffff'
completion-menu.multi-column-meta = 'bg:#aaffff #000000'
scrollbar.arrow = 'bg:#003333'
scrollbar = 'bg:#00aaaa'
selected = '#ffffff bg:#6666aa'
search = '#ffffff bg:#4444aa'
search.current = '#ffffff bg:#44aa44'
bottom-toolbar = 'bg:#222222 #aaaaaa'
bottom-toolbar.off = 'bg:#222222 #888888'
bottom-toolbar.on = 'bg:#222222 #ffffff'
search-toolbar = 'noinherit bold'
search-toolbar.text = 'nobold'
system-toolbar = 'noinherit bold'
arg-toolbar = 'noinherit bold'
arg-toolbar.text = 'nobold'
bottom-toolbar.transaction.valid = 'bg:#222222 #00ff5f bold'
bottom-toolbar.transaction.failed = 'bg:#222222 #ff005f bold'
# style classes for colored table output
output.header = "#00ff5f bold"
output.odd-row = ""
output.even-row = ""
output.null = "#808080"
# SQL syntax highlighting overrides
sql.comment = 'italic #408080'
# sql.comment.multi-line = ''
# sql.comment.single-line = ''
# sql.comment.optimizer-hint = ''
# sql.escape = 'border:#FF0000'
# sql.keyword = 'bold #008000'
# sql.datatype = 'nobold #B00040'
# sql.literal = ''
# sql.literal.date = ''
# sql.symbol = ''
# sql.quoted-schema-object = ''
# sql.quoted-schema-object.escape = ''
# sql.constant = '#880000'
# sql.function = '#0000FF'
# sql.variable = '#19177C'
# sql.number = '#666666'
# sql.number.binary = ''
# sql.number.float = ''
# sql.number.hex = ''
# sql.number.integer = ''
# sql.operator = '#666666'
# sql.punctuation = ''
# sql.string = '#BA2121'
# sql.string.double-quouted = ''
# sql.string.escape = 'bold #BB6622'
# sql.string.single-quoted = ''
# sql.whitespace = ''
# Favorite queries.
[favorite_queries]
# Use the -d option to reference a DSN.
# Special characters in passwords and other strings can be escaped with URL encoding.
[alias_dsn]
# example_dsn = mysql://[user[:password]@][host][:port][/dbname]
local = mysql://admin@127.0.0.1:3306/test

View File

@ -0,0 +1,14 @@
#!/bin/bash
echo 'First, make npm dir for current user...'
mkdir -p -v $HOME/.local/npm/lib/node_modules $HOME/.local/npm/bin
echo 'Then, install nodejs-lts and npm...'
yay -S nodejs-lts-dubnium npm
echo 'Last, set npm install prefix'
npm config set prefix "$HOME/.local/npm"
npm config set registry https://registry.npm.taobao.org
echo 'Install create-react-app...'
cnpm install -g create-react-app

25
config/nodejs/npm.md Normal file
View File

@ -0,0 +1,25 @@
# npm config
使用系统 npm 目录会报权限错误,建议使用自定义的目录。
```bash
export NODE_PATH="$NODE_PATH:$HOME/.local/npm/lib/node_modules"
export PATH=$HOME/.local/npm/bin:$PATH
```
由于npm 安装太慢所以使用cnmp。
```bash
npm install -g cnpm --registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org
```
使用cnmp安装react
```bash
cnpm install -g create-react-app
create-react-app my-app
cd my-app/
npm start
```

578
config/nushell/config.nu Normal file
View File

@ -0,0 +1,578 @@
# Nushell Config File
module completions {
# Custom completions for external commands (those outside of Nushell)
# Each completions has two parts: the form of the external command, including its flags and parameters
# and a helper command that knows how to complete values for those flags and parameters
#
# This is a simplified version of completions for git branches and git remotes
def "nu-complete git branches" [] {
^git branch | lines | each { |line| $line | str replace '[\*\+] ' '' | str trim }
}
def "nu-complete git remotes" [] {
^git remote | lines | each { |line| $line | str trim }
}
export extern "git checkout" [
branch?: string@"nu-complete git branches" # name of the branch to checkout
-b: string # create and checkout a new branch
-B: string # create/reset and checkout a branch
-l # create reflog for new branch
--guess # second guess 'git checkout <no-such-branch>' (default)
--overlay # use overlay mode (default)
--quiet(-q) # suppress progress reporting
--recurse-submodules: string # control recursive updating of submodules
--progress # force progress reporting
--merge(-m) # perform a 3-way merge with the new branch
--conflict: string # conflict style (merge or diff3)
--detach(-d) # detach HEAD at named commit
--track(-t) # set upstream info for new branch
--force(-f) # force checkout (throw away local modifications)
--orphan: string # new unparented branch
--overwrite-ignore # update ignored files (default)
--ignore-other-worktrees # do not check if another worktree is holding the given ref
--ours(-2) # checkout our version for unmerged files
--theirs(-3) # checkout their version for unmerged files
--patch(-p) # select hunks interactively
--ignore-skip-worktree-bits # do not limit pathspecs to sparse entries only
--pathspec-from-file: string # read pathspec from file
]
export extern "git push" [
remote?: string@"nu-complete git remotes", # the name of the remote
refspec?: string@"nu-complete git branches"# the branch / refspec
--verbose(-v) # be more verbose
--quiet(-q) # be more quiet
--repo: string # repository
--all # push all refs
--mirror # mirror all refs
--delete(-d) # delete refs
--tags # push tags (can't be used with --all or --mirror)
--dry-run(-n) # dry run
--porcelain # machine-readable output
--force(-f) # force updates
--force-with-lease: string # require old value of ref to be at this value
--recurse-submodules: string # control recursive pushing of submodules
--thin # use thin pack
--receive-pack: string # receive pack program
--exec: string # receive pack program
--set-upstream(-u) # set upstream for git pull/status
--progress # force progress reporting
--prune # prune locally removed refs
--no-verify # bypass pre-push hook
--follow-tags # push missing but relevant tags
--signed: string # GPG sign the push
--atomic # request atomic transaction on remote side
--push-option(-o): string # option to transmit
--ipv4(-4) # use IPv4 addresses only
--ipv6(-6) # use IPv6 addresses only
]
}
# Get just the extern definitions without the custom completion commands
use completions *
# for more information on themes see
# https://www.nushell.sh/book/coloring_and_theming.html
let default_theme = {
# color for nushell primitives
separator: white
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: green_bold
empty: blue
bool: white
int: white
filesize: white
duration: white
date: white
range: white
float: white
string: white
nothing: white
binary: white
cellpath: white
row_index: green_bold
record: white
list: white
block: white
hints: dark_gray
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_binary: purple_bold
shape_bool: light_cyan
shape_int: purple_bold
shape_float: purple_bold
shape_range: yellow_bold
shape_internalcall: cyan_bold
shape_external: cyan
shape_externalarg: green_bold
shape_literal: blue
shape_operator: yellow
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_datetime: cyan_bold
shape_list: cyan_bold
shape_table: blue_bold
shape_record: cyan_bold
shape_block: blue_bold
shape_filepath: cyan
shape_globpattern: cyan_bold
shape_variable: purple
shape_flag: blue_bold
shape_custom: green
shape_nothing: light_cyan
}
# The default config record. This is where much of your global configuration is setup.
let $config = {
filesize_metric: false
# basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
table_mode: none
use_ls_colors: true
rm_always_trash: false
color_config: $default_theme
use_grid_icons: true
footer_mode: "25" # always, never, number_of_rows, auto
quick_completions: true # set this to false to prevent auto-selecting completions when only one remains
partial_completions: true # set this to false to prevent partial filling of the prompt
animate_prompt: false # redraw the prompt every second
float_precision: 2
use_ansi_coloring: true
filesize_format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
edit_mode: emacs # emacs, vi
max_history_size: 1000 # Session has to be reloaded for this to take effect
sync_history_on_enter: true # Enable to share the history between multiple sessions, else you have to close the session to persist history to file
menus: [
# Configuration for default nushell menus
# Note the lack of souce parameter
{
name: completion_menu
only_buffer_difference: false
marker: "| "
type: {
layout: columnar
columns: 4
col_width: 20 # Optional value. If missing all the screen width is used to calculate column width
col_padding: 2
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
}
{
name: history_menu
only_buffer_difference: true
marker: "? "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
}
{
name: help_menu
only_buffer_difference: true
marker: "? "
type: {
layout: description
columns: 4
col_width: 20 # Optional value. If missing all the screen width is used to calculate column width
col_padding: 2
selection_rows: 4
description_rows: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
}
# Example of extra menus created using a nushell source
# Use the source field to create a list of records that populates
# the menu
{
name: commands_menu
only_buffer_difference: false
marker: "# "
type: {
layout: columnar
columns: 4
col_width: 20
col_padding: 2
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
$nu.scope.commands
| where command =~ $buffer
| each { |it| {value: $it.command description: $it.usage} }
}
}
{
name: vars_menu
only_buffer_difference: true
marker: "# "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
$nu.scope.vars
| where name =~ $buffer
| sort-by name
| each { |it| {value: $it.name description: $it.type} }
}
}
{
name: commands_with_description
only_buffer_difference: true
marker: "# "
type: {
layout: description
columns: 4
col_width: 20
col_padding: 2
selection_rows: 4
description_rows: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
$nu.scope.commands
| where command =~ $buffer
| each { |it| {value: $it.command description: $it.usage} }
}
}
]
keybindings: [
{
name: completion_menu
modifier: none
keycode: tab
mode: emacs # Options: emacs vi_normal vi_insert
event: {
until: [
{ send: menu name: completion_menu }
{ send: menunext }
]
}
}
{
name: completion_previous
modifier: shift
keycode: backtab
mode: [emacs, vi_normal, vi_insert] # Note: You can add the same keybinding to all modes by using a list
event: { send: menuprevious }
}
{
name: history_menu
modifier: control
keycode: char_x
mode: emacs
event: {
until: [
{ send: menu name: history_menu }
{ send: menupagenext }
]
}
}
{
name: history_previous
modifier: control
keycode: char_z
mode: emacs
event: {
until: [
{ send: menupageprevious }
{ edit: undo }
]
}
}
# Keybindings used to trigger the user defined menus
{
name: commands_menu
modifier: control
keycode: char_t
mode: [emacs, vi_normal, vi_insert]
event: { send: menu name: commands_menu }
}
{
name: vars_menu
modifier: control
keycode: char_y
mode: [emacs, vi_normal, vi_insert]
event: { send: menu name: vars_menu }
}
{
name: commands_with_description
modifier: control
keycode: char_u
mode: [emacs, vi_normal, vi_insert]
event: { send: menu name: commands_with_description }
}
]
}
# Do not overwrite open command on macOS
def nuopen [arg, --raw (-r)] {
if $raw {
open -r $arg
} else {
open $arg
}
}
alias open = ^open
alias ll = ls -l
alias la = ls -a
alias lt = (ls | sort-by modified -r | sort-by type)
alias g = git
alias ga = git add
alias gaa = git add --all
alias gam = git am
alias gama = git am --abort
alias gamc = git am --continue
alias gams = git am --skip
alias gamscp = git am --show-current-patch
alias gap = git apply
alias gapa = git add --patch
alias gapt = git apply --3way
alias gau = git add --update
alias gav = git add --verbose
alias gb = git branch
alias gbD = git branch -D
alias gba = git branch -a
alias gbd = git branch -d
# alias gbda = git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d
alias gbl = git blame -b -w
alias gbnm = git branch --no-merged
alias gbr = git branch --remote
alias gbs = git bisect
alias gbsb = git bisect bad
alias gbsg = git bisect good
alias gbsr = git bisect reset
alias gbss = git bisect start
alias gc = git commit -v
alias gc! = git commit -v --amend
alias gca = git commit -v -a
alias gca! = git commit -v -a --amend
alias gcam = git commit -a -m
alias gcan! = git commit -v -a --no-edit --amend
alias gcans! = git commit -v -a -s --no-edit --amend
alias gcb = git checkout -b
alias gcd = git checkout develop
alias gcf = git config --list
alias gcl = git clone --recurse-submodules
alias gclean = git clean -id
alias gcm = git checkout $(git_main_branch)
alias gcmsg = git commit -m
alias gcn! = git commit -v --no-edit --amend
alias gco = git checkout
alias gcount = git shortlog -sn
alias gcp = git cherry-pick
alias gcpa = git cherry-pick --abort
alias gcpc = git cherry-pick --continue
alias gcs = git commit -S
alias gcsm = git commit -s -m
alias gd = git diff
alias gdca = git diff --cached
alias gdct = git describe --tags $(git rev-list --tags --max-count=1)
alias gdcw = git diff --cached --word-diff
alias gds = git diff --staged
alias gdt = git diff-tree --no-commit-id --name-only -r
alias gdw = git diff --word-diff
alias gf = git fetch
alias gfa = git fetch --all --prune
# alias gfg = git ls-files | grep
alias gfo = git fetch origin
alias gg = git gui citool
alias gga = git gui citool --amend
alias ggpull = git pull origin (git_current_branch)
alias ggpur = ggu
alias ggpush = git push origin (git_current_branch)
alias ggsup = git branch --set-upstream-to=origin/$(git_current_branch)
alias ghh = git help
alias gignore = git update-index --assume-unchanged
# alias gignored = git ls-files -v | grep "^[[:lower:]]"
alias git-svn-dcommit-push = git svn dcommit && git push github $(git_main_branch):svntrunk
alias gk = \gitk --all --branches
alias gke = \gitk --all $(git log -g --pretty=%h)
alias gl = git pull
alias glg = git log --stat
alias glgg = git log --graph
alias glgga = git log --graph --decorate --all
alias glgm = git log --graph --max-count=10
alias glgp = git log --stat -p
alias glo = git log --oneline --decorate
alias globurl = noglob urlglobber
alias glod = git log --graph --pretty=\%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\
alias glods = git log --graph --pretty=\%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\ --date=short
alias glog = git log --oneline --decorate --graph
alias gloga = git log --oneline --decorate --graph --all
alias glol = git log --graph --pretty=\%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\
alias glola = git log --graph --pretty=\%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\ --all
alias glols = git log --graph --pretty=\%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\ --stat
alias glp = _git_log_prettily
alias glum = git pull upstream $(git_main_branch)
alias gm = git merge
alias gma = git merge --abort
alias gmom = git merge origin/$(git_main_branch)
alias gmt = git mergetool --no-prompt
alias gmtvim = git mergetool --no-prompt --tool=vimdiff
alias gmum = git merge upstream/$(git_main_branch)
alias gp = git push
alias gpd = git push --dry-run
alias gpf = git push --force-with-lease
alias gpf! = git push --force
alias gpoat = git push origin --all && git push origin --tags
alias gpristine = git reset --hard && git clean -dffx
alias gpsup = git push --set-upstream origin $(git_current_branch)
alias gpu = git push upstream
alias gpv = git push -v
alias gr = git remote
alias gra = git remote add
alias grb = git rebase
alias grba = git rebase --abort
alias grbc = git rebase --continue
alias grbd = git rebase develop
alias grbi = git rebase -i
alias grbm = git rebase $(git_main_branch)
alias grbs = git rebase --skip
alias grep = grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}
alias grev = git revert
alias grh = git reset
alias grhh = git reset --hard
alias grm = git rm
alias grmc = git rm --cached
alias grmv = git remote rename
alias groh = git reset origin/$(git_current_branch) --hard
alias grrm = git remote remove
alias grs = git restore
alias grset = git remote set-url
alias grss = git restore --source
alias grt = cd "$(git rev-parse --show-toplevel || echo .)"
alias gru = git reset --
alias grup = git remote update
alias grv = git remote -v
alias gsb = git status -sb
alias gsd = git svn dcommit
alias gsh = git show
alias gsi = git submodule init
alias gsps = git show --pretty=short --show-signature
alias gsr = git svn rebase
alias gss = git status -s
alias gst = git status
alias gsta = git stash push
alias gstaa = git stash apply
alias gstall = git stash --all
alias gstc = git stash clear
alias gstd = git stash drop
alias gstl = git stash list
alias gstp = git stash pop
alias gsts = git stash show --text
alias gstu = git stash --include-untracked
alias gsu = git submodule update
alias gsw = git switch
alias gswc = git switch -c
# alias gtl = gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl
alias gts = git tag -s
# alias gtv = git tag | sort -V
alias gunignore = git update-index --no-assume-unchanged
# alias gunwip = git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1
alias gup = git pull --rebase
alias gupa = git pull --rebase --autostash
alias gupav = git pull --rebase --autostash -v
alias gupv = git pull --rebase -v
alias gwch = git whatchanged -p --abbrev-commit --pretty=medium
# alias gwip = git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"
# def __git_prompt_git [...args] {
# let GIT_OPTIONAL_LOCKS = 0; command git $args
# }
# def git_current_branch [] {
# let ref = (__git_prompt_git symbolic-ref HEAD | split row "/")
# let ret = $env.LAST_EXIT_CODE
# if $ret != 0 {
# if $ret == 128 {
# ref = (__git_prompt_git rev-parse HEAD | split row "/")
# }
# }
# let num = (echo $ref | length)
# echo $ref | get ($num - 1)
# }
def nope [] {
each { |it| $it == false }
}
def git_current_branch [] {
let in-git-repo = (do --ignore-errors { git rev-parse --abbrev-ref HEAD } | empty? | nope)
let status = (if $in-git-repo {
git --no-optional-locks status --porcelain=2 --branch | lines
} else {
[]
})
let on-named-branch = (if $in-git-repo {
$status
| where ($it | str starts-with '# branch.head')
| first
| str contains '(detached)'
| nope
} else {
false
})
let branch-name = (if $on-named-branch {
$status
| where ($it | str starts-with '# branch.head')
| split column ' ' col1 col2 branch
| get branch
| first
} else {
''
})
$branch-name
}
def ggpush [] {
git push origin (git_current_branch)
}
# Refer to bash version
# function git_current_branch() {
# local ref
# ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2>/dev/null)
# local ret=$?
# if [[ $ret != 0 ]]; then
# [[ $ret == 128 ]] && return # no git repo.
# ref=$(__git_prompt_git rev-parse --short HEAD 2>/dev/null) || return
# fi
# echo ${ref#refs/heads/}
# }

566
config/nushell/env.nu Normal file
View File

@ -0,0 +1,566 @@
# Nushell Environment Config File
def create_left_prompt [] {
let path_segment = ($env.PWD)
$path_segment
}
def display_time [] {
let time_segment = ([
(ansi { fg: "#d33682"})
(date now | date format '[%Y-%m-%d %H:%M:%S]')
] | str collect)
$time_segment
}
def create_right_prompt [] {
''
}
def indicator [] {
let code = $env.LAST_EXIT_CODE
let indicator = (
if $code == 0 {[
(ansi {fg: '#2aa198'})
(" ")
] | str collect
} else {[
# if LAST_EXIT_CODE is not 0, then display the code
(ansi { fg: '#b58900' })
( "C:" )
(ansi { fg: '#dc322f' })
( $code )
(ansi { fg: '#dc322f' })
(" ")
] | str collect
}
)
$indicator
}
# Use nushell functions to define your right and left prompt
let-env PROMPT_COMMAND = { simpleline-git }
let-env PROMPT_COMMAND_RIGHT = { create_right_prompt }
# The prompt indicators are environmental variables that represent
# the state of the prompt
let-env PROMPT_INDICATOR = { indicator }
# let-env PROMPT_INDICATOR = { " " }
let-env PROMPT_INDICATOR_VI_INSERT = { ": " }
let-env PROMPT_INDICATOR_VI_NORMAL = { " " }
let-env PROMPT_MULTILINE_INDICATOR = { "::: " }
# Specifies how environment variables are:
# - converted from a string to a value on Nushell startup (from_string)
# - converted from a value back to a string when running external commands (to_string)
# Note: The conversions happen *after* config.nu is loaded
let-env ENV_CONVERSIONS = {
"PATH": {
from_string: { |s| $s | split row (char esep) }
to_string: { |v| $v | str collect (char esep) }
}
"Path": {
from_string: { |s| $s | split row (char esep) }
to_string: { |v| $v | str collect (char esep) }
}
}
# Directories to search for scripts when calling source or use
#
# By default, <nushell-config-dir>/scripts is added
let-env NU_LIB_DIRS = [
($nu.config-path | path dirname | path join 'scripts')
]
# Directories to search for plugin binaries when calling register
#
# By default, <nushell-config-dir>/plugins is added
let-env NU_PLUGIN_DIRS = [
($nu.config-path | path dirname | path join 'plugins')
]
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# let-env PATH = ($env.PATH | prepend '/some/path')
# Inspired by panache-git: https://github.com/ehdevries/panache-git
module simpleline {
# Get the current directory with home abbreviated
export def simpleline_dir [] {
let current-dir = ($env.PWD)
let current-dir-relative-to-home = (
do --ignore-errors { $current-dir | path relative-to $nu.home-path } | str collect
)
let in-sub-dir-of-home = ($current-dir-relative-to-home | empty? | nope)
let current-dir-abbreviated = (if $in-sub-dir-of-home {
$'~(char separator)($current-dir-relative-to-home)'
} else if $current-dir == $nu.home-path {
'~'
} else {
$current-dir
})
$'(ansi { fg: "#859900" })($current-dir-abbreviated)'
}
# Get repository status as structured data
export def simpleline_structured [] {
let in-git-repo = (do --ignore-errors { git rev-parse --abbrev-ref HEAD } | empty? | nope)
let status = (if $in-git-repo {
git --no-optional-locks status --porcelain=2 --branch | lines
} else {
[]
})
let on-named-branch = (if $in-git-repo {
$status
| where ($it | str starts-with '# branch.head')
| first
| str contains '(detached)'
| nope
} else {
false
})
let branch-name = (if $on-named-branch {
$status
| where ($it | str starts-with '# branch.head')
| split column ' ' col1 col2 branch
| get branch
| first
} else {
''
})
let commit-hash = (if $in-git-repo {
$status
| where ($it | str starts-with '# branch.oid')
| split column ' ' col1 col2 full_hash
| get full_hash
| first
| str substring [0 7]
} else {
''
})
let tracking-upstream-branch = (if $in-git-repo {
$status
| where ($it | str starts-with '# branch.upstream')
| str collect
| empty?
| nope
} else {
false
})
let upstream-exists-on-remote = (if $in-git-repo {
$status
| where ($it | str starts-with '# branch.ab')
| str collect
| empty?
| nope
} else {
false
})
let ahead-behind-table = (if $upstream-exists-on-remote {
$status
| where ($it | str starts-with '# branch.ab')
| split column ' ' col1 col2 ahead behind
} else {
[[]]
})
let commits-ahead = (if $upstream-exists-on-remote {
$ahead-behind-table
| get ahead
| first
| into int
} else {
0
})
let commits-behind = (if $upstream-exists-on-remote {
$ahead-behind-table
| get behind
| first
| into int
| math abs
} else {
0
})
let has-staging-or-worktree-changes = (if $in-git-repo {
$status
| where ($it | str starts-with '1') || ($it | str starts-with '2')
| str collect
| empty?
| nope
} else {
false
})
let has-untracked-files = (if $in-git-repo {
$status
| where ($it | str starts-with '?')
| str collect
| empty?
| nope
} else {
false
})
let has-unresolved-merge-conflicts = (if $in-git-repo {
$status
| where ($it | str starts-with 'u')
| str collect
| empty?
| nope
} else {
false
})
let staging-worktree-table = (if $has-staging-or-worktree-changes {
$status
| where ($it | str starts-with '1') || ($it | str starts-with '2')
| split column ' '
| get column2
| split column '' staging worktree --collapse-empty
} else {
[[]]
})
let staging-added-count = (if $has-staging-or-worktree-changes {
$staging-worktree-table
| where staging == 'A'
| length
} else {
0
})
let staging-modified-count = (if $has-staging-or-worktree-changes {
$staging-worktree-table
| where staging in ['M', 'R']
| length
} else {
0
})
let staging-deleted-count = (if $has-staging-or-worktree-changes {
$staging-worktree-table
| where staging == 'D'
| length
} else {
0
})
let stashed-count = (if $in-git-repo {
git stash list | split row "\n" | length
} else {
0
})
let untracked-count = (if $has-untracked-files {
$status
| where ($it | str starts-with '?')
| length
} else {
0
})
let worktree-modified-count = (
if $has-staging-or-worktree-changes {
$staging-worktree-table
| where worktree in ['M', 'R']
| length
} else {
0
})
let worktree-deleted-count = (if $has-staging-or-worktree-changes {
$staging-worktree-table
| where worktree == 'D'
| length
} else {
0
})
let merge-conflict-count = (if $has-unresolved-merge-conflicts {
$status
| where ($it | str starts-with 'u')
| length
} else {
0
})
{
in_git_repo: $in-git-repo,
on_named_branch: $on-named-branch,
branch_name: $branch-name,
commit_hash: $commit-hash,
tracking_upstream_branch: $tracking-upstream-branch,
upstream_exists_on_remote: $upstream-exists-on-remote,
commits_ahead: $commits-ahead,
commits_behind: $commits-behind,
staging_added_count: $staging-added-count,
staging_modified_count: $staging-modified-count,
staging_deleted_count: $staging-deleted-count,
stashed_count: $stashed-count,
untracked_count: $untracked-count,
worktree_modified_count: $worktree-modified-count,
worktree_deleted_count: $worktree-deleted-count,
merge_conflict_count: $merge-conflict-count
}
}
# Get repository status as a styled string
export def simpleline_styled [] {
let status = (simpleline_structured)
let is-local-only = ($status.tracking_upstream_branch != true)
let upstream-deleted = (
$status.tracking_upstream_branch &&
$status.upstream_exists_on_remote != true
)
let is-up-to-date = (
$status.upstream_exists_on_remote &&
$status.commits_ahead == 0 &&
$status.commits_behind == 0
)
let is-ahead = (
$status.upstream_exists_on_remote &&
$status.commits_ahead > 0 &&
$status.commits_behind == 0
)
let is-behind = (
$status.upstream_exists_on_remote &&
$status.commits_ahead == 0 &&
$status.commits_behind > 0
)
let is-ahead-and-behind = (
$status.upstream_exists_on_remote &&
$status.commits_ahead > 0 &&
$status.commits_behind > 0
)
let branch-name = (if $status.in_git_repo {
(if $status.on_named_branch {
$status.branch_name
} else {
['(' $status.commit_hash '...)'] | str collect
})
} else {
''
})
let branch-styled = (if $status.in_git_repo {
(if $is-local-only {
(branch-local-only $branch-name)
} else if $is-up-to-date {
(branch-up-to-date $branch-name)
} else if $is-ahead {
(branch-ahead $branch-name $status.commits_ahead)
} else if $is-behind {
(branch-behind $branch-name $status.commits_behind)
} else if $is-ahead-and-behind {
(branch-ahead-and-behind $branch-name $status.commits_ahead $status.commits_behind)
} else if $upstream-deleted {
(branch-upstream-deleted $branch-name)
} else {
$branch-name
})
} else {
''
})
let has-staging-changes = (
$status.staging_added_count > 0 ||
$status.staging_modified_count > 0 ||
$status.staging_deleted_count > 0
)
let has-worktree-changes = (
$status.untracked_count > 0 ||
$status.worktree_modified_count > 0 ||
$status.worktree_deleted_count > 0 ||
$status.merge_conflict_count > 0
)
let has-stashed-changes = (
$status.stashed_count > 0
)
let has-merge-conflicts = $status.merge_conflict_count > 0
let staging-summary = (if $has-staging-changes {
(staging-changes $status.staging_added_count $status.staging_modified_count $status.staging_deleted_count)
} else {
''
})
let worktree-summary = (if $has-worktree-changes {
(worktree-changes $status.untracked_count $status.worktree_modified_count $status.worktree_deleted_count)
} else {
''
})
let stash-summary = (if $has-stashed-changes {
(stashed-changes $status.stashed_count)
} else {
''
})
let merge-conflict-summary = (if $has-merge-conflicts {
(unresolved-conflicts $status.merge_conflict_count)
} else {
''
})
let delimiter = (if ($has-staging-changes && $has-worktree-changes) {
('|' | bright-yellow)
} else {
''
})
let local-summary = (
$'($staging-summary) ($delimiter) ($worktree-summary) ($stash-summary) ($merge-conflict-summary)' | str trim
)
let local-indicator = (if $status.in_git_repo {
(if $has-worktree-changes {
('!' | red)
} else if $has-staging-changes {
('~' | bright-cyan)
} else if $has-stashed-changes {
('▣' | green)
} else {
''
})
} else {
''
})
let repo-summary = (
$'($branch-styled) ($local-summary) ($local-indicator)' | str trim
)
let left-bracket = ('[' | bright-yellow)
let right-bracket = (']' | bright-yellow)
(if $status.in_git_repo {
$'($left-bracket)($repo-summary)($right-bracket)'
} else {
''
})
}
# Helper commands to encapsulate style and make everything else more readable
def nope [] {
each { |it| $it == false }
}
def bright-cyan [] {
each { |it| $"(ansi -e '96m')($it)(ansi reset)" }
}
def bright-green [] {
each { |it| $"(ansi -e '92m')($it)(ansi reset)" }
}
def bright-red [] {
each { |it| $"(ansi -e '91m')($it)(ansi reset)" }
}
def bright-yellow [] {
each { |it| $"(ansi -e '93m')($it)(ansi reset)" }
}
def green [] {
each { |it| $"(ansi green)($it)(ansi reset)" }
}
def red [] {
each { |it| $"(ansi red)($it)(ansi reset)" }
}
def branch-local-only [
branch: string
] {
$branch | bright-cyan
}
def branch-upstream-deleted [
branch: string
] {
$'($branch) (char failed)' | bright-cyan
}
def branch-up-to-date [
branch: string
] {
$'($branch) (char identical_to)' | bright-cyan
}
def branch-ahead [
branch: string
ahead: int
] {
$'($branch) (char branch_ahead)($ahead)' | bright-green
}
def branch-behind [
branch: string
behind: int
] {
$'($branch) (char branch_behind)($behind)' | bright-red
}
def branch-ahead-and-behind [
branch: string
ahead: int
behind: int
] {
$'($branch) (char branch_behind)($behind) (char branch_ahead)($ahead)' | bright-yellow
}
def staging-changes [
added: int
modified: int
deleted: int
] {
$'+($added) ~($modified) -($deleted)' | green
}
def worktree-changes [
added: int
modified: int
deleted: int
] {
$'+($added) ~($modified) -($deleted)' | red
}
def stashed-changes [ num: int ] {
$'▣($num)' | bright-cyan
}
def unresolved-conflicts [
conflicts: int
] {
$'!($conflicts)' | red
}
}
# An opinionated Git prompt for Nushell, styled after posh-git
def simpleline-git [] {
use simpleline *
let prompt = ($'(display_time) (simpleline_dir) (simpleline_styled)' | str trim )
$'($prompt)'
}

568
config/nushell/oh-my.nu Normal file
View File

@ -0,0 +1,568 @@
# oh-my.nu
# NOTE: This is meant to run with engine-q and not nushell yet
# It's still being tested. There will be bugs. :)
# REQUIREMENTS #
# you definitely need nerd fonts https://www.nerdfonts.com
# nerd fonts repo https://github.com/ryanoasis/nerd-fonts
# i use "FiraCode Nerd Font Mono" on mac
#
# you also must have the engine-q gstat plugin installed and registered
# ATTRIBUTION #
# A little fancier prompt with git information
# inspired by https://github.com/xcambar/purs
# inspired by https://github.com/IlanCosman/tide
# inspired by https://github.com/JanDeDobbeleer/oh-my-posh
# Abbreviate home path
def home_abbrev [os_name] {
let is_home_in_path = ($env.PWD | str starts-with $nu.home-path)
if $is_home_in_path {
if ($os_name =~ "windows") {
let home = ($nu.home-path | str replace -a '\\' '/')
let pwd = ($env.PWD | str replace -a '\\' '/')
$pwd | str replace $home '~'
} else {
$env.PWD | str replace $nu.home-path '~'
}
} else {
$env.PWD | str replace -a '\\' '/'
}
}
def path_abbrev_if_needed [apath term_width] {
# probably shouldn't do coloring here but since we're coloring
# only certain parts, it's kind of tricky to do it in another place
let T = (ansi { fg: "#BCBCBC" bg: "#3465A4"}) # truncated
let P = (ansi { fg: "#E4E4E4" bg: "#3465A4"}) # path
let PB = (ansi { fg: "#E4E4E4" bg: "#3465A4" attr: b}) # path bold
let R = (ansi reset)
if (($apath | str length) > ($term_width / 2)) {
# split out by path separator into tokens
# don't use psep here because in home_abbrev we're making them all '/'
let splits = ($apath | split row '/')
let splits_len = ($splits | length)
let subtractor = (if ($splits_len <= 2) { 1 } else { 2 })
# get all the tokens except the last
let tokens = (for x in 1..($splits_len - $subtractor) {
$"($T)((($splits) | get $x | split chars) | get 0)($R)"
})
# need an insert command
let tokens = ($tokens | prepend $"($T)~")
# append the last part of the path
let tokens = ($tokens | append $"($PB)($splits | last)($R)")
# collect
$tokens | str collect $"($T)/"
} else {
# $"($P)($apath)($R)"
# FIXME: This is close but it fails with folder with space. I'm not sure why.
# let splits = ($apath | split row '/')
# let splits_len = ($splits | length)
# let tokens = (for x in 0..($splits_len - 1) {
# if ($x < ($splits_len - 1)) {
# $"/($T)(($splits | get $x | split chars).0)($R)"
# }
# })
# let tokens = ($tokens | append $"/($PB)(($splits | last).0)($R)")
# $tokens | str collect $"($T)"
# FIXME: This is close but it fails with folder with space. I'm not sure why.
# cd "/Applications/Hex Fiend.app/"
#    ~/H/A/Hex Fiend.app 
# should be
#    ~/A/Hex Fiend.app 
let splits = ($apath | split row '/')
let splits_len = ($splits | length)
if ($splits_len == 0) {
# We're at / on the file system
$"/($T)"
} else if ($splits_len == 1) {
let top_part = ($splits | first)
let tokens = $"($PB)($top_part)($R)"
$tokens | str collect $"($T)"
} else {
let top_part = ($splits | first ($splits_len - 1))
let end_part = ($splits | last)
let tokens = (for x in $top_part {
$"/($T)(($x | split chars).0)($R)"
})
let tokens = ($tokens | append $"/($PB)($end_part)($R)")
$tokens | str collect $"($T)"
}
}
}
def get_index_change_count [gs] {
let index_new = ($gs | get idx_added_staged)
let index_modified = ($gs | get idx_modified_staged)
let index_deleted = ($gs | get idx_deleted_staged)
let index_renamed = ($gs | get idx_renamed)
let index_typechanged = ($gs | get idx_type_changed)
$index_new + $index_modified + $index_deleted + $index_renamed + $index_typechanged
}
def get_working_tree_count [gs] {
let wt_modified = ($gs | get wt_modified)
let wt_deleted = ($gs | get wt_deleted)
let wt_typechanged = ($gs | get wt_type_changed)
let wt_renamed = ($gs | get wt_renamed)
$wt_modified + $wt_deleted + $wt_typechanged + $wt_renamed
}
def get_conflicted_count [gs] {
($gs | get conflicts)
}
def get_untracked_count [gs] {
($gs | get wt_untracked)
}
def get_branch_name [gs] {
let br = ($gs | get branch)
if $br == "no_branch" {
""
} else {
$br
}
}
def get_ahead_count [gs] {
($gs | get ahead)
}
def get_behind_count [gs] {
($gs | get behind)
}
def get_icons_list [] {
{
AHEAD_ICON: (char branch_ahead), # "↑" 2191
BEHIND_ICON: (char branch_behind), # "↓" 2193
NO_CHANGE_ICON: (char branch_identical) # ≣ 2263
HAS_CHANGE_ICON: "*",
INDEX_CHANGE_ICON: "♦",
WT_CHANGE_ICON: "✚",
CONFLICTED_CHANGE_ICON: "✖",
UNTRACKED_CHANGE_ICON: (char branch_untracked) # ≢ 2262
INSERT_SYMBOL_ICON: "",
HAMBURGER_ICON: (char hamburger) # "≡" 2261
GITHUB_ICON: "", # f408
BRANCH_ICON: (char nf_branch) # "" e0a0
REBASE_ICON: "", # e728
TAG_ICON: "" # f412
}
}
def get_icon_by_name [name] {
do -i { get_icons_list | get $name }
}
def get_os_icon [os] {
# f17c = tux, f179 = apple, f17a = windows
if ($os.name =~ macos) {
(char -u f179)
} else if ($os.name =~ windows) {
(char -u f17a)
} else if ($os.kernel_version =~ WSL) {
$'(char -u f17a)(char -u f17c)'
} else if ($os.family =~ unix) {
(char -u f17c)
} else {
''
}
}
# ╭─────────────────────┬───────────────╮
# │ idx_added_staged │ 0 │ #INDEX_NEW
# │ idx_modified_staged │ 0 │ #INDEX_MODIFIED
# │ idx_deleted_staged │ 0 │ #INDEX_DELETED
# │ idx_renamed │ 0 │ #INDEX_RENAMED
# │ idx_type_changed │ 0 │ #INDEX_TYPECHANGE
# │ wt_untracked │ 0 │ #WT_NEW
# │ wt_modified │ 0 │ #WT_MODIFIED
# │ wt_deleted │ 0 │ #WT_DELETED
# │ wt_type_changed │ 0 │ #WT_TYPECHANGE
# │ wt_renamed │ 0 │ #WT_RENAMED
# │ ignored │ 0 │
# │ conflicts │ 0 │ #CONFLICTED
# │ ahead │ 0 │
# │ behind │ 0 │
# │ stashes │ 0 │
# │ repo_name │ engine-q │
# │ tag │ no_tag │
# │ branch │ main │
# │ remote │ upstream/main │
# ╰─────────────────────┴───────────────╯
def get_repo_status [gs os] {
# replace this 30 with whatever the width of the terminal is
let display_path = (path_abbrev_if_needed (home_abbrev $os.name) 30)
let branch_name = (get_branch_name $gs)
let ahead_cnt = (get_ahead_count $gs)
let behind_cnt = (get_behind_count $gs)
let index_change_cnt = (get_index_change_count $gs)
let wt_change_cnt = (get_working_tree_count $gs)
let conflicted_cnt = (get_conflicted_count $gs)
let untracked_cnt = (get_untracked_count $gs)
let has_no_changes = (
if ($index_change_cnt <= 0) &&
($wt_change_cnt <= 0) &&
($conflicted_cnt <= 0) &&
($untracked_cnt <= 0) {
true
} else {
false
}
)
let GIT_BG = "#C4A000"
let GIT_FG = "#000000"
# let TERM_BG = "#0C0C0C"
# The multi-color fg colors are good if you just have a black background
let AHEAD_ICON = (get_icon_by_name AHEAD_ICON)
# let A_COLOR = (ansi { fg:"#00ffff" bg: ($GIT_BG) })
let A_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let BEHIND_ICON = (get_icon_by_name BEHIND_ICON)
# let B_COLOR = (ansi { fg:"#00ffff" bg: ($GIT_BG) })
let B_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let INDEX_CHANGE_ICON = (get_icon_by_name INDEX_CHANGE_ICON)
# let I_COLOR = (ansi { fg:"#00ff00" bg: ($GIT_BG) })
let I_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let CONFLICTED_CHANGE_ICON = (get_icon_by_name CONFLICTED_CHANGE_ICON)
# let C_COLOR = (ansi { fg:"#ff0000" bg: ($GIT_BG) })
let C_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let WT_CHANGE_ICON = (get_icon_by_name WT_CHANGE_ICON)
# let W_COLOR = (ansi { fg:"#ff00ff" bg: ($GIT_BG) })
let W_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let UNTRACKED_CHANGE_ICON = (get_icon_by_name UNTRACKED_CHANGE_ICON)
# let U_COLOR = (ansi { fg:"#ffff00" bg: ($GIT_BG) })
let U_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let NO_CHANGE_ICON = (get_icon_by_name NO_CHANGE_ICON)
# let N_COLOR = (ansi { fg:"#00ff00" bg: ($GIT_BG) })
let N_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let HAS_CHANGE_ICON = (get_icon_by_name HAS_CHANGE_ICON)
# let H_COLOR = (ansi { fg:"#ff0000" bg: ($GIT_BG) attr: b })
let H_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) attr: b })
let INSERT_SYMBOL_ICON = (get_icon_by_name INSERT_SYMBOL_ICON)
# let S_COLOR = (ansi { fg:"#00ffff" bg: ($GIT_BG) })
let S_COLOR = (ansi { fg: ($GIT_FG) bg: ($GIT_BG) })
let R = (ansi reset)
let repo_status = (
$"(
if ($ahead_cnt > 0) { $'($A_COLOR)($AHEAD_ICON)($ahead_cnt)($R)' }
)(
if ($behind_cnt > 0) { $'($B_COLOR)($BEHIND_ICON)($behind_cnt)($R)' }
)(
if ($index_change_cnt > 0) { $'($I_COLOR)($INDEX_CHANGE_ICON)($index_change_cnt)($R)' }
)(
if ($conflicted_cnt > 0) { $'($C_COLOR)($CONFLICTED_CHANGE_ICON)($conflicted_cnt)($R)' }
)(
if ($wt_change_cnt > 0) { $'($W_COLOR)($WT_CHANGE_ICON)($wt_change_cnt)($R)' }
)(
if ($untracked_cnt > 0) { $'($U_COLOR)($UNTRACKED_CHANGE_ICON)($untracked_cnt)($R)' }
)(
if $has_no_changes { $'($N_COLOR)($NO_CHANGE_ICON)($R)' } else { $'($H_COLOR)($HAS_CHANGE_ICON)($R)' }
)"
)
$repo_status
}
def git_left_prompt [gs os] {
# replace this 30 with whatever the width of the terminal is
let display_path = (path_abbrev_if_needed (home_abbrev $os.name) 30)
let branch_name = (get_branch_name $gs)
let R = (ansi reset)
# when reduce is available
# echo "one" "two" "three" | reduce { if ($acc | str starts-with 't') { $acc + $it } { $it }}
# some icons and the unicode char
# e0b0
# e0b1
# e0b2
# e0b3
# f1d3
# f07c or  f115
# f015 or  f7db
let GIT_BG = "#C4A000"
let GIT_FG = "#000000"
let TERM_BG = "#0C0C0C"
let repo_status = (get_repo_status $gs $os)
# build segments and then put together the segments for the prompt
let os_segment = ([
(ansi { fg: "#080808" bg: "#CED7CF"}) # os bg color
(char space) # space
(get_os_icon $os) # os icon
(char space) # space
(ansi { fg: "#CED7CF" bg: "#3465A4"}) # color transition
(char -u e0b0) # 
(char space) # space
] | str collect)
let is_home_in_path = ($env.PWD | str starts-with $nu.home-path)
let path_segment = (if (($is_home_in_path) && ($branch_name == "")) {
[
(char -u f015) #  home icon
(char space) # space
$display_path # ~/src/forks/nushell
(ansi { fg: "#CED7CF" bg: "#3465A4"}) # color just to color the next space
(char space) # space
] | str collect
} else {
[
(char -u f07c) #  folder icon
(char space) # space
$display_path # ~/src/forks/nushell
(ansi { fg: "#CED7CF" bg: "#3465A4"}) # color just to color the next space
(char space) # space
] | str collect
})
let git_segment = (if ($branch_name != "") {
[
(ansi { fg: "#3465A4" bg: "#4E9A06"}) # color
(char -u e0b0) # 
(char space) # space
(ansi { fg: $TERM_BG bg: "#4E9A06"}) # color
# (char -u f1d3) # 
(char -u e0a0) # 
(char space) # space
($branch_name) # main
(char space) # space
(ansi { fg: "#4E9A06" bg: $GIT_BG}) # color
(char -u e0b0) # 
(char space) # space
($R) # reset color
$repo_status # repo status
] | str collect
})
let git_right = false
let indicator_segment = (if ($branch_name == "" || $git_right) {
[
(ansi { fg: "#3465A4" bg: $TERM_BG}) # color
(char -u e0b0) # 
($R) # reset color
] | str collect
} else {
[
(ansi { fg: $GIT_BG bg: $TERM_BG}) # color
(char -u e0b0) # 
($R) # reset color
] | str collect
})
# assemble all segments for final prompt printing
[
$os_segment
$path_segment
(if ($git_right == false) {
$git_segment
})
$indicator_segment
] | str collect
}
def git_right_prompt [gs os] {
# right prompt ideas
# 1. just the time on the right
# 2. date and time on the right
# 3. git information on the right
# 4. maybe git and time
# 5. would like to get CMD_DURATION_MS going there too when it's implemented
# 6. all of the above, chosen by def parameters
let branch_name = (get_branch_name $gs)
let repo_status = (get_repo_status $gs $os)
let R = (ansi reset)
let TIME_BG = "#D3D7CF"
let TERM_FG = "#0C0C0C"
let GIT_BG = "#C4A000"
let GIT_FG = "#000000"
let TERM_BG = "#0C0C0C"
let TERM_FG_DEFAULT = "\e[39m"
let TERM_BG_DEFAULT = "\e[49m"
let datetime_segment = ([
(ansi { fg: $TIME_BG bg: $TERM_FG})
(char -u e0b2) # 
(ansi { fg: $TERM_FG bg: $TIME_BG})
(char space)
(date now | date format '%m/%d/%Y %I:%M:%S%.3f')
(char space)
($R)
] | str collect)
let time_segment = ([
(ansi { fg: $TIME_BG bg: $TERM_FG})
(char -u e0b2) # 
(ansi { fg: $TERM_FG bg: $TIME_BG})
(char space)
(date now | date format '%I:%M:%S %p')
(char space)
($R)
] | str collect)
let git_segment = (if ($branch_name != "") {
[
(ansi { fg: $GIT_BG bg: $TERM_BG}) # color
(char -u e0b2) # 
(ansi { fg: $TERM_FG bg: $GIT_BG}) # color
(char space) # space
$repo_status # repo status
(ansi { fg: $TERM_FG bg: $GIT_BG}) # color
(char space)
(ansi { fg: "#4E9A06" bg: $GIT_BG }) # color
(char -u e0b2) # 
(ansi { fg: $TERM_BG bg: "#4E9A06"}) # color
(char space) # space
# (char -u f1d3) # 
# (char -u e0a0) # 
(char nf_git_branch) # 
(char space) # space
$branch_name # main
(char space) # space
($R) # reset color
] | str collect
})
let execution_time_segment = (
[
# (ansi { fg: "#606060" bg: "#191323"})
(ansi { fg: "#606060"})
$TERM_BG_DEFAULT
(char -u e0b3)
(char space)
$env.CMD_DURATION_MS
(char space)
($R)
] | str collect
)
let status_segment = (
[
(if $env.LAST_EXIT_CODE != 0 {
(ansi { fg: "#CC0000" bg: "#191323"})
} else {
(ansi { fg: "#606060" bg: "#191323"})
})
(char -u e0b3)
(char space)
$env.LAST_EXIT_CODE
(char space)
($R)
] | str collect
)
# 1. datetime - working
# $datetime_segment
# 2. time only - working
[
(if $env.LAST_EXIT_CODE != 0 {
$status_segment
})
$execution_time_segment
$time_segment
] | str collect
# 3. git only - working
# $git_segment
# 4. git + time -> need to fix the transition
# [
# $git_segment
# $time_segment
# ] | str collect
# 5. fernando wants this on the left prompt
# [
# $os_segment
# $time_segment
# $path_segment
# ]
}
def git_prompt [] {
let gs = (gstat)
let os = $nu.os-info
let left_prompt = (git_left_prompt $gs $os)
let right_prompt = (git_right_prompt $gs $os)
# set the title of the window/tab
# Wezterm accepts:
# osc0 \x1b]0;
# osc1 \x1b]1;
# osc2 \x1b]2;
# the typical way to set the terminal title is:
# osc2 some_string bel aka (char osc)2;($some_string)(char bel) or "\u001b]2;($some_string)\a"
# bel is escape \a or \x7 or \u0007
# but i've also seen it as
# osc2 some_string string_terminator aka (char osc)2;($some_string)(ansi st) or "\u001b];($some_string)\\"
# where string_terminator is \
# so you might want to play around with these settings a bit
#let abbrev = ((path_abbrev_if_needed (home_abbrev $os.name) 30) | ansi strip)
# $"\u001b]0;($abbrev)"
# note that this isn't ending properly with a bel or a st, that's
# because it makes the string echo to the screen as an empty line
# turning off now since a similar thing is built into nushell + it breaks kitty
#$"(ansi osc)2;($abbrev)"
# return in record literal syntax to be used kind of like a tuple
# so we don't have to run this script more than once per prompt
{
left_prompt: $left_prompt
right_prompt: $right_prompt
}
#
# in the config.nu you would do something like
# use "c:\some\path\to\nu_scripts\engine-q\prompt\oh-my.nu" git_prompt
# let-env PROMPT_COMMAND = { (git_prompt).left_prompt }
# let-env PROMPT_COMMAND_RIGHT = { (git_prompt).right_prompt }
# let-env PROMPT_INDICATOR = " "
}
# panache-git
# An opinionated Git prompt for Nushell, styled after posh-git
#
# Quick Start:
# - Download this script (panache-git.nu)
# - In your Nushell config:
# - Source this script
# - Set panache-git as your prompt command
# - Disable the separate prompt indicator by setting it to an empty string
# - For example, with this script in your home directory:
# source ~/panache-git.nu
# let-env PROMPT_COMMAND = { panache-git }
# let-env PROMPT_INDICATOR = { "" }
# - Restart Nushell
#

View File

@ -0,0 +1,9 @@
{
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["go"]
}
}
}

View File

@ -0,0 +1,682 @@
" "
" ██  ██ ██ ███  ███  ██ ███████  █████  ██  ██ ███████ ███████  ██████  ███  ███ ███████  "
" ██  ██ ██ ████  ████  ██ ██       ██   ██ ██  ██ ██      ██      ██    ██ ████  ████ ██       "
" ██  ██ ██ ██ ████ ██  ██ ███████  ███████ ██  █  ██ █████  ███████ ██  ██ ██ ████ ██ █████ "
"  ██  ██  ██ ██  ██  ██  ██      ██  ██   ██ ██ ███ ██ ██          ██ ██  ██ ██  ██  ██ ██ "
"  ████   ██ ██  ██  ██ ███████  ██  ██  ███ ███  ███████ ███████  ██████  ██  ██ ███████  "
" "
" Install Plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plug Manager
call plug#begin('~/.config/nvim/plug')
" let g:plug_url_format = 'https://gitee.com/%s.git'
let g:plug_url_format = 'git@gitee.com:%s.git'
" themes
Plug 'vim-plug-mirror/NeoSolarized'
Plug 'vim-plug-mirror/rainbow'
Plug 'vim-plug-mirror/vim-nerdtree-syntax-highlight'
" git
Plug 'vim-plug-mirror/vim-fugitive'
Plug 'vim-plug-mirror/vim-gitgutter'
" Plug 'vim-plug-mirror/ConflictMotions'
" auto complete
" Plug 'Valloric/YouCompleteMe'
Plug 'vim-plug-mirror/coc.nvim', {'branch': 'release'}
Plug 'vim-plug-mirror/auto-pairs'
Plug 'vim-plug-mirror/nvim-lspconfig'
" python dev
" Plug 'davidhalter/jedi-vim'
" show indent line
Plug 'vim-plug-mirror/indentLine'
Plug 'vim-plug-mirror/python-mode', { 'for': 'python', 'branch': 'main' }
" grammar check/highlight
Plug 'vim-plug-mirror/ale'
Plug 'vim-plug-mirror/vim-easy-align'
Plug 'vim-plug-mirror/vim-virtualenv'
Plug 'vim-plug-mirror/nerdcommenter'
" golang dev
Plug 'mirrors/vim-go'
" rust
Plug 'vim-plug-mirror/rust.vim'
" run :CocInstall coc-rust-analyzer after installation
" sh
Plug 'vim-plug-mirror/vim-shfmt', { 'for': 'sh' }
" hive sql
Plug 'vim-plug-mirror/hive.vim'
" Plug 'vim-plug-mirror/Vim'
" toml
Plug 'vim-plug-mirror/vim-toml'
" thrift
Plug 'vim-plug-mirror/thrift.vim'
" NERDTree
Plug 'vim-plug-mirror/nerdtree'
Plug 'vim-plug-mirror/nerdtree-git-plugin'
Plug 'vim-plug-mirror/vim-airline'
Plug 'vim-plug-mirror/vim-airline-themes'
" Plug 'vim-plug-mirror/vim-devicons'
" tools
Plug 'vim-plug-mirror/vim-startify'
Plug 'vim-plug-mirror/LeaderF'
Plug 'vim-plug-mirror/tagbar'
Plug 'vim-plug-mirror/ag.vim'
Plug 'vim-plug-mirror/vim-ripgrep'
" Plug 'epmatsw/ag.vim'
" Plug 'mileszs/ack.vim'
Plug 'vim-plug-mirror/FlyGrep.vim'
Plug 'vim-plug-mirror/incsearch.vim'
Plug 'vim-plug-mirror/vim-easymotion'
Plug 'vim-plug-mirror/undotree'
Plug 'vim-plug-mirror/vim-surround'
Plug 'vim-plug-mirror/vim-multiple-cursors'
Plug 'vim-plug-mirror/vim-better-whitespace'
Plug 'vim-plug-mirror/vim-cursorword'
Plug 'vim-plug-mirror/vim-interestingwords'
Plug 'vim-plug-mirror/vim-table-mode'
" snippets
Plug 'vim-plug-mirror/ultisnips'
Plug 'vim-plug-mirror/vim-snippets'
call plug#end()
" ----------------------------------------------------------------------------------------------------------------------
" basic config
set termguicolors
colorscheme NeoSolarized
set background=dark
set shortmess=atI
set backspace=indent,eol,start
set number " AKA nu
set relativenumber " AKA rnu
set ruler
set showcmd
set showmatch
set cursorline
syntax on
set incsearch " find as you type search
set hlsearch " highlight search terms
set winminheight=0 " windows can be 0 line high
set ignorecase " case insensitive search
set smartcase " case sensitive when uc present
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
set foldenable " auto fold code
set gdefault " the /g flag on :s substitutions by default
set clipboard+=unnamedplus
let g:solarized_termcolors=256
set encoding=utf-8
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
" set indent for most codes
set expandtab
set autoindent
set fileformat=unix
set tabstop=4
set softtabstop=4
set shiftwidth=4
set foldmethod=indent
set textwidth=120
" .py files
autocmd BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4
autocmd BufNewFile,BufRead *.yaml,*.yml,*.json,*.ps1,*.lua
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
autocmd FileType gitconfig
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4
autocmd FileType vim
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
" map <leader> to `,`, default '\'
let g:mapleader = ","
nnoremap ; :
nmap <leader>e :e $MYVIMRC<CR>
nmap <leader>r :so $MYVIMRC<CR>
" Remember to execute /usr/local/bin/python3 -m pip install neovim
if filereadable('/usr/local/bin/python3')
let g:python3_host_prog = '/usr/local/bin/python3'
else
let g:python3_host_prog = '/usr/bin/python3'
endif
let python_highlight_all = 1
" indentLine
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
let g:indentLine_fileTypeExclude = ['defx', 'denite', 'dashboard', 'tagbar', 'vista_kind', 'vista', 'startify', 'nerdtree', 'txt', 'log']
let g:indentLine_concealcursor = 'niv'
":verbose set conceallevel 查看哪个插件设置的值
autocmd FileType json,markdown let g:indentLine_conceallevel = 0
" ale config
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '--'
" for .hql files
autocmd BufNewFile,BufRead *.hql set filetype=hive expandtab
" for .q files
autocmd BufNewFile,BufRead *.q set filetype=hive expandtab
" ==# 大小写敏感的等于判断
" ==? 大小写不敏感的等于判断
" type :h exp4 to see more comparement
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
\ q :cclose<cr>:lclose<cr>
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
\ bd|
\ q | endif
" ----------------------------------------------------------------------------------------------------------------------
" startify
let s:header = [
\ '',
\ '',
\ '',
\' ██╗░░██╗░█████╗░██╗██╗░░░░░  ███╗░░░███╗███████╗░██████╗░░█████╗░████████╗██████╗░░█████╗░███╗░░██╗',
\' ██║░░██║██╔══██╗██║██║░░░░░  ████╗░████║██╔════╝██╔════╝░██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗████╗░██║',
\' ███████║███████║██║██║░░░░░  ██╔████╔██║█████╗░░██║░░██╗░███████║░░░██║░░░██████╔╝██║░░██║██╔██╗██║',
\' ██╔══██║██╔══██║██║██║░░░░░  ██║╚██╔╝██║██╔══╝░░██║░░╚██╗██╔══██║░░░██║░░░██╔══██╗██║░░██║██║╚████║',
\' ██║░░██║██║░░██║██║███████╗  ██║░╚═╝░██║███████╗╚██████╔╝██║░░██║░░░██║░░░██║░░██║╚█████╔╝██║░╚███║',
\' ╚═╝░░╚═╝╚═╝░░╚═╝╚═╝╚══════╝  ╚═╝░░░░░╚═╝╚══════╝░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░╚═╝░╚════╝░╚═╝░░╚══╝',
\ '',
\ '',
\ '',
\ ]
let s:footer = [
\ '',
\' ███████╗░█████╗░██████╗░  ░█████╗░██╗░░░██╗██████╗░███████╗██████╗░████████╗██████╗░░█████╗░███╗░░██╗',
\' ██╔════╝██╔══██╗██╔══██╗  ██╔══██╗╚██╗░██╔╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗████╗░██║',
\' █████╗░░██║░░██║██████╔╝  ██║░░╚═╝░╚████╔╝░██████╦╝█████╗░░██████╔╝░░░██║░░░██████╔╝██║░░██║██╔██╗██║',
\' ██╔══╝░░██║░░██║██╔══██╗  ██║░░██╗░░╚██╔╝░░██╔══██╗██╔══╝░░██╔══██╗░░░██║░░░██╔══██╗██║░░██║██║╚████║',
\' ██║░░░░░╚█████╔╝██║░░██║  ╚█████╔╝░░░██║░░░██████╦╝███████╗██║░░██║░░░██║░░░██║░░██║╚█████╔╝██║░╚███║',
\' ╚═╝░░░░░░╚════╝░╚═╝░░╚═╝  ░╚════╝░░░░╚═╝░░░╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░╚═╝░╚════╝░╚═╝░░╚══╝',
\ '',
\ ]
let g:startify_custom_header = startify#center(s:header)
let g:startify_custom_footer = startify#center(s:footer)
function! s:set_startify_left_padding() abort
let g:startify_padding_left = winwidth(0)/2 - 20
endfunction
autocmd! FileType startify
autocmd FileType startify set laststatus=0 showtabline=0
\| autocmd BufLeave <buffer> set laststatus=2 showtabline=2
autocmd User Startified setlocal buflisted
" autocmd VimEnter * call s:set_startify_left_padding()
" plugins config
" NERDTree
" open a NERDTree automatically when vim starts up
" autocmd VimEnter * NERDTree
" place the cursor in the editor
autocmd VimEnter * wincmd w
" open a NERDTree automatically when vim starts up if no files were specified
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" close vim when the only left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
map <leader>t :NERDTreeToggle<CR>
" locate current file
map <leader>l :NERDTreeFind<cr>
" Change default arrows
" let g:NERDTreeDirArrowExpandable = '📁'
" let g:NERDTreeDirArrowCollapsible = '📂'
let g:NERDTreeDirArrowExpandable = '|+|'
let g:NERDTreeDirArrowCollapsible = '|-|'
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
" display row number in NERDTree
" let NERDTreeShowLineNumbers = 1
" set width
" let NERDTreeWinSize=20
let NERDTreeIgnore = ['\.pyc$', '\.pyo$', '\~$', '__pycache__$[[dir]]', '\.swp$', 'node_modules']
" close rainbow in nerdtree
let g:rainbow_conf = {
\ 'separately': {
\ 'nerdtree': 0
\ }
\}
" airline settings.
let g:airline_theme = 'solarized'
let g:airline_solarized_bg='dark'
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.maxlinenr = '㏑'
" show absolute file path in status line
let g:airline_section_c = '%<%F%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#'
" show tab number in tab line
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#formatter = 'default'
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
let g:airline#extensions#bufferline#enabled = 1
" leaderF config
let g:Lf_ShortcutF = "<leader>ff"
noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR>
noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR>
noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
" let g:Lf_WindowPosition = 'popup'
" 禁用缓存
let g:Lf_UseCache = 0
let g:Lf_UseVersionControlTool = 0
let g:Lf_UseMemoryCache = 0
let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "DejaVu Sans Mono for Powerline" }
let g:Lf_PreviewResult = {'Function': 1, 'BufTag': 0, 'File': 1 }
" 设置项目根目录模式
let g:Lf_WorkingDirectoryMode = 'AF'
let g:Lf_RootMarkers = ['.git', '.svn', '.hg', '.project', '.root']
" autocmd BufNewFile,BufRead X:/yourdir* let g:Lf_WildIgnore={'file':['*.vcproj', '*.vcxproj'],'dir':[]}
let g:Lf_WildIgnore={
\ 'file':['*.vcproj', '*.vcxproj', '*.exe', '*.so', '*.sw?', '*.o', '*.py[co]'],
\ 'dir':['.git', '.node_modules', '.hg',]
\ }
let g:Lf_StlColorscheme = 'powerline'
if has('nvim')
let s:cachedir = expand(stdpath('cache'))
let s:configdir = expand(stdpath('config'))
else
"vim will share same folder with nvim
if has('win32')
let s:cachedir = expand('~/AppData/Local/Temp/cache/nvim')
let s:configdir = expand('~/AppData/Local/nvim')
else
let s:cachedir = expand('~/.cache/nvim')
let s:configdir = expand('~/.config/nvim')
endif
endif
let g:Lf_CacheDirectory = s:cachedir
" YCM configs
" let g:ycm_autoclose_preview_window_after_completion = 1
" let g:ycm_key_invoke_completion = '<C-z>'
" let g:ycm_min_num_identifier_candidate_chars = 2
" 屏蔽 YCM 的诊断信息
" let g:ycm_show_diagnostics_ui = 0
" let g:ycm_collect_identifiers_from_comments_and_strings = 0
let g:rainbow_active = 1
" devicons config
if exists("g:loaded_webdevicons")
call webdevicons#refresh()
endif
let g:airline_powerline_fonts = 1
let g:webdevicons_enable_vimfiler = 0
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 0
" Tagbar
" map <C-m> :TagbarToggle<CR>
" nerdtree highlighting
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
" fugitive
" this makes Gdiff uses vertical spilter
set diffopt+=vertical
" gitgutter
let g:gitgutter_sign_modified = '>'
let g:gitgutter_sign_modified_removed = '>_'
" better whitespace config: do not show whitespace when open the following file types
let g:better_whitespace_filetypes_blacklist=['<etc>', 'startify', 'diff', 'git',
\ 'gitcommit', 'unite', 'qf', 'help', 'markdown', 'fugitive']
" NERDCommenter
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1
" easy align
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" for ack
" if executable('ag')
" let g:ackprg = 'ag --vimgrep'
" endif
" shfmt
let g:shfmt_fmt_on_save = 1
let g:shfmt_extra_args = '-i 4'
" vim-multiple-cursors
let g:multi_cursor_use_default_mapping = 0
" Default mapping
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
" let g:multi_cursor_start_word_key = '<C-n>'
" vim-table-mode configs
let g:table_mode_corner='|'
function! s:isAtStartOfLine(mapping)
let text_before_cursor = getline('.')[0 : col('.')-1]
let mapping_pattern = '\V' . escape(a:mapping, '\')
let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
endfunction
inoreabbrev <expr> <bar><bar>
\ <SID>isAtStartOfLine('\|\|') ?
\ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
inoreabbrev <expr> __
\ <SID>isAtStartOfLine('__') ?
\ '<c-o>:silent! TableModeDisable<cr>' : '__'
" nvim coc configs
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
" inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<TAB>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>F <Plug>(coc-format-selected)
nmap <leader>F <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
" Trail blank characters of EOL
map <leader><space> :FixWhitespace<CR>
" coc rust-analyzer config
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
let g:ale_linters = {'rust': ['analyzer']}
" pymode settings
let g:pymode = 1
let g:pymode_trim_whitespaces = 1
let g:pymode_options_max_line_length = 120
let g:pymode_lint_options_pep8 =
\ {'max_line_length': g:pymode_options_max_line_length}
let g:pymode_rope = 1
let g:pymode_rope_refix = '<C-c>'
let g:pymode_lint_cwindow = 0
set completeopt=menuone,noinsert
let g:pymode_rope_completion = 1
let g:pymode_rope_complete_on_dot = 1
let g:pymode_rope_autoimport_modules = ['os', 'shutil', 'datetime']
" Find definition
let g:pymode_rope_goto_definition_bind = '<C-c>g'
let g:pymode_rope_goto_definition_cmd = 'new'
" vim snippets
" Trigger configuration. You need to change this to something other than <tab> if you use one of the following:
" - https://github.com/Valloric/YouCompleteMe
" - https://github.com/nvim-lua/completion-nvim
let g:UltiSnipsExpandTrigger="<cr>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

564
config/nvim.v1/init.vim Normal file
View File

@ -0,0 +1,564 @@
" "
" ██  ██ ██ ███  ███  ██ ███████  █████  ██  ██ ███████ ███████  ██████  ███  ███ ███████  "
" ██  ██ ██ ████  ████  ██ ██       ██   ██ ██  ██ ██      ██      ██    ██ ████  ████ ██       "
" ██  ██ ██ ██ ████ ██  ██ ███████  ███████ ██  █  ██ █████  ███████ ██  ██ ██ ████ ██ █████ "
"  ██  ██  ██ ██  ██  ██  ██      ██  ██   ██ ██ ███ ██ ██          ██ ██  ██ ██  ██  ██ ██ "
"  ████   ██ ██  ██  ██ ███████  ██  ██  ███ ███  ███████ ███████  ██████  ██  ██ ███████  "
" "
" Install Plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plug Manager
call plug#begin('~/.config/nvim/plug')
" themes
Plug 'iCyMind/NeoSolarized'
Plug 'luochen1990/rainbow'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" auto complete
" Plug 'Valloric/YouCompleteMe'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jiangmiao/auto-pairs'
Plug 'neovim/nvim-lspconfig'
" python dev
" Plug 'davidhalter/jedi-vim'
" show indent line
Plug 'Yggdroot/indentLine'
Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
" grammar check/highlight
Plug 'w0rp/ale'
Plug 'junegunn/vim-easy-align'
Plug 'plytophogy/vim-virtualenv'
Plug 'scrooloose/nerdcommenter'
" golang dev
Plug 'fatih/vim-go'
" rust
Plug 'rust-lang/rust.vim'
" run :CocInstall coc-rust-analyzer after installation
" sh
Plug 'z0mbix/vim-shfmt', { 'for': 'sh' }
" hive sql
Plug 'autowitch/hive.vim'
Plug 'JessicaKMcIntosh/Vim'
" toml
Plug 'cespare/vim-toml'
" thrift
Plug 'solarnz/thrift.vim'
" NERDTree
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
" tools
Plug 'mhinz/vim-startify'
Plug 'Yggdroot/LeaderF'
Plug 'majutsushi/tagbar'
Plug 'astroshot/ag.vim'
Plug 'astroshot/vim-ripgrep'
" Plug 'epmatsw/ag.vim'
" Plug 'mileszs/ack.vim'
Plug 'wsdjeg/FlyGrep.vim'
Plug 'haya14busa/incsearch.vim'
Plug 'easymotion/vim-easymotion'
Plug 'mbbill/undotree'
Plug 'tpope/vim-surround'
Plug 'terryma/vim-multiple-cursors'
Plug 'ntpeters/vim-better-whitespace'
Plug 'itchyny/vim-cursorword'
Plug 'lfv89/vim-interestingwords'
Plug 'dhruvasagar/vim-table-mode'
call plug#end()
" ----------------------------------------------------------------------------------------------------------------------
" basic config
set termguicolors
colorscheme NeoSolarized
set background=dark
set shortmess=atI
set backspace=indent,eol,start
set number " AKA nu
set relativenumber " AKA rnu
set ruler
set showcmd
set showmatch
set cursorline
syntax on
set incsearch " find as you type search
set hlsearch " highlight search terms
set winminheight=0 " windows can be 0 line high
set ignorecase " case insensitive search
set smartcase " case sensitive when uc present
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
set foldenable " auto fold code
set gdefault " the /g flag on :s substitutions by default
set clipboard+=unnamedplus
let g:solarized_termcolors=256
set encoding=utf-8
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
" set indent for most codes
set expandtab
set autoindent
set fileformat=unix
set tabstop=4
set softtabstop=4
set shiftwidth=4
set foldmethod=indent
set textwidth=120
" .py files
autocmd BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4
autocmd BufNewFile,BufRead *.yaml,*.yml,*.json,*.ps1
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
autocmd FileType gitconfig
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4
autocmd FileType vim
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
" map <leader> to `,`, default '\'
let g:mapleader = ","
nnoremap ; :
nmap <leader>e :e $MYVIMRC<CR>
nmap <leader>r :so $MYVIMRC<CR>
" Remember to execute /usr/local/bin/python3 -m pip install neovim
if filereadable('/usr/local/bin/python3')
let g:python3_host_prog = '/usr/local/bin/python3'
else
let g:python3_host_prog = '/usr/bin/python3'
endif
let python_highlight_all = 1
" indentLine
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
let g:indentLine_fileTypeExclude = ['defx', 'denite', 'dashboard', 'tagbar', 'vista_kind', 'vista', 'startify', 'nerdtree', 'txt']
let g:indentLine_concealcursor = 'niv'
autocmd FileType json,markdown let g:indentLine_conceallevel = 0
" ale config
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '--'
" for .hql files
autocmd BufNewFile,BufRead *.hql set filetype=hive expandtab
" for .q files
autocmd BufNewFile,BufRead *.q set filetype=hive expandtab
" ==# 大小写敏感的等于判断
" ==? 大小写不敏感的等于判断
" type :h exp4 to see more comparement
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
\ q :cclose<cr>:lclose<cr>
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
\ bd|
\ q | endif
" ----------------------------------------------------------------------------------------------------------------------
" startify
let s:header = [
\ '',
\ ' __ __________ __ ____ _____ __ ______ ________ ___ _____ _ ________ ',
\ ' / / / / ____/ / / / / __ \ / ___// / / / __ \/ ____/ //_/ | / / | | / / ____/ ',
\ ' / /_/ / __/ / / / / / / / / \__ \/ /_/ / / / / / / ,< | | /| / / /| | | / / __/ ',
\ ' / __ / /___/ /___/ /___/ /_/ / ___/ / __ / /_/ / /___/ /| | | |/ |/ / ___ | |/ / /___ ',
\ ' /_/ /_/_____/_____/_____/\____/ /____/_/ /_/\____/\____/_/ |_| |__/|__/_/ |_|___/_____/ ',
\ '',
\ ]
let s:footer = [
\ '',
\ ' ██ █ █ ▄ █ ██ ▄█ █ █▀▄▀█ ▄███▄ ▄▀ ██ ▄▄▄▄▀ █▄▄▄▄ ████▄ ▄ ',
\ ' █ █ █ █ █ █ █ █ ██ █ █ █ █ █▀ ▀ ▄▀ █ █ ▀▀▀ █ █ ▄▀ █ █ █ ',
\ ' █▄▄█ █ █ ██▀▀█ █▄▄█ ██ █ █ ▄ █ ██▄▄ █ ▀▄ █▄▄█ █ █▀▀▌ █ █ ██ █ ',
\ ' █ █ ███▄ ███▄ █ █ █ █ ▐█ ███▄ █ █ █▄ ▄▀ █ █ █ █ █ █ █ ▀████ █ █ █ ',
\ ' █ ▀ ▀ █ █ ▐ ▀ █ ▀███▀ ███ █ ▀ █ █ █ █ ',
\ ' █ ▀ █ ▀ █ ▀ █ ██ ',
\ ' ▀ ▀ ▀ ',
\ '',
\ ]
let g:startify_custom_header = startify#center(s:header)
let g:startify_custom_footer = startify#center(s:footer)
function! s:set_startify_left_padding() abort
let g:startify_padding_left = winwidth(0)/2 - 20
endfunction
autocmd! FileType startify
autocmd FileType startify set laststatus=0 showtabline=0
\| autocmd BufLeave <buffer> set laststatus=2 showtabline=2
autocmd User Startified setlocal buflisted
" autocmd VimEnter * call s:set_startify_left_padding()
" plugins config
" NERDTree
" open a NERDTree automatically when vim starts up
" autocmd VimEnter * NERDTree
" place the cursor in the editor
autocmd VimEnter * wincmd w
" open a NERDTree automatically when vim starts up if no files were specified
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" close vim when the only left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
map <leader>t :NERDTreeToggle<CR>
" locate current file
map <leader>l :NERDTreeFind<cr>
" display row number in NERDTree
" let NERDTreeShowLineNumbers = 1
" set width
" let NERDTreeWinSize=20
let NERDTreeIgnore = ['\.pyc$', '\.pyo$', '\~$', '__pycache__$[[dir]]', '\.swp$']
" close rainbow in nerdtree
let g:rainbow_conf = {
\ 'separately': {
\ 'nerdtree': 0
\ }
\}
" airline settings.
let g:airline_theme = 'solarized'
let g:airline_solarized_bg='dark'
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.maxlinenr = '㏑'
" show absolute file path in status line
let g:airline_section_c = '%<%F%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#'
" show tab number in tab line
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#formatter = 'default'
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
let g:airline#extensions#bufferline#enabled = 1
" leaderF config
let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "DejaVu Sans Mono for Powerline" }
let g:Lf_PreviewResult = {'Function': 1, 'BufTag': 0, 'File': 1 }
let g:LF_NormalMap = {
\ "File": [[ "u", ':LeaderfFile ..<CR>' ]]
\}
" YCM configs
" let g:ycm_autoclose_preview_window_after_completion = 1
" let g:ycm_key_invoke_completion = '<C-z>'
" let g:ycm_min_num_identifier_candidate_chars = 2
" 屏蔽 YCM 的诊断信息
" let g:ycm_show_diagnostics_ui = 0
" let g:ycm_collect_identifiers_from_comments_and_strings = 0
let g:rainbow_active = 1
" devicons config
if exists("g:loaded_webdevicons")
call webdevicons#refresh()
endif
let g:airline_powerline_fonts = 1
let g:webdevicons_enable_vimfiler = 0
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 0
" Tagbar
" map <C-m> :TagbarToggle<CR>
" nerdtree highlighting
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
" fugitive
" this makes Gdiff uses vertical spilter
set diffopt+=vertical
" gitgutter
let g:gitgutter_sign_modified = '>'
let g:gitgutter_sign_modified_removed = '>_'
" better whitespace config: do not show whitespace when open the following file types
let g:better_whitespace_filetypes_blacklist=['<etc>', 'startify', 'diff', 'git',
\ 'gitcommit', 'unite', 'qf', 'help', 'markdown', 'fugitive']
" NERDCommenter
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1
" easy align
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" for ack
" if executable('ag')
" let g:ackprg = 'ag --vimgrep'
" endif
" shfmt
let g:shfmt_fmt_on_save = 1
let g:shfmt_extra_args = '-i 4'
" vim-multiple-cursors
let g:multi_cursor_use_default_mapping = 0
" Default mapping
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
" let g:multi_cursor_start_word_key = '<C-n>'
" vim-table-mode configs
let g:table_mode_corner='|'
function! s:isAtStartOfLine(mapping)
let text_before_cursor = getline('.')[0 : col('.')-1]
let mapping_pattern = '\V' . escape(a:mapping, '\')
let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
endfunction
inoreabbrev <expr> <bar><bar>
\ <SID>isAtStartOfLine('\|\|') ?
\ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
inoreabbrev <expr> __
\ <SID>isAtStartOfLine('__') ?
\ '<c-o>:silent! TableModeDisable<cr>' : '__'
" nvim coc configs
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>F <Plug>(coc-format-selected)
nmap <leader>F <Plug>(coc-format-selected)
augroup js_group
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType js,typescript,json setlocal formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current line.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Introduce function text object
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <TAB> for selections ranges.
" NOTE: Requires 'textDocument/selectionRange' support from the language server.
" coc-tsserver, coc-python are the examples of servers that support it.
nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Mappings using CoCList:
" Show all diagnostics.
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
" Trail blank characters of EOL
map <leader><space> :FixWhitespace<CR>
" coc rust-analyzer config
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
let g:ale_linters = {'rust': ['analyzer']}
" pymode settings
let g:pymode_options_max_line_length = 120
let g:pymode_lint_options_pep8 =
\ {'max_line_length': g:pymode_options_max_line_length}
let g:pymode_lint_cwindow = 0

View File

@ -0,0 +1,3 @@
vim.g.ale_sign_error = ''
vim.g.ale_sign_warning = '--'
vim.g.ale_linters = { rust = {'analyzer'} }

View File

@ -0,0 +1,181 @@
vim.cmd([[
" nvim coc configs
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
" inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<TAB>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>F <Plug>(coc-format-selected)
nmap <leader>F <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
" Trail blank characters of EOL
map <leader><space> :FixWhitespace<CR>
" coc rust-analyzer config
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
let g:ale_linters = {'rust': ['analyzer']}
]])

View File

@ -0,0 +1,9 @@
-- fugitive
vim.opt.diffopt = vim.opt.diffopt + { vertical = true }
-- gitgutter
vim.g.gitgutter_sign_modified = '>'
vim.g.gitgutter_sign_modified_removed = '>_'
-- better whitespace config: do not show whitespace when open the following file types
vim.g.better_whitespace_filetypes_blacklist = {'<etc>', 'startify', 'diff', 'git', 'gitcommit', 'unite', 'qf', 'help', 'markdown', 'fugitive'}

Some files were not shown because too many files have changed in this diff Show More