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

本站现有博文320篇,共被浏览755791

本站已经建立2418天!

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