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

本站现有博文323篇,共被浏览795576

本站已经建立2493天!

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