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

本站现有博文340篇,共被浏览1017832次

本站已经建立2718天!

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