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

本站现有博文339篇,共被浏览1000407次

本站已经建立2710天!

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