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

本站现有博文337篇,共被浏览961378次

本站已经建立2673天!

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