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

本站现有博文335篇,共被浏览937520

本站已经建立2648天!

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