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

本站现有博文332篇,共被浏览875311

本站已经建立2583天!

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