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

本站现有博文328篇,共被浏览850875

本站已经建立2557天!

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