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

本站现有博文337篇,共被浏览957762次

本站已经建立2669天!

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