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

本站现有博文333篇,共被浏览918139

本站已经建立2623天!

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