惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
B
Blog
博客园_首页
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
量子位
V
V2EX
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
I
InfoQ
博客园 - 【当耐特】

Louis C Deng's Blog

RoPE: Properties, Patterns, and Long-Context Behavior CS336 Assignment 1: Large Language Model Training and Inference CS231n Lecture Note: Generative Models CS231n Lecture Note: Self-Supervised Learning CS231n Lecture Note: Large Scale Distributed Training 自動微分 | DIY 實現自己的 PyTorch From RNNs to Transformers CS231n Lecture Note VII: Recurrent Neural Networks Uncovering Batch & Layer Normalization CS231n Lecture Note VI: CNN Architectures and Training CS231n Lecture Note V: Convolution Neural Networks Basics Demystifying Softmax Loss: A Step-by-Step Derivation for Linear Classifiers Backpropagation: A Vector Calculus Perspective CS231n Lecture Note IV: Neural Networks and Backpropagation CS231n Lecture Note III: Optimization CS231n Lecture Note II: Linear Classifiers CS231n Lecture Note I: Image Classification CSAPP Cache Lab II: Optimizing Matrix Transposition CSAPP Cache Lab I: Let's simulate a cache memory! CS188 Search Lecture Notes III CS188 Search Lecture Notes II How to Use TouchID for Sudo Commands on macOS CS188 Search Lecture Notes I RECAP2025: 留白 CSAPP Bomb Lab 解析 x64 暫存器速查表 CSAPP Data Lab 解析 矩陣的 Modified Gram Schmidt 方法 聊一聊位掩碼(Bit Mask) 整數溢位與未定義行為
vimrc 配置指南
Louis C Deng · 2020-07-26 · via Louis C Deng's Blog

Vim 即 Vi Improved,它的前身是 Vi。它是一個十分強大的編輯器,優點如下:

  • 不需要滑鼠,純鍵盤
  • Linux 系統預裝
  • 鍵盤命令肌肉記憶之後,效率非常高

但是,它的配置許許多多,讓人難以記住。我正好要在新電腦上配置它,故寫此文。

為什麼不用別人現成的?

  1. 自己的配置更順手,自己更熟悉。
  2. 瞭解 Vim Script,可以自己造外掛
  3. etc.

不會 Vim 怎麼辦

啊這…… 🤣

你可以試著在命令列輸入 vimtutor

vimrc 的位置

本篇文章以新安裝的 vim 為例。Vim 的配置檔案叫做 vimrc。在 Mac、Linux 等系統上,位於 ~/.vimrc。在 Windows 系統中,它叫做 _vimrc,但是同樣位於 Home 目錄中。

全域性的配置,在 Mac、Linux 等系統上,位於 /etc/vimrc。在 Windows 系統上,它儲存在 Vim 安裝目錄,同樣叫做 vimrc

配置

一個什麼也沒有配置的 Vim,開啟可能是這樣的:

image.png

下面各配置,你可以新增自己想要的。以下所有配置都可以在命令模式輸入,臨時啟用或關閉。

基本

1
2
3
4
5
6
7
8
9
set nocompatible 
filetype plugin on
syntax on
set showmode
set showcmd
set mouse=a
set encoding=utf-8
set t_Co=256
filetype indent on

縮排

1
2
3
4
5
set autoindent 
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=2

介面

1
2
3
4
5
6
7
8
9
set number 
set relativenumber
set cursorline
colorscheme default
set wrap
set linebreak
set laststatus=2
set ruler
set showmatch

搜尋

1
2
3
set hlsearch 
set incsearch
set ignorecase

更多

Vim 配置不止這些,我只介紹了一些常用的。Vim Script 值得學習,學完了還可以自己開發外掛。

題外話 - 外掛

外掛管理,Vim 雖然新增了自帶的,但我還是很推薦 Vim-Plug