小白升级之路lv2-(vim编辑器上机实操)

目录

实操文件

命令模式练习

插入模式练习

末行模式练习

视图模式练习

高级操作练习


实操文件

May  7 20:18:07 localhost mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  7 20:18:07 localhost mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  7 20:18:15 localhost libvirtd: 2025-05-07 12:18:15.121+0000: 1435: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  7 20:18:16 localhost libvirtd: 2025-05-07 12:18:16.166+0000: 1435: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  7 20:18:16 localhost libvirtd: 2025-05-07 12:18:16.183+0000: 1435: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  7 20:19:21 localhost gnome-keyring-daemon[9120]: couldn't create login keyring: An error occurred on the device
May  7 20:19:30 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        file:///media/cdrom/” which is not a key-value pair, group, or comment
May  8 09:13:05 localhost mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  8 09:13:06 localhost mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  8 09:13:14 localhost libvirtd: 2025-05-08 01:13:14.077+0000: 1336: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  8 09:13:14 localhost libvirtd: 2025-05-08 01:13:14.142+0000: 1336: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  8 09:13:14 localhost libvirtd: 2025-05-08 01:13:14.158+0000: 1336: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  8 10:09:23 localhost mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  8 10:09:24 localhost mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  8 10:09:31 localhost libvirtd: 2025-05-08 02:09:31.618+0000: 1419: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  8 10:09:31 localhost libvirtd: 2025-05-08 02:09:31.660+0000: 1419: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  8 10:09:31 localhost libvirtd: 2025-05-08 02:09:31.673+0000: 1419: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  8 10:25:15 localhost journal: Error setting property 'DesktopId' on interface org.freedesktop.GeoClue2.Client: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/GeoClue2/Client/1 (g-dbus-error-quark, 19)
May  8 10:25:15 localhost journal: Error setting property 'RequestedAccuracyLevel' on interface org.freedesktop.GeoClue2.Client: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/GeoClue2/Client/1 (g-dbus-error-quark, 19)
May  8 10:36:08 localhost journal: shell-extensions did not set error for gs_plugin_refresh
May  8 10:59:15 localhost journal: shell-extensions did not set error for gs_plugin_refresh
May  9 09:25:48 localhost journal: shell-extensions did not set error for gs_plugin_refresh
May  9 14:54:18 zhao mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  9 14:54:18 zhao mcelog: Family 6 Model 141 CPU: only decoding architectural errors
May  9 14:54:40 zhao libvirtd: 2025-05-09 06:54:40.641+0000: 2078: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  9 14:54:40 zhao libvirtd: 2025-05-09 06:54:40.660+0000: 2078: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May  9 14:54:40 zhao libvirtd: 2025-05-09 06:54:40.662+0000: 2078: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
May 12 11:01:44 zhao journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
May 12 11:01:53 zhao journal: shell-extensions did not set error for gs_plugin_refresh
May 12 11:06:04 zhao journal: shell-extensions did not set error for gs_plugin_refresh
May 12 11:08:23 zhao rz[19211]: [root] deepin-desktop-community-20.9-amd64.iso/ZMODEM: error: zgethdr returned TIMEOUT
May 12 11:08:23 zhao rz[19211]: [root] deepin-desktop-community-20.9-amd64.iso/ZMODEM: error
May 12 11:08:23 zhao rz[19211]: [root] no.name/ZMODEM: got error
May 13 10:12:48 zhao gnome-keyring-daemon[16982]: couldn't create login keyring: An error occurred on the device
May 13 11:59:41 zhao libvirtd: 2025-05-13 03:59:41.571+0000: 1312: error : virFirewallApplyRuleFirewallD:790 : The name org.fedoraproject.FirewallD1 was not provided by any .service files
May 13 13:30:02 zhao systemd: Started Session 207 of user root.
May 13 13:36:27 zhao dhclient[1244]: DHCPREQUEST on ens33 to 192.168.158.254 port 67 (xid=0x391a628f)
May 13 13:36:27 zhao dhclient[1244]: DHCPACK from 192.168.158.254 (xid=0x391a628f)
May 13 13:36:29 zhao dhclient[1244]: bound to 192.168.158.30 -- renewal in 698 seconds.
May 13 13:40:01 zhao systemd: Started Session 208 of user root.
May 13 13:48:07 zhao dhclient[1244]: DHCPREQUEST on ens33 to 192.168.158.254 port 67 (xid=0x391a628f)
May 13 13:48:07 zhao dhclient[1244]: DHCPACK from 192.168.158.254 (xid=0x391a628f)
May 13 13:48:09 zhao dhclient[1244]: bound to 192.168.158.30 -- renewal in 859 seconds.
May 13 13:50:01 zhao systemd: Started Session 209 of user root.
May 13 14:00:01 zhao systemd: Started Session 210 of user root.
May 13 14:01:01 zhao systemd: Started Session 211 of user root.
May 13 14:02:28 zhao dhclient[1244]: DHCPREQUEST on ens33 to 192.168.158.254 port 67 (xid=0x391a628f)
May 13 14:02:28 zhao dhclient[1244]: DHCPACK from 192.168.158.254 (xid=0x391a628f)
May 13 14:02:30 zhao dhclient[1244]: bound to 192.168.158.30 -- renewal in 687 seconds.
May 13 14:10:01 zhao systemd: Started Session 212 of user root.
May 13 14:13:57 zhao dhclient[1244]: DHCPREQUEST on ens33 to 192.168.158.254 port 67 (xid=0x391a628f)
May 13 14:13:57 zhao dhclient[1244]: DHCPACK from 192.168.158.254 (xid=0x391a628f)
May 13 14:13:59 zhao dhclient[1244]: bound to 192.168.158.30 -- renewal in 699 seconds.
May 13 14:15:29 zhao systemd: Time has been changed
May 13 14:15:30 zhao kernel: e1000: ens33 NIC Link is Down
May 13 14:15:40 zhao rtkit-daemon[830]: The canary thread is apparently starving. Taking action.
May 13 14:15:40 zhao rtkit-daemon[830]: Demoting known real-time threads.
May 13 14:15:40 zhao rtkit-daemon[830]: Demoted 0 threads.
May 13 14:15:46 zhao kernel: e1000: ens33 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
May 13 14:16:31 zhao chronyd[858]: Can't synchronise: no majority
May 13 14:17:36 zhao chronyd[858]: Source 111.230.189.174 replaced with 202.118.1.130
May 13 14:18:33 zhao chronyd[858]: Selected source 162.159.200.123
May 13 14:20:01 zhao systemd: Started Session 213 of user root.
May 13 14:21:56 zhao chronyd[858]: Selected source 202.118.1.130
May 13 14:25:39 zhao dhclient[1244]: DHCPREQUEST on ens33 to 192.168.158.254 port 67 (xid=0x391a628f)
May 13 14:25:39 zhao dhclient[1244]: DHCPACK from 192.168.158.254 (xid=0x391a628f)
May 13 14:25:41 zhao dhclient[1244]: bound to 192.168.158.30 -- renewal in 784 seconds.
May 13 14:30:01 zhao systemd: Started Session 214 of user root.

命令模式练习

  1. 打开任意文本文件,使用gg跳转到首行,再用G跳转到末尾

  2. 在命令模式下:

    • yy复制当前行

    • p粘贴到下一行

    • 5dd删除包括当前行在内的5行内容

  3. 使用/error查找文档中的"error"关键词,用n/N进行正向/反向查找

  4. r命令将光标所在字符替换为"X"

  5. d$删除从光标位置到行尾的所有内容

插入模式练习

  1. 在命令模式下:

    • o在下方新建行并输入文本

    • A跳转到行尾继续输入

    • I跳转到行首输入

  2. 使用O在当前行上方插入新行,输入内容后按ESC返回命令模式

  3. 练习从插入模式返回命令模式时:

    • i进入插入模式,观察返回时光标位置变化

    • a进入插入模式,比较光标位置差异

末行模式练习

  1. 执行:set nu显示行号,再用:set nonu取消显示

  2. 使用:15直接跳转到第15行

  3. 对10-20行执行范围替换: :10,20s/error/warning/g

  4. 执行全文替换:

    • :%s/error/ERROR/ 替换每行第一个"error"

    • :%s/error/ERROR/g 替换所有"error"

  5. 练习:X设置文件密码,再通过:set key=""取消密码

  6. :w test_backup.txt另存为副本文件

视图模式练习

  1. v进入行选择模式:

  • 选中3行后按y复制

  • 移动光标后用p粘贴

  1. Ctrl+v进入列块模式:

  • 纵向选中多列字符后按d删除

  • 选中列后按I#添加注释,按两次ESC生效

  1. 批量注释:

  • 用列块模式选中多行行首

  • 插入#注释符

  • 再次用列块模式删除注释符

高级操作练习

  1. 在末行模式执行:r !date插入当前日期到光标下方

  2. :5r !ls -l将命令结果插入到第5行下方

  3. 尝试:!ls执行外部命令后返回编辑界面

注意:

  1. 所有操作前建议先备份文件

  2. 谨慎使用:!command执行会修改文件内容的命令

  3. 批量操作前可用v模式确认选中范围:

  4. 替换操作建议先用/确认匹配内容

  5. 涉及密码操作时注意文件权限安全

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值