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

本站现有博文324篇,共被浏览822621

本站已经建立2528天!

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