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

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

本站已经建立2583天!

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