Files
vimx/training/workshop.ts
T
2026-09-08 20:04:50 +08:00

66 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ============================================================
// 第五阶段练习文件 — 高级技巧工坊
// ============================================================
// === 练习 1:Surround(环绕) ===
// 把下面的单词用不同方式包裹起来
const bareWord = target; // ysiw" → "target"
const singleQuoted = 'hello'; // cs'" → "hello"; ds" → hello
const tagged = <div>text</div>; // cst<span> → <span>text</span>
// === 练习 2:寄存器 ===
// "ayiw — 复制下面单词到 a 寄存器
// "ap — 把它粘贴到别处
const important = "DON'T LOSE THIS";
// "+y — 复制到系统剪贴板 (使用系统剪贴板)
// "*p — 从系统剪贴板粘贴
const shared = "clipboard test";
// === 练习 3:宏 ===
// 把下面的数组转换成对象数组 [{id: 1}, {id: 2}, {id: 3}]
// 1. qa 开始录制
// 2. 在第一行编辑:I{id: <Esc>A}<Esc>
// 3. j 到下一行
// 4. q 停止录制
// 5. 2@a 播放两次
1
2
3
4
5
// === 练习 4:可视模式 ===
// V — 行选择下面几行
// > — 缩进
// < — 减少缩进
// gv — 重新选择
const items = [
"apple",
"banana",
"cherry",
"date",
"elderberry",
];
// === 练习 5:替换 ===
// :%s/alpha/beta/g — 全局替换
const message = "alpha alpha alpha alpha";
const more = "alpha here, alpha there";
// === 练习 6:排序 ===
// V 选中下面几行 → :sort
const unsorted = [
"zebra",
"apple",
"monkey",
"banana",
"cat",
];
// === 练习 7:标记 ===
// ma 设置标记 a — `a 跳回来
const bookmark = "important line!";
export {};