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

本站现有博文327篇,共被浏览833119

本站已经建立2538天!

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