Home Operation and Maintenance Linux Operation and Maintenance What to do if linux vi does not display the cursor

What to do if linux vi does not display the cursor

Mar 22, 2023 am 09:39 AM
linux cursor

linux vi不显示光标的解决办法:1、登录linux系统,进入终端;2、通过执行“echo -e "\033[?25h"”方法显示光标即可。

What to do if linux vi does not display the cursor

本教程操作环境:linux5.9.8系统、Dell G3电脑。

linux vi 不显示光标怎么办?

Linux终端光标消失问题

今天在用vim写脚本的时候,突然间发现光标消失了,这就很难受了,不知道编辑位置在哪。

一开始一直在找vim的配置问题,但是后来发现终端的光标也消失了。

这才知道终端的光标和vim的光标是关联的,所以只需要把终端的光标搞出来就行了。

隐藏光标

echo -e "\033[?25l"
Copy after login

显示光标

echo -e "\033[?25h"
Copy after login

相关拓展:

在linux命令行下进行快速移动光标、命令编辑、编辑后执行历史命令、Bang(!)命令、控制命令等。让basher更有效率。

一、说明

Ctrl – k: 先按住 Ctrl 键,然后再按 k 键;

Alt – k: 先按住 Alt 键,然后再按 k 键;

M – k:先单击 Esc 键,然后再按 k 键。

二、移动光标

Ctrl – a :移到行首

Ctrl – e :移到行尾

Ctrl – b :往回(左)移动一个字符

Ctrl – f :往后(右)移动一个字符

Alt – b :往回(左)移动一个单词

Alt – f :往后(右)移动一个单词

Ctrl – xx :在命令行尾和光标之间移动

M-b :往回(左)移动一个单词

M-f :往后(右)移动一个单词

三、编辑命令

Ctrl – h :删除光标左方位置的字符

Ctrl – d :删除光标右方位置的字符(注意:当前命令行没有任何字符时,会注销系统或结束终端)

Ctrl – w :由光标位置开始,往左删除单词。往行首删

Alt – d :由光标位置开始,往右删除单词。往行尾删

M – d :由光标位置开始,删除单词,直到该单词结束。

Ctrl – k :由光标所在位置开始,删除右方所有的字符,直到该行结束。

Ctrl – u :由光标所在位置开始,删除左方所有的字符,直到该行开始。

Ctrl – y :粘贴之前删除的内容到光标后。

Alt + t :交换光标处和之前两个字符的位置。

Alt + . :使用上一条命令的最后一个参数。

Ctrl – _ :回复之前的状态。撤销操作。

Ctrl -a + Ctrl -k 或 Ctrl -e + Ctrl -u 或 Ctrl -k + Ctrl -u 组合可删除整行。

四、Bang(!)命令

!! :执行上一条命令。

foobar :把上一条命令里的foo替换为bar,并执行。

!wget :执行最近的以wget开头的命令。

!wget:p :仅打印最近的以wget开头的命令,不执行。

!$ :上一条命令的最后一个参数, 与 Alt - . 和 $_ 相同。

!* :上一条命令的所有参数

!*:p :打印上一条命令是所有参数,也即 !*的内容。

^abc :删除上一条命令中的abc。

foobar :将上一条命令中的 foo 替换为 bar

foobar^ :将上一条命令中的 foo 替换为 bar

!-n :执行前n条命令,执行上一条命令: !-1, 执行前5条命令的格式是: !-5

五、查找历史命令

Ctrl – p :显示当前命令的上一条历史命令

Ctrl – n :显示当前命令的下一条历史命令

Ctrl – r :搜索历史命令,随着输入会显示历史命令中的一条匹配命令,Enter键执行匹配命令;ESC键在命令行显示而不执行匹配命令。

Ctrl – g :从历史搜索模式(Ctrl – r)退出。

六、控制命令

Ctrl – l :清除屏幕,然后,在最上面重新显示目前光标所在的这一行的内容。

Ctrl – o :执行当前命令,并选择上一条命令。

Ctrl – s :阻止屏幕输出

Ctrl – q :允许屏幕输出

Ctrl – c :终止命令

Ctrl – z :挂起命令

七、重复执行操作动作

M – 操作次数 操作动作 : 指定操作次数,重复执行指定的操作。

相关推荐:《Linux视频教程

The above is the detailed content of What to do if linux vi does not display the cursor. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use docker desktop How to use docker desktop Apr 15, 2025 am 11:45 AM

How to use Docker Desktop? Docker Desktop is a tool for running Docker containers on local machines. The steps to use include: 1. Install Docker Desktop; 2. Start Docker Desktop; 3. Create Docker image (using Dockerfile); 4. Build Docker image (using docker build); 5. Run Docker container (using docker run).

How to view the docker process How to view the docker process Apr 15, 2025 am 11:48 AM

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

What to do if the docker image fails What to do if the docker image fails Apr 15, 2025 am 11:21 AM

Troubleshooting steps for failed Docker image build: Check Dockerfile syntax and dependency version. Check if the build context contains the required source code and dependencies. View the build log for error details. Use the --target option to build a hierarchical phase to identify failure points. Make sure to use the latest version of Docker engine. Build the image with --t [image-name]:debug mode to debug the problem. Check disk space and make sure it is sufficient. Disable SELinux to prevent interference with the build process. Ask community platforms for help, provide Dockerfiles and build log descriptions for more specific suggestions.

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

How to back up vscode settings and extensions How to back up vscode settings and extensions Apr 15, 2025 pm 05:18 PM

How to back up VS Code configurations and extensions? Manually backup the settings file: Copy the key JSON files (settings.json, keybindings.json, extensions.json) to a safe location. Take advantage of VS Code synchronization: enable synchronization with your GitHub account to automatically back up all relevant settings and extensions. Use third-party tools: Back up configurations with reliable tools and provide richer features such as version control and incremental backups.

See all articles