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

本站现有博文316篇,共被浏览746718

本站已经建立2394天!

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