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

本站现有博文333篇,共被浏览922118

本站已经建立2628天!

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