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

本站现有博文338篇,共被浏览977873次

本站已经建立2690天!

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