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

本站现有博文332篇,共被浏览869589

本站已经建立2578天!

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