Compare commits
1 Commits
main
...
powershell
Author | SHA1 | Date |
---|---|---|
|
6d210e04e3 |
|
@ -1,15 +0,0 @@
|
||||||
# anno
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```java
|
|
||||||
CheckRsaSign checkRsaSign = AnnotatedElementUtils.findMergedAnnotation(method, CheckRsaSign.class);
|
|
||||||
|
|
||||||
if (checkRsaSign == null) {
|
|
||||||
checkRsaSign = AnnotatedElementUtils.findMergedAnnotation(method.getDeclaringClass(), CheckRsaSign.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkRsaSign == null || !checkRsaSign.required()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
```
|
|
148
article/pg.md
148
article/pg.md
|
@ -96,151 +96,3 @@ oid extname extowner extnamespace extrelocatable extversion extcon
|
||||||
16389 pg_walinspect 10 2200 True 1.1 <null> <null>
|
16389 pg_walinspect 10 2200 True 1.1 <null> <null>
|
||||||
SELECT 2
|
SELECT 2
|
||||||
```
|
```
|
||||||
|
|
||||||
## 主从搭建
|
|
||||||
|
|
||||||
使用的 pg 版本:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# [16:44:05 ~/PgDev/pg14] ➜ bin/psql --version
|
|
||||||
psql (PostgreSQL) 14.7
|
|
||||||
```
|
|
||||||
|
|
||||||
创建复制用户:
|
|
||||||
```psql
|
|
||||||
create user repuser with replication login password '123456';
|
|
||||||
```
|
|
||||||
|
|
||||||
配置好主库后,备份基础数据:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bin/pg_basebackup -h 127.0.0.1 -p 5532 -U repuser -R -P -v -C --slot=replica -D replica
|
|
||||||
```
|
|
||||||
|
|
||||||
然后启动从库:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bin/pg_ctl -D replica -l replica.log start
|
|
||||||
```
|
|
||||||
|
|
||||||
## 例子
|
|
||||||
|
|
||||||
```sql
|
|
||||||
insert into "user" (id, name, email, phone, status)
|
|
||||||
values
|
|
||||||
(default, 'Mario', 'mario@test.com', '12345678989', 1);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
联表更新
|
|
||||||
|
|
||||||
```sql
|
|
||||||
update abnormal_record a
|
|
||||||
set record_type_code = h.record_type_code from health_record h
|
|
||||||
where
|
|
||||||
a.health_record_id = h.id
|
|
||||||
and a.record_type_code = 0;
|
|
||||||
```
|
|
||||||
|
|
||||||
## 在低版本Linux系统中运行pgcli
|
|
||||||
|
|
||||||
自行编译 postgres 14 源代码,并安装,默认安装路径为 `/usr/local/pgsql`
|
|
||||||
|
|
||||||
## 安装
|
|
||||||
|
|
||||||
用 conda 安装
|
|
||||||
|
|
||||||
```bash
|
|
||||||
conda create -n pgcli
|
|
||||||
conda activate pgcli
|
|
||||||
pip install pgcli
|
|
||||||
```
|
|
||||||
|
|
||||||
## 运行
|
|
||||||
|
|
||||||
安装完后不能运行,因为 `LD_LIBRARY_PATH` 变量需要设置,新建脚本为 pcli:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/bash
|
|
||||||
GLIBC=/opt/glibc-2.14
|
|
||||||
PG_HOME=/usr/local/pgsql
|
|
||||||
export LD_LIBRARY_PATH=$GLIBC/lib:$PG_HOME/lib:$LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
$HOME/.local/anaconda3/bin/pgcli $*
|
|
||||||
```
|
|
||||||
|
|
||||||
将新的 glibc 路径和 pgsql 的库加入环境变量即可。
|
|
||||||
|
|
||||||
将 pcli 的模式改为可执行并加入环境变量 `PATH`,即可通过运行 `pcli -h xxxxxx -U work -p xxxx -d db` 连接到数据库。
|
|
||||||
|
|
||||||
|
|
||||||
## pg_walinspect
|
|
||||||
|
|
||||||
读取 wal 文件需要为用户赋权 pg_read_server_files:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
grant pg_read_server_files to role_name;
|
|
||||||
```
|
|
||||||
|
|
||||||
## WAL
|
|
||||||
|
|
||||||
### 批量更新
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
# PostgreSQL ezio@127.0.0.1:5532/boot_demo ➜ select * from empsalary;
|
|
||||||
id depname empno salary
|
|
||||||
-- -------- ----- -------
|
|
||||||
1 develop 11 5200.00
|
|
||||||
2 develop 7 4200.00
|
|
||||||
3 develop 9 4500.00
|
|
||||||
4 develop 8 6000.00
|
|
||||||
5 develop 10 5200.00
|
|
||||||
6 personal 5 3500.00
|
|
||||||
7 personal 2 3900.00
|
|
||||||
8 sales 3 4800.00
|
|
||||||
9 sales 1 5000.00
|
|
||||||
10 sales 4 4800.00
|
|
||||||
SELECT 10
|
|
||||||
Time: 0.065s
|
|
||||||
```
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
pg_current_wal_lsn
|
|
||||||
------------------
|
|
||||||
0/1B46E10
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
执行 `update empsalary set salary = 6000` 后做 waldump
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
# [08:23:38 ~/deploy/PgDev/pg16] $ bin/pg_waldump -s '0/1B46E10' master/pg_wal/000000010000000000000001 -e '0/1B473E8'
|
|
||||||
rmgr: Heap len (rec/tot): 65/ 749, tx: 810, lsn: 0/01B46E10, prev 0/01B46DD8, desc: HOT_UPDATE old_xmax: 810, old_off: 1, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 11, blkref #0: rel 1663/16412/16414 blk 0 FPW
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B47100, prev 0/01B46E10, desc: HOT_UPDATE old_xmax: 810, old_off: 2, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 12, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B47148, prev 0/01B47100, desc: HOT_UPDATE old_xmax: 810, old_off: 3, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 13, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 68/ 68, tx: 810, lsn: 0/01B47190, prev 0/01B47148, desc: HOT_UPDATE old_xmax: 810, old_off: 4, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 14, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B471D8, prev 0/01B47190, desc: HOT_UPDATE old_xmax: 810, old_off: 5, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 15, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B47220, prev 0/01B471D8, desc: HOT_UPDATE old_xmax: 810, old_off: 6, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 16, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B47268, prev 0/01B47220, desc: HOT_UPDATE old_xmax: 810, old_off: 7, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 17, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B472B0, prev 0/01B47268, desc: HOT_UPDATE old_xmax: 810, old_off: 8, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 18, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B472F8, prev 0/01B472B0, desc: HOT_UPDATE old_xmax: 810, old_off: 9, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 19, blkref #0: rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Heap len (rec/tot): 70/ 70, tx: 810, lsn: 0/01B47340, prev 0/01B472F8, desc: HOT_UPDATE old_xmax: 810, old_off: 10, old_infobits: [], flags: 0x20, new_xmax: 0, new_off: 20, blkref #0:rel 1663/16412/16414 blk 0
|
|
||||||
rmgr: Transaction len (rec/tot): 34/ 34, tx: 810, lsn: 0/01B47388, prev 0/01B47340, desc: COMMIT 2025-07-19 08:31:23.524574 CST
|
|
||||||
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 0/01B473B0, prev 0/01B47388, desc: RUNNING_XACTS nextXid 811 latestCompletedXid 810 oldestRunningXid 811
|
|
||||||
```
|
|
||||||
|
|
||||||
可以看到批量更新时每一行数据都产生了一个XLog。
|
|
||||||
|
|
||||||
```sql
|
|
||||||
create table employee (
|
|
||||||
id bigserial not null,
|
|
||||||
name varchar(20) not null default '',
|
|
||||||
create_at timestamptz not null default current_timestamp,
|
|
||||||
update_at timestamptz not null default current_timestamp,
|
|
||||||
primary key (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into employee (name)
|
|
||||||
values
|
|
||||||
('Jim');
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "Vimium C",
|
"name": "Vimium C",
|
||||||
"@time": "2025/7/29 09:14:38",
|
"@time": "2024/1/5 16:09:29",
|
||||||
"time": 1753751678177,
|
"time": 1704442169093,
|
||||||
"environment": {
|
"environment": {
|
||||||
"extension": "2.12.3",
|
"extension": "1.99.997",
|
||||||
"platform": "win",
|
"platform": "win",
|
||||||
"firefox": 140
|
"firefox": 115
|
||||||
},
|
},
|
||||||
"exclusionRules": [
|
"exclusionRules": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
set debuginfod enabled on
|
|
||||||
|
|
||||||
# 保存历史命令
|
|
||||||
set history filename ~/.gdb_history
|
|
||||||
set history save on
|
|
||||||
|
|
||||||
# 退出时不显示提示信息
|
|
||||||
set confirm off
|
|
||||||
|
|
||||||
# 按照派生类型打印对象
|
|
||||||
set print object on
|
|
||||||
|
|
||||||
# 打印数组的索引下标
|
|
||||||
set print array-indexes on
|
|
||||||
|
|
||||||
# 每行打印一个结构体成员
|
|
||||||
set print pretty on
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ configs.setup({
|
||||||
'powershell',
|
'powershell',
|
||||||
'rust',
|
'rust',
|
||||||
'toml',
|
'toml',
|
||||||
-- 'vim',
|
'vim',
|
||||||
-- 'vimdoc',
|
'vimdoc',
|
||||||
'sql',
|
'sql',
|
||||||
'yaml',
|
'yaml',
|
||||||
},
|
},
|
||||||
|
|
|
@ -69,7 +69,6 @@ local plugins = {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
branch = "master",
|
|
||||||
lazy = false,
|
lazy = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# If not running interactively, don't do anything
|
# If not running interactively, don't do anything
|
||||||
# [[ $- != *i* ]] && return
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
# check shell config
|
|
||||||
case $- in
|
|
||||||
*i*) ;; # interactive shell
|
|
||||||
*) return;; # do nothing
|
|
||||||
esac
|
|
||||||
|
|
||||||
# PS1='[\u@\h \W]\$ '
|
# PS1='[\u@\h \W]\$ '
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,6 @@ local-postgres = postgresql://postgres@127.0.0.1:5432
|
||||||
local = postgresql://admin:gsEoWPxkWqHQMk3sK*2J@127.0.0.1:5432/test
|
local = postgresql://admin:gsEoWPxkWqHQMk3sK*2J@127.0.0.1:5432/test
|
||||||
pg14-master = postgresql://ezio@127.0.0.1:5532/postgres
|
pg14-master = postgresql://ezio@127.0.0.1:5532/postgres
|
||||||
pg14-replica = postgresql://ezio@127.0.0.1:5533/postgres
|
pg14-replica = postgresql://ezio@127.0.0.1:5533/postgres
|
||||||
pg16-master = postgresql://postgres@127.0.0.1:5532/postgres
|
|
||||||
|
|
||||||
# Format for number representation
|
# Format for number representation
|
||||||
# for decimal "d" - 12345678, ",d" - 12,345,678
|
# for decimal "d" - 12345678, ",d" - 12,345,678
|
||||||
|
|
|
@ -50,10 +50,6 @@ if (!$IsPWCore) {
|
||||||
Write-Host $msg -ForegroundColor DarkYellow
|
Write-Host $msg -ForegroundColor DarkYellow
|
||||||
}
|
}
|
||||||
|
|
||||||
# $script:msg = "PSScriptRoot: {0}" -f $PSScriptRoot
|
|
||||||
# PSScriptRoot: D:\Document\PowerShell
|
|
||||||
# Write-Host $msg
|
|
||||||
|
|
||||||
# Remove conflict aliases
|
# Remove conflict aliases
|
||||||
Remove-Item Alias:type -Force -ErrorAction SilentlyContinue
|
Remove-Item Alias:type -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item Alias:gc -Force -ErrorAction SilentlyContinue # Get-Content
|
Remove-Item Alias:gc -Force -ErrorAction SilentlyContinue # Get-Content
|
||||||
|
@ -99,8 +95,6 @@ if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
||||||
# Import-Module ZLocation
|
# Import-Module ZLocation
|
||||||
|
|
||||||
Import-Module PSReadLine
|
Import-Module PSReadLine
|
||||||
# Import-Module "$PSScriptRoot\venv\venv.psm1"
|
|
||||||
|
|
||||||
# Auto complete
|
# Auto complete
|
||||||
Set-PSReadlineOption -EditMode Emacs
|
Set-PSReadlineOption -EditMode Emacs
|
||||||
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
|
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
|
||||||
|
@ -1223,50 +1217,3 @@ function StopAllGitProcesses {
|
||||||
Stop-Process $p.Id
|
Stop-Process $p.Id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# $UserShell = $(Get-ChildItem "HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer")
|
|
||||||
# $Folders = $UserShell.Get(34)
|
|
||||||
# $DocPlace = $Folders.GetValue("Personal")
|
|
||||||
# $VenvPath = Join-Path -Path $DocPlace -ChildPath "Pyvenv"
|
|
||||||
$VenvPath = Join-Path -Path $Home -ChildPath "Pyvenv"
|
|
||||||
|
|
||||||
function CheckOrCreate($PathName) {
|
|
||||||
$PathExists = $(Test-Path $PathName)
|
|
||||||
if ($PathExists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
New-Item $PathName -ItemType Directory
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckOrCreate($VenvPath)
|
|
||||||
|
|
||||||
function lsvenv() {
|
|
||||||
Get-ChildItem $VenvPath
|
|
||||||
}
|
|
||||||
|
|
||||||
function mkvenv($name) {
|
|
||||||
$VenvNamePath = Join-Path -Path $VenvPath -ChildPath $name
|
|
||||||
CheckOrCreate($VenvNamePath)
|
|
||||||
python -m venv $VenvNamePath
|
|
||||||
}
|
|
||||||
|
|
||||||
function rmvenv($name) {
|
|
||||||
$VenvNamePath = Join-Path -Path $VenvPath -ChildPath $name
|
|
||||||
$PathExists = $(Test-Path $VenvNamePath)
|
|
||||||
if (-not $PathExists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Remove-Item $VenvNamePath -Recurse
|
|
||||||
}
|
|
||||||
|
|
||||||
function workon($name) {
|
|
||||||
$VenvNamePath = Join-Path -Path $VenvPath -ChildPath $name
|
|
||||||
$VenvScripts = Join-Path -Path $VenvNamePath -ChildPath "Scripts"
|
|
||||||
$VenvActive = Join-Path -Path $VenvScripts -ChildPath "Activate.ps1"
|
|
||||||
$PathExists = $(Test-Path $VenvNamePath)
|
|
||||||
if (-not $PathExists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
& $VenvActive
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
$UserShell = $(Get-ChildItem "HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer")
|
# You can create a SymbolicLink for $Home\Pyvenv
|
||||||
$Folders = $UserShell.Get(34)
|
# New-Item -Path .\Pyvenv -ItemType SymbolicLink -Target E:\Documents\Pyvenv
|
||||||
$DocPlace = $Folders.GetValue("Personal")
|
#
|
||||||
$VenvPath = Join-Path -Path $DocPlace -ChildPath "Pyvenv"
|
$VenvPath = Join-Path -Path $Home -ChildPath "Pyvenv"
|
||||||
|
|
||||||
function CheckOrCreate($PathName) {
|
function CheckOrCreate($PathName) {
|
||||||
$PathExists = $(Test-Path $PathName)
|
$PathExists = $(Test-Path $PathName)
|
||||||
|
@ -42,4 +42,4 @@ function workon($name) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
& $VenvActive
|
& $VenvActive
|
||||||
}
|
}
|
|
@ -1,48 +0,0 @@
|
||||||
# $UserShell = $(Get-ChildItem "HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer")
|
|
||||||
# $Folders = $UserShell.Get(34)
|
|
||||||
# $DocPlace = $Folders.GetValue("Personal")
|
|
||||||
# $VenvPath = Join-Path -Path $DocPlace -ChildPath "Pyvenv"
|
|
||||||
$VenvPath = Join-Path -Path $Home -ChildPath "Pyvenv"
|
|
||||||
|
|
||||||
function CheckOrCreate($PathName) {
|
|
||||||
$PathExists = $(Test-Path $PathName)
|
|
||||||
if ($PathExists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
New-Item $PathName -ItemType Directory
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckOrCreate($VenvPath)
|
|
||||||
|
|
||||||
function lsvenv() {
|
|
||||||
Get-ChildItem $VenvPath
|
|
||||||
}
|
|
||||||
|
|
||||||
function mkvenv($name) {
|
|
||||||
$VenvNamePath = Join-Path -Path $VenvPath -ChildPath $name
|
|
||||||
CheckOrCreate($VenvNamePath)
|
|
||||||
python -m venv $VenvNamePath
|
|
||||||
}
|
|
||||||
|
|
||||||
function rmvenv($name) {
|
|
||||||
$VenvNamePath = Join-Path -Path $VenvPath -ChildPath $name
|
|
||||||
$PathExists = $(Test-Path $VenvNamePath)
|
|
||||||
if (-not $PathExists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Remove-Item $VenvNamePath -Recurse
|
|
||||||
}
|
|
||||||
|
|
||||||
function workon($name) {
|
|
||||||
$VenvNamePath = Join-Path -Path $VenvPath -ChildPath $name
|
|
||||||
$VenvScripts = Join-Path -Path $VenvNamePath -ChildPath "Scripts"
|
|
||||||
$VenvActive = Join-Path -Path $VenvScripts -ChildPath "Activate.ps1"
|
|
||||||
$PathExists = $(Test-Path $VenvNamePath)
|
|
||||||
if (-not $PathExists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
& $VenvActive
|
|
||||||
}
|
|
||||||
|
|
||||||
Export-ModuleMember -Function @("lsvenv", "mkvenv", "rmvenv", "workon")
|
|
|
@ -1,59 +0,0 @@
|
||||||
REGEDIT4
|
|
||||||
|
|
||||||
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]
|
|
||||||
|
|
||||||
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions]
|
|
||||||
|
|
||||||
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
|
|
||||||
"Colour0"="131,148,150"
|
|
||||||
"Colour1"="147,161,161"
|
|
||||||
"Colour2"="0,43,54"
|
|
||||||
"Colour3"="7,54,66"
|
|
||||||
"Colour4"="0,43,54"
|
|
||||||
"Colour5"="238,232,213"
|
|
||||||
"Colour6"="7,54,66"
|
|
||||||
"Colour7"="0,43,54"
|
|
||||||
"Colour8"="220,50,47"
|
|
||||||
"Colour9"="203,75,22"
|
|
||||||
"Colour10"="133,153,0"
|
|
||||||
"Colour11"="88,110,117"
|
|
||||||
"Colour12"="181,137,0"
|
|
||||||
"Colour13"="101,123,131"
|
|
||||||
"Colour14"="38,139,210"
|
|
||||||
"Colour15"="131,148,150"
|
|
||||||
"Colour16"="211,54,130"
|
|
||||||
"Colour17"="108,113,196"
|
|
||||||
"Colour18"="42,161,152"
|
|
||||||
"Colour19"="147,161,161"
|
|
||||||
"Colour20"="238,232,213"
|
|
||||||
"Colour21"="253,246,227"
|
|
||||||
"Present"=dword:00000001
|
|
||||||
"Protocol"="ssh"
|
|
||||||
"CloseOnExit"=dword:00000001
|
|
||||||
"WarnOnClose"=dword:00000001
|
|
||||||
"PingInterval"=dword:00000000
|
|
||||||
"PingIntervalSecs"=dword:0000003b
|
|
||||||
"TerminalType"="putty-256color"
|
|
||||||
"SshProt"=dword:00000003
|
|
||||||
"HideMousePtr"=dword:00000001
|
|
||||||
"Beep"=dword:00000001
|
|
||||||
"ScrollbackLines"=dword:000007d0
|
|
||||||
"TermWidth"=dword:00000050
|
|
||||||
"TermHeight"=dword:00000028
|
|
||||||
"Font"="Lucida Console"
|
|
||||||
"FontHeight"=dword:0000000c
|
|
||||||
"FontQuality"=dword:00000003
|
|
||||||
"UseSystemColours"=dword:00000000
|
|
||||||
"TryPalette"=dword:00000000
|
|
||||||
"ANSIColour"=dword:00000001
|
|
||||||
"Xterm256Colour"=dword:00000001
|
|
||||||
"BoldAsColour"=dword:00000000
|
|
||||||
"MouseIsXterm"=dword:00000001
|
|
||||||
"RectSelect"=dword:00000000
|
|
||||||
"MouseOverride"=dword:00000001
|
|
||||||
"LineCodePage"="UTF-8"
|
|
||||||
"UTF8Override"=dword:00000001
|
|
||||||
"ScrollBar"=dword:00000001
|
|
||||||
"ScrollOnKey"=dword:00000001
|
|
||||||
"ScrollOnDisp"=dword:00000000
|
|
||||||
"X11Forward"=dword:00000001
|
|
|
@ -1,4 +1,4 @@
|
||||||
set-option -g default-shell $(which zsh)
|
set-option -g default-shell /bin/zsh
|
||||||
|
|
||||||
#-- base --#
|
#-- base --#
|
||||||
# set -g default-terminal "screen-256color"
|
# set -g default-terminal "screen-256color"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,9 @@
|
||||||
# If you come from bash you might have to change your $PATH.
|
# If you come from bash you might have to change your $PATH.
|
||||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||||
|
|
||||||
# Path to your oh-my-zsh installation.
|
# Path to your oh-my-zsh installation.
|
||||||
export ZSH="$HOME/.config/oh-my-zsh"
|
export ZSH="$HOME/.config/oh-my-zsh"
|
||||||
|
|
||||||
# check shell config
|
|
||||||
case $- in
|
|
||||||
*i*) ;; # interactive shell
|
|
||||||
*) return;; # do nothing
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Set name of the theme to load --- if set to "random", it will
|
# Set name of the theme to load --- if set to "random", it will
|
||||||
# load a random theme each time oh-my-zsh is loaded, in which case,
|
# load a random theme each time oh-my-zsh is loaded, in which case,
|
||||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||||
|
@ -165,7 +160,6 @@ export LANG=en_US.UTF-8
|
||||||
# fi
|
# fi
|
||||||
export EDITOR='vim'
|
export EDITOR='vim'
|
||||||
alias vimdiff='vi -d'
|
alias vimdiff='vi -d'
|
||||||
alias vir='vi -R'
|
|
||||||
# delete remote branch
|
# delete remote branch
|
||||||
alias gpod='git push origin --delete'
|
alias gpod='git push origin --delete'
|
||||||
|
|
||||||
|
@ -329,4 +323,3 @@ fi
|
||||||
# alias icat="kitty +kitten icat"
|
# alias icat="kitty +kitten icat"
|
||||||
# alias kssh="kitty +kitten ssh"
|
# alias kssh="kitty +kitten ssh"
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
|
|
|
@ -1,357 +0,0 @@
|
||||||
# AUTOMATICALLY GENERATED FILE. EDIT ONLY THE SOURCE FILES AND THEN COMPILE.
|
|
||||||
# DO NOT DIRECTLY EDIT THIS FILE!
|
|
||||||
|
|
||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 Eric Nielsen and contributors
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
# set -x
|
|
||||||
|
|
||||||
ZIMFW_URL=https://ghfast.top/https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
|
|
||||||
if [[ -z ${ZSH_VERSION} ]]; then
|
|
||||||
echo 'You must use zsh to run install.zsh' >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
emulate -L zsh -o EXTENDED_GLOB
|
|
||||||
|
|
||||||
_replace_home() {
|
|
||||||
local abs_path=${1:A}
|
|
||||||
local suffix=${abs_path#${${ZDOTDIR:-${HOME}}:A}}
|
|
||||||
if [[ ${abs_path} != ${suffix} ]]; then
|
|
||||||
print -R '${ZDOTDIR:-${HOME}}'${suffix}
|
|
||||||
else
|
|
||||||
print -R ${1}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
typeset -A ZTEMPLATES
|
|
||||||
readonly CLEAR_LINE=$'\E[2K\r'
|
|
||||||
ZIM_HOME_STR='${ZDOTDIR:-${HOME}}/.config/zimfw'
|
|
||||||
|
|
||||||
# Check Zsh version
|
|
||||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
|
||||||
print -u2 -PR "%F{red}x You're using Zsh version ${ZSH_VERSION} and versions < 5.2 are not supported. Please update your Zsh.%f"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
print -PR "%F{green})%f Using Zsh version ${ZSH_VERSION}"
|
|
||||||
|
|
||||||
# Check ZIM_HOME
|
|
||||||
if (( ! ${+ZIM_HOME} )); then
|
|
||||||
print -P '%F{green})%f ZIM_HOME not set, using the default one.'
|
|
||||||
ZIM_HOME=${(e)ZIM_HOME_STR}
|
|
||||||
elif [[ ${ZIM_HOME} == ${(e)ZIM_HOME_STR} ]]; then
|
|
||||||
print -P '%F{green})%f Your ZIM_HOME is the default one.'
|
|
||||||
else
|
|
||||||
ZIM_HOME_STR=$(_replace_home ${ZIM_HOME})
|
|
||||||
print -PR "%F{green})%f Your ZIM_HOME is customized to %B${ZIM_HOME_STR}%b"
|
|
||||||
fi
|
|
||||||
if [[ -e ${ZIM_HOME} ]]; then
|
|
||||||
if [[ -n ${ZIM_HOME}(#qN/^F) ]]; then
|
|
||||||
print -P '%F{green})%f ZIM_HOME already exists, but is empty.'
|
|
||||||
else
|
|
||||||
print -u2 -PR "%F{red}x %B${ZIM_HOME}%b already exists. Please set ZIM_HOME to the path where you want to install Zim.%f"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if Zsh is the default shell
|
|
||||||
if [[ ${SHELL:t} == zsh ]]; then
|
|
||||||
print -P '%F{green})%f Zsh is your default shell.'
|
|
||||||
else
|
|
||||||
readonly ZPATH==zsh
|
|
||||||
if command chsh -s ${ZPATH}; then
|
|
||||||
print -PR "%F{green})%f Changed your default shell to %B${ZPATH}%b"
|
|
||||||
else
|
|
||||||
print -u2 -PR "%F{yellow}! Could not change your default shell to %B${ZPATH}%b. Please manually change it later.%f"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if other frameworks are enabled
|
|
||||||
for ZDOTFILE in /etc/(zsh/)#(z|.z)(shenv|profile|shrc|login)(N) ${ZDOTDIR:-${HOME}}/.z(shenv|profile|shrc|login)(N); do
|
|
||||||
if grep -Eq "^[^#]*(\\bsource|\\.).*(${ZIM_HOME:t}|\\\$[{]?ZIM_HOME[}]?)/init.zsh\\b" ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{red}x You seem to have Zim already installed in %B${ZDOTFILE}%b. Please uninstall it first.%f"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*(\bsource|\.).*prezto/init.zsh\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have prezto enabled in %B${ZDOTFILE}%b. Please disable it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*(\bsource|\.).*/oh-my-zsh.sh\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have oh-my-zsh enabled in %B${ZDOTFILE}%b. Please disable it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*\bantibody\s+bundle\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have antibody enabled in %B${ZDOTFILE}%b. Please disable it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*\bantigen\s+apply\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have antigen enabled in %B${ZDOTFILE}%b. Please disable it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*(\bsource|\.).*/zgen.zsh\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have zgen enabled in %B${ZDOTFILE}%b. Please disable it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*\bzplug\s+load\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have zplug enabled in %B${ZDOTFILE}%b. Please disable it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*\b(function\s+grml_vcs_info_toggle_colour\b|grml_vcs_info_toggle_colour\s*\(\s*\))' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to have grml installed in %B${ZDOTFILE}%b. Please uninstall it.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*\bcompinit\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to be already calling %Bcompinit%b in %B${ZDOTFILE}%b. Please remove it, because Zim's completion module will call %Bcompinit%b for you.%f"
|
|
||||||
fi
|
|
||||||
if grep -Eq '^[^#]*\bpromptinit\b' ${ZDOTFILE}; then
|
|
||||||
print -u2 -P "%F{yellow}! You seem to be calling %Bpromptinit%b in %B${ZDOTFILE}%b. Please remove it, because Zim already has a prompt theme for you that does not require %Bpromptinit%b.%f"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Download zimfw script
|
|
||||||
readonly ZTARGET=${ZIM_HOME}/zimfw.zsh
|
|
||||||
if (
|
|
||||||
command mkdir -p ${ZIM_HOME} || return 1
|
|
||||||
readonly ZURL=${ZIMFW_URL}
|
|
||||||
if [[ ${+commands[curl]} -ne 0 && -x ${commands[curl]} ]]; then
|
|
||||||
command curl -fsSL -o ${ZTARGET} ${ZURL} || return 1
|
|
||||||
elif [[ ${+commands[wget]} -ne 0 && -x ${commands[wget]} ]]; then
|
|
||||||
command wget -nv -O ${ZTARGET} ${ZURL} || return 1
|
|
||||||
else
|
|
||||||
print -u2 -P '%F{red}x Either %Bcurl%b or %Bwget%b are required to download the Zim script.%f'
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
); then
|
|
||||||
print -PR "%F{green})%f Downloaded the Zim script to %B${ZTARGET}%b"
|
|
||||||
else
|
|
||||||
command rm -rf ${ZIM_HOME}
|
|
||||||
print -u2 -PR "%F{red}x Could not download the Zim script to %B${ZTARGET}%b%f"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prepend templates
|
|
||||||
ZTEMPLATES[zimrc]="# Start configuration added by Zim install {{{
|
|
||||||
#
|
|
||||||
# This is not sourced during shell startup, and it's only used to configure the
|
|
||||||
# zimfw plugin manager.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Modules
|
|
||||||
#
|
|
||||||
|
|
||||||
# Sets sane Zsh built-in environment options.
|
|
||||||
zmodule environment
|
|
||||||
# Provides handy git aliases and functions.
|
|
||||||
zmodule git
|
|
||||||
# Applies correct bindkeys for input events.
|
|
||||||
zmodule input
|
|
||||||
# Sets a custom terminal title.
|
|
||||||
zmodule termtitle
|
|
||||||
# Utility aliases and functions. Adds colour to ls, grep and less.
|
|
||||||
zmodule utility
|
|
||||||
|
|
||||||
#
|
|
||||||
# Prompt
|
|
||||||
#
|
|
||||||
|
|
||||||
# Exposes to prompts how long the last command took to execute, used by asciiship.
|
|
||||||
zmodule duration-info
|
|
||||||
# Exposes git repository status information to prompts, used by asciiship.
|
|
||||||
zmodule git-info
|
|
||||||
# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts.
|
|
||||||
zmodule asciiship
|
|
||||||
|
|
||||||
#
|
|
||||||
# Completion
|
|
||||||
#
|
|
||||||
|
|
||||||
# Additional completion definitions for Zsh.
|
|
||||||
zmodule zsh-users/zsh-completions --fpath src
|
|
||||||
# Enables and configures smart and extensive tab completion.
|
|
||||||
# completion must be sourced after all modules that add completion definitions.
|
|
||||||
zmodule completion
|
|
||||||
|
|
||||||
#
|
|
||||||
# Modules that must be initialized last
|
|
||||||
#
|
|
||||||
|
|
||||||
# Fish-like syntax highlighting for Zsh.
|
|
||||||
# zsh-users/zsh-syntax-highlighting must be sourced after completion
|
|
||||||
zmodule zsh-users/zsh-syntax-highlighting
|
|
||||||
# Fish-like history search (up arrow) for Zsh.
|
|
||||||
# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting
|
|
||||||
zmodule zsh-users/zsh-history-substring-search
|
|
||||||
# Fish-like autosuggestions for Zsh.
|
|
||||||
zmodule zsh-users/zsh-autosuggestions
|
|
||||||
# }}} End configuration added by Zim install
|
|
||||||
"
|
|
||||||
ZTEMPLATES[zshrc]="# Start configuration added by Zim install {{{
|
|
||||||
#
|
|
||||||
# User configuration sourced by interactive shells
|
|
||||||
#
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Zsh configuration
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# History
|
|
||||||
#
|
|
||||||
|
|
||||||
# Remove older command from the history if a duplicate is to be added.
|
|
||||||
setopt HIST_IGNORE_ALL_DUPS
|
|
||||||
|
|
||||||
#
|
|
||||||
# Input/output
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set editor default keymap to emacs (\`-e\`) or vi (\`-v\`)
|
|
||||||
bindkey -e
|
|
||||||
|
|
||||||
# Prompt for spelling correction of commands.
|
|
||||||
#setopt CORRECT
|
|
||||||
|
|
||||||
# Customize spelling correction prompt.
|
|
||||||
#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
|
||||||
|
|
||||||
# Remove path separator from WORDCHARS.
|
|
||||||
WORDCHARS=\${WORDCHARS//[\\/]}
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Zim configuration
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
# Use degit instead of git as the default tool to install and update modules.
|
|
||||||
#zstyle ':zim:zmodule' use 'degit'
|
|
||||||
|
|
||||||
# --------------------
|
|
||||||
# Module configuration
|
|
||||||
# --------------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# git
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set a custom prefix for the generated aliases. The default prefix is 'G'.
|
|
||||||
#zstyle ':zim:git' aliases-prefix 'g'
|
|
||||||
|
|
||||||
#
|
|
||||||
# input
|
|
||||||
#
|
|
||||||
|
|
||||||
# Append \`../\` to your input for each \`.\` you type after an initial \`..\`
|
|
||||||
#zstyle ':zim:input' double-dot-expand yes
|
|
||||||
|
|
||||||
#
|
|
||||||
# termtitle
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set a custom terminal title format using prompt expansion escape sequences.
|
|
||||||
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
|
|
||||||
# If none is provided, the default '%n@%m: %~' is used.
|
|
||||||
#zstyle ':zim:termtitle' format '%1~'
|
|
||||||
|
|
||||||
#
|
|
||||||
# zsh-autosuggestions
|
|
||||||
#
|
|
||||||
|
|
||||||
# Disable automatic widget re-binding on each precmd. This can be set when
|
|
||||||
# zsh-users/zsh-autosuggestions is the last module in your ~/.zimrc.
|
|
||||||
ZSH_AUTOSUGGEST_MANUAL_REBIND=1
|
|
||||||
|
|
||||||
# Customize the style that the suggestions are shown with.
|
|
||||||
# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
|
|
||||||
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242'
|
|
||||||
|
|
||||||
#
|
|
||||||
# zsh-syntax-highlighting
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set what highlighters will be used.
|
|
||||||
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
|
|
||||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
|
|
||||||
|
|
||||||
# Customize the main highlighter styles.
|
|
||||||
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
|
|
||||||
#typeset -A ZSH_HIGHLIGHT_STYLES
|
|
||||||
#ZSH_HIGHLIGHT_STYLES[comment]='fg=242'
|
|
||||||
|
|
||||||
# ------------------
|
|
||||||
# Initialize modules
|
|
||||||
# ------------------
|
|
||||||
|
|
||||||
ZIM_HOME=${ZIM_HOME_STR}
|
|
||||||
# Download zimfw plugin manager if missing.
|
|
||||||
if [[ ! -e \${ZIM_HOME}/zimfw.zsh ]]; then
|
|
||||||
if (( \${+commands[curl]} )); then
|
|
||||||
curl -fsSL --create-dirs -o \${ZIM_HOME}/zimfw.zsh \\
|
|
||||||
${ZIMFW_URL}
|
|
||||||
# https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
else
|
|
||||||
mkdir -p \${ZIM_HOME} && wget -nv -O \${ZIM_HOME}/zimfw.zsh \\
|
|
||||||
${ZIMFW_URL}
|
|
||||||
# https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Install missing modules, and update \${ZIM_HOME}/init.zsh if missing or outdated.
|
|
||||||
if [[ ! \${ZIM_HOME}/init.zsh -nt \${ZIM_CONFIG_FILE:-\${ZDOTDIR:-\${HOME}}/.zimrc} ]]; then
|
|
||||||
source \${ZIM_HOME}/zimfw.zsh init
|
|
||||||
fi
|
|
||||||
# Initialize modules.
|
|
||||||
source \${ZIM_HOME}/init.zsh
|
|
||||||
|
|
||||||
# ------------------------------
|
|
||||||
# Post-init module configuration
|
|
||||||
# ------------------------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# zsh-history-substring-search
|
|
||||||
#
|
|
||||||
|
|
||||||
zmodload -F zsh/terminfo +p:terminfo
|
|
||||||
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
|
|
||||||
for key ('^[[A' '^P' \${terminfo[kcuu1]}) bindkey \${key} history-substring-search-up
|
|
||||||
for key ('^[[B' '^N' \${terminfo[kcud1]}) bindkey \${key} history-substring-search-down
|
|
||||||
for key ('k') bindkey -M vicmd \${key} history-substring-search-up
|
|
||||||
for key ('j') bindkey -M vicmd \${key} history-substring-search-down
|
|
||||||
unset key
|
|
||||||
# }}} End configuration added by Zim install
|
|
||||||
"
|
|
||||||
for ZTEMPLATE in ${(k)ZTEMPLATES}; do
|
|
||||||
USER_FILE=${${:-${ZDOTDIR:-${HOME}}/.${ZTEMPLATE}}:A}
|
|
||||||
if ERR=$(command mv -f =(
|
|
||||||
print -R ${ZTEMPLATES[${ZTEMPLATE}]}
|
|
||||||
if [[ -e ${USER_FILE} ]] cat ${USER_FILE}
|
|
||||||
) ${USER_FILE} 2>&1); then
|
|
||||||
print -PR "%F{green})%f Prepended Zim template to %B${USER_FILE}%b"
|
|
||||||
else
|
|
||||||
print -u2 -PlR "%F{red}x Error prepending Zim template to %B${USER_FILE}%b%f" ${ERR}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
print -n 'Installing modules ...'
|
|
||||||
if ERR=$(source ${ZIM_HOME}/zimfw.zsh init -q 2>&1); then
|
|
||||||
print -P ${CLEAR_LINE}'%F{green})%f Installed modules.'
|
|
||||||
else
|
|
||||||
print -u2 -PlR "${CLEAR_LINE}${ERR}" '%F{red}x Could not install modules.%f'
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
print -P ${CLEAR_LINE}'All done. Enjoy your Zsh IMproved! Restart your terminal for changes to take effect.'
|
|
||||||
|
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
# Start configuration added by Zim install {{{
|
|
||||||
#
|
|
||||||
# User configuration sourced by interactive shells
|
|
||||||
#
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Zsh configuration
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# History
|
|
||||||
#
|
|
||||||
|
|
||||||
# Remove older command from the history if a duplicate is to be added.
|
|
||||||
setopt HIST_IGNORE_ALL_DUPS
|
|
||||||
|
|
||||||
#
|
|
||||||
# Input/output
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set editor default keymap to emacs (`-e`) or vi (`-v`)
|
|
||||||
bindkey -e
|
|
||||||
|
|
||||||
# Prompt for spelling correction of commands.
|
|
||||||
#setopt CORRECT
|
|
||||||
|
|
||||||
# Customize spelling correction prompt.
|
|
||||||
#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
|
||||||
|
|
||||||
# Remove path separator from WORDCHARS.
|
|
||||||
WORDCHARS=${WORDCHARS//[\/]}
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Zim configuration
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
# Use degit instead of git as the default tool to install and update modules.
|
|
||||||
#zstyle ':zim:zmodule' use 'degit'
|
|
||||||
|
|
||||||
# --------------------
|
|
||||||
# Module configuration
|
|
||||||
# --------------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# git
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set a custom prefix for the generated aliases. The default prefix is 'G'.
|
|
||||||
#zstyle ':zim:git' aliases-prefix 'g'
|
|
||||||
|
|
||||||
#
|
|
||||||
# input
|
|
||||||
#
|
|
||||||
|
|
||||||
# Append `../` to your input for each `.` you type after an initial `..`
|
|
||||||
#zstyle ':zim:input' double-dot-expand yes
|
|
||||||
|
|
||||||
#
|
|
||||||
# termtitle
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set a custom terminal title format using prompt expansion escape sequences.
|
|
||||||
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
|
|
||||||
# If none is provided, the default '%n@%m: %~' is used.
|
|
||||||
#zstyle ':zim:termtitle' format '%1~'
|
|
||||||
|
|
||||||
#
|
|
||||||
# zsh-autosuggestions
|
|
||||||
#
|
|
||||||
|
|
||||||
# Disable automatic widget re-binding on each precmd. This can be set when
|
|
||||||
# zsh-users/zsh-autosuggestions is the last module in your ~/.zimrc.
|
|
||||||
ZSH_AUTOSUGGEST_MANUAL_REBIND=1
|
|
||||||
|
|
||||||
# Customize the style that the suggestions are shown with.
|
|
||||||
# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
|
|
||||||
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242'
|
|
||||||
|
|
||||||
#
|
|
||||||
# zsh-syntax-highlighting
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set what highlighters will be used.
|
|
||||||
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
|
|
||||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
|
|
||||||
|
|
||||||
# Customize the main highlighter styles.
|
|
||||||
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
|
|
||||||
#typeset -A ZSH_HIGHLIGHT_STYLES
|
|
||||||
#ZSH_HIGHLIGHT_STYLES[comment]='fg=242'
|
|
||||||
|
|
||||||
# ------------------
|
|
||||||
# Initialize modules
|
|
||||||
# ------------------
|
|
||||||
|
|
||||||
ZIM_HOME=${ZDOTDIR:-${HOME}}/.config/zimfw
|
|
||||||
# Download zimfw plugin manager if missing.
|
|
||||||
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
|
|
||||||
if (( ${+commands[curl]} )); then
|
|
||||||
curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
|
|
||||||
https://ghfast.top/https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
# https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
else
|
|
||||||
mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh \
|
|
||||||
https://ghfast.top/https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
# https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
|
|
||||||
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then
|
|
||||||
source ${ZIM_HOME}/zimfw.zsh init
|
|
||||||
fi
|
|
||||||
# Initialize modules.
|
|
||||||
source ${ZIM_HOME}/init.zsh
|
|
||||||
|
|
||||||
# ------------------------------
|
|
||||||
# Post-init module configuration
|
|
||||||
# ------------------------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# zsh-history-substring-search
|
|
||||||
#
|
|
||||||
|
|
||||||
zmodload -F zsh/terminfo +p:terminfo
|
|
||||||
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
|
|
||||||
for key ('^[[A' '^P' ${terminfo[kcuu1]}) bindkey ${key} history-substring-search-up
|
|
||||||
for key ('^[[B' '^N' ${terminfo[kcud1]}) bindkey ${key} history-substring-search-down
|
|
||||||
for key ('k') bindkey -M vicmd ${key} history-substring-search-up
|
|
||||||
for key ('j') bindkey -M vicmd ${key} history-substring-search-down
|
|
||||||
unset key
|
|
||||||
# }}} End configuration added by Zim install
|
|
||||||
|
|
||||||
# If you come from bash you might have to change your $PATH.
|
|
||||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Fuck Wechat cannot run
|
|
||||||
Remove-Item -Recurse -Force $env:APPDATA\Roaming\Tencent\xwechat
|
|
|
@ -1,20 +0,0 @@
|
||||||
# 统计 java 文件源代码行数
|
|
||||||
# Get-ChildItem -Filter *.java -Recurse | ForEach-Object {
|
|
||||||
# Get-Content $_ | Measure-Object -Line
|
|
||||||
# }
|
|
||||||
|
|
||||||
$files = Get-ChildItem -Filter *.java -Recurse
|
|
||||||
for ($i = 0; $i -lt $files.Length; $i++) {
|
|
||||||
$res = Get-Content $files[$i].FullName | Measure-Object -Line
|
|
||||||
if ($res.Lines -ge 2000) {
|
|
||||||
$msg = "文件 {0} 行数为 {1}" -f $files[$i].FullName, $res.Lines
|
|
||||||
Write-Host $msg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$files = Get-ChildItem -Filter *.class -Recurse
|
|
||||||
for ($i = 0; $i -lt $files.Length; $i++) {
|
|
||||||
$file = $files[$i]
|
|
||||||
$msg = "文件 {0} 大小为 {1}kb" -f $file.FullName, $file.Length / 1kb
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
REM 文件编码需要使用 ANSI
|
|
||||||
Set objsws = GetObject("winmgmts:\\.\root\cimv2")
|
|
||||||
Set colPro = objsws.ExecQuery("select * from Win32_Process where name = 'wscript.exe'")
|
|
||||||
check = 0
|
|
||||||
for each objProcess in colPro
|
|
||||||
if instr(objProcess.CommandLine, "start.vbs") then
|
|
||||||
check = check + 1
|
|
||||||
end if
|
|
||||||
next
|
|
||||||
|
|
||||||
if check > 1 then
|
|
||||||
msgbox "Doing job..."
|
|
||||||
else
|
|
||||||
Set objShell = CreateObject("Wscript.Shell")
|
|
||||||
msgbox "点击确认开始运行"
|
|
||||||
do
|
|
||||||
Wscript.Sleep 150000
|
|
||||||
objShell.SendKeys "{SCROLLLOCK}"
|
|
||||||
loop
|
|
||||||
end if
|
|
|
@ -1,17 +0,0 @@
|
||||||
REM 文件编码需要使用 ANSI
|
|
||||||
Set objsws = GetObject("winmgmts:\\.\root\cimv2")
|
|
||||||
Set colPro = objsws.ExecQuery("select * from Win32_Process where name = 'wscript.exe'")
|
|
||||||
check = 0
|
|
||||||
for each objProcess in colPro
|
|
||||||
if instr(objProcess.CommandLine, "start.vbs") then
|
|
||||||
check = check + 1
|
|
||||||
end if
|
|
||||||
next
|
|
||||||
|
|
||||||
if check = 0 then
|
|
||||||
msgbox "程序未运行,确认退出"
|
|
||||||
else
|
|
||||||
Set objShell = CreateObject("Wscript.Shell")
|
|
||||||
objShell.run "taskkill /f /im wscript.exe", hide
|
|
||||||
msgbox "关闭成功"
|
|
||||||
end if
|
|
Loading…
Reference in New Issue