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

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

本站已经建立2493天!

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