EADST

Basic Vim Commands

Vim is a powerful text editor with numerous commands. Here's a short guide to help you with basic commands, including how to find and replace text.

1. Opening a File

To open a file in Vim, use:

vim filename

2. Switching Between Modes

  • Insert Mode: Press i to start editing.
  • Normal Mode: Press Esc to stop editing and run commands.

3. Saving and Exiting

  • Save changes and exit:
    :wq
    
  • Exit without saving:
    :q!
    

4. Basic Navigation

  • Use arrow keys or:
  • h (left), j (down), k (up), l (right)

5. Deleting Text

  • Delete a character: x
  • Delete a line: dd

6. Finding Text

To search for a word in Vim: - Forward search (down the document):

/word
Use n to jump to the next match and N for the previous match.

  • Backward search (up the document):
    ?word
    
    Similarly, use n and N to navigate.

7. Replacing Text

To replace text, Vim has a powerful substitute command: - Replace within the current line:

:s/old/new
This replaces the first occurrence of old with new on the current line.

  • Replace all occurrences in the current line:

    :s/old/new/g
    

  • Replace in the entire file:

    :%s/old/new/g
    

  • Replace all occurrences with confirmation:

    :%s/old/new/gc
    
    Vim will prompt you to confirm each replacement with y (yes) or n (no).

These commands will help you efficiently find, replace, and edit text in Vim. Happy editing!

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
PDF Tiktoken ONNX AI SPIE Disk TensorRT llama.cpp 飞书 Pytorch CLAP ModelScope JSON Nginx NLP hf Land Dataset Qwen2 Baidu Food PDB Freesound BTC Distillation Plotly CTC ChatGPT FP8 Windows UNIX DeepSeek Algorithm Quantization git 腾讯云 CUDA 多进程 XGBoost scipy BeautifulSoup Website Bert Llama Cloudreve Logo Hilton Math 多线程 Image2Text LLM EXCEL Quantize 公式 v0.dev TTS Transformers OpenAI Paper Tracking logger Template NLTK mmap Ubuntu Tensor HuggingFace Augmentation Pillow 版权 YOLO Heatmap Zip Card CC diffusers SVR Animate Password RAR Datetime COCO Proxy Clash Data WAN PyTorch Miniforge Vim MD5 QWEN Ptyhon GPTQ CV Input Translation Python Bipartite GoogLeNet Git Docker SQL 阿里云 Conda FP32 BF16 Github Safetensors Pickle LeetCode PyCharm Diagram 继承 CAM Domain Jetson Jupyter Qwen2.5 财报 VGG-16 VPN FP16 Vmess Video Linux Breakpoint FlashAttention Review Magnet 音频 Paddle GGML Mixtral SQLite Michelin Google OpenCV LaTeX Django FastAPI tar CEIR CSV Hotel InvalidArgumentError GPT4 GIT Qwen Permission Attention 签证 HaggingFace Markdown FP64 transformers Statistics 搞笑 C++ 域名 git-lfs uWSGI WebCrawler Numpy VSCode uwsgi ResNet-50 SAM UI 报税 LLAMA Shortcut RGB LoRA API v2ray Base64 Color 净利润 Web 证件照 Sklearn Pandas DeepStream Random tqdm PIP Use printf Interview Firewall Hungarian Streamlit Gemma Bin IndexTTS2 torchinfo Knowledge NameSilo Claude Plate XML 关于博主 OCR Excel Crawler Bitcoin TSV TensorFlow 算法题 Anaconda
站点统计

本站现有博文309篇,共被浏览735659

本站已经建立2372天!

热门文章
文章归档
回到顶部