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

本站现有博文342篇,共被浏览1056914次

本站已经建立2730天!

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