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

本站现有博文332篇,共被浏览900591

本站已经建立2602天!

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