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

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

本站已经建立2505天!

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