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

本站现有博文322篇,共被浏览789128

本站已经建立2484天!

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