• Stars
    star
    883
  • Rank 49,855 (Top 2 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created almost 6 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

轻量级 Vim 配置框架,全中文注释

前言

轻量级 Vim 配置框架,全中文注释,这既是一份合理的轻量级配置,更是一份简明教程。话说,网上的 Vim 配置多的数不过来,这里又做一个干嘛?这些配置都有一些问题:

  • 注释不够,很多配置就是劈里啪啦一堆 VimScript 看的人一头雾水,新人顶多只能 “用”,没法跟着 “学”。
  • 大部分都是针对 Vim 7 以前的版本,太过陈旧,对 8.0/8.1 以后的各种现代编辑器特征支持不足。
  • 模块化不够好,全部塞在一个几百行的 vimrc 文件里,各部分搅在一起,增改都比较麻烦。
  • 插件没有分组,不能根据需要灵活选择功能组,所有插件一上就全上了,要禁止就是进去注释代码。
  • 它们有很多错误的地方,比如中文编码都没设对,很多 Windows 下的 PowerShell 脚本都打开不了。
  • 错误的习惯,比如把 jk 映射成 ESC 的,顺着从 a 打倒 z 都打不流畅,输入个 Dijkstra 都输入不了。
  • 对 C/C++ 开发支持不足。

还有不少插件自己给设置门槛的,比如把方向键禁用掉,我见过很多才用 Vim 的新人,大部分都呆在插入模式下,保存文件才会退出一下,至少人家开始用了,等到熟练了,该用 hjkl 的时候自然会去用。你这上来就把方向键和鼠标禁止了,除了阻挡新人外,我不知道有什么作用。

总之,山寨居多,还有某些著名的广为流传的 Vim 配置,我都不想点名了,把 Leader 键映射成逗号了,它不知道逗号/分号在 Vim 里是用来定位 f/t 搜索的下一个/上一个结果的么?就和 n/N 定位斜杠搜索一样。把 Leader 定义成空格我都还觉得挺科学,定义成逗号和分号的这些配置,是在把错误的用法源源不断的交给未来的新用户。

所以网上缺一份合理的轻量级配置,适合新人学习那种,于是有了这个项目。

安装

将项目克隆到你喜欢的目录内,比如 ~/.vim 内:

cd ~/.vim
git clone https://github.com/skywind3000/vim-init.git

然后创建你的 ~/.vimrc 文件,里面只有一句话:

source ~/.vim/vim-init/init.vim

请调整你的终端软件,确保对 ALT 键的支持,以及 Backspace 键发送正确扫描码:

终端软件下正确支持 ALT 键和 Backspace 键

然后启动 Vim,在命令行运行 :PlugInstall 安装依赖插件即可。

结构

本配置按顺序,由如下几个主要模块组成:

  • init.vim: 配置入口,设置 runtimepath 检测脚本路径,加载其他脚本。
  • init-basic.vim: 所有人都能同意的基础配置,去除任何按键和样式定义,保证能用于 tiny 模式(没有 +eval)。
  • init-config.vim: 支持 +eval 的非 tiny 配置,初始化 ALT 键支持,功能键键盘码,备份,终端兼容等
  • init-tabsize.vim: 制表符宽度,是否展开空格等,因为个人差异太大,单独一个文件好更改。
  • init-plugin.vim: 插件,使用 vim-plug,按照设定的插件分组进行配置。
  • init-style.vim: 色彩主题,高亮优化,状态栏,更紧凑的标签栏文字等和显示相关的东西。
  • init-keymaps.vim: 快捷键定义。

最好 fork 一份到你自己的仓库,然后不断修改,把它修改成你自己的东西,平时要更新时到这里同步下上游仓库,然后自己合并一下即可。

除去 vim-plug 额外安装的插件外,本配置自带一些依赖较大的插件,保证内网连不了网的情况下,把本配置压缩包解压一下就能跑得起来,且基本功能可用,它们都比较简单,往往一两个文件,分布于 pluginautoload 两个目录中,你可以根据自己需要增改。

帮助

既然是全中文注释,帮助主要看 init-keymaps.viminit-plugins.vim 两个文件,每个点我都写满了注释了,也是未来你自己可能修改的最多的两个文件。每次你修改或者调试了单个 .vim 配置文件后,命令行输入 :so % 即可重新载入,so 是 source 的简写,意思是加载脚本,% 代表当前正在编辑脚本的名字。

Credit

TODO

More Repositories

1

kcp

⚡ KCP - A Fast and Reliable ARQ Protocol
C
14,566
star
2

awesome-cheatsheets

超级速查表 - 编程语言、框架和开发工具的速查表,单个文件包含一切你需要知道的东西 ⚡
Shell
10,779
star
3

ECDICT

Free English to Chinese Dictionary Database
Python
5,495
star
4

preserve-cd

Game Preservation Project
3,483
star
5

z.lua

⚡ A new cd command that helps you navigate faster by learning your habits.
Lua
2,910
star
6

mini3d

3D Software Renderer in 700 Lines !!
C
2,131
star
7

asyncrun.vim

🚀 Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Vim Script
1,815
star
8

RenderHelp

⚡ 可编程渲染管线实现,帮助初学者学习渲染
C++
1,260
star
9

vim-quickui

The missing UI extensions for Vim 9 (and NeoVim) !! 😎
Vim Script
1,061
star
10

vim

Personal Vim Profile
Vim Script
895
star
11

asynctasks.vim

🚀 Modern Task System for Project Building, Testing and Deploying !!
Vim Script
875
star
12

emake

你见过的最简单的 GCC/CLANG 项目构建工具,定义式构建,比命令式更简单
Python
666
star
13

FastMemcpy

Speed-up over 50% in average vs traditional memcpy in gcc 4.9 or vc2012
C
551
star
14

PyStand

🚀 Python Standalone Deploy Environment !!
C++
543
star
15

preserve-iso

绝版软件保护工程
412
star
16

avlmini

AVL implementation which is as fast/compact as linux's rbtree
C
333
star
17

quickmenu.vim

A nice customizable popup menu for vim
Vim Script
275
star
18

vim-auto-popmenu

😎 Display the Completion Menu Automantically (next AutoComplPop) !!
Vim Script
268
star
19

gutentags_plus

The right way to use gtags with gutentags
Vim Script
258
star
20

vim-terminal-help

Small changes make vim/nvim's internal terminal great again !!
Vim Script
241
star
21

translator

命令行聚合翻译工具,支持谷歌,必应,有道,百度,词霸,360
Python
226
star
22

ECDICT-ultimate

Ultimate ECDICT Database
210
star
23

vim-preview

The missing preview window for vim
Vim Script
166
star
24

pixellib

High Quality 2D Graphics Library
C
155
star
25

images

Static Page
C++
144
star
26

KanaQuiz

Hiragana/Katakana Speed Reading Quiz in Command Line !! 😎
Python
142
star
27

BasicBitmap

Simple and high-performance and platform independent Bitmap class (34% faster than GDI/GDI+, 40% faster than DDraw)
C++
130
star
28

vim-rt-format

😎 Prettify Current Line on Enter !!
Vim Script
113
star
29

AsyncNet

AsyncNet
C
113
star
30

vim-keysound

🍷 Play typewriter sound in Vim when you are typing a letter
Vim Script
111
star
31

Intel2GAS

Convert MSVC Style Inline Assembly to GCC Style Inline Assembly
Python
104
star
32

gobang

Gobang game with artificial intelligence in 900 Lines !!
Python
90
star
33

CloudClip

Your own clipboard in the cloud, copy and paste text with gist between systems !!
Python
76
star
34

googauth

The Python Command-line Reimplementaion of Google Authenticator
Python
74
star
35

LIBLR

Parser Generator for LR(1) and LALR
Python
64
star
36

markpress

Write WordPress in Markdown in Your Favorite Text Editor !! 😎 😎
Python
64
star
37

vim-dict

没办法,被逼的,重新整理一个词典补全的数据库
Vim Script
57
star
38

terminal

Open Terminal Window to execute command in Windows / Cygwin / Ubuntu / OS X
Python
49
star
39

LeaderF-snippet

Intuitive Way to Use Snippet
Vim Script
46
star
40

nanolib

Cross-Platform Networking Library
C
44
star
41

czmod

🚀 Native Module Written in C to Boost z.lua !!
C
43
star
42

collection

没地方放的代码,懒得开新项目了,放这里吧。
Python
38
star
43

vim-gpt-commit

🚀 Generate git commit message using ChatGPT in Vim (and NeoVim) !!
Python
38
star
44

atom-shell-commands

Execute user defined shell commands (looking for new maintainers)
JavaScript
36
star
45

vim-navigator

🚀 Navigate Your Commands Easily !!
Vim Script
28
star
46

ml

Machine Learning From Scratch
C
27
star
47

asyncrun.extra

Extra runners for asyncrun to run your command in Tmux/Gnome-terminal panel, xterm, Floaterm and more.
Vim Script
27
star
48

memslab

Slab Memory Allocator in Application Layer
C
25
star
49

lemma.en

English Lemma Database - Compiled by Referencing British National Corpus
25
star
50

vim-color-patch

🌈 Load colorscheme patch script automatically !!
Vim Script
22
star
51

vim-color-export

🌈 A tool to backport NeoVim colorschemes to Vim !!
Vim Script
19
star
52

zvi

🚀 Smallest Vi-clone Text Editor for Windows CLI and SSH session (only 62KB) !!
17
star
53

asmpure

Asmpure is a library written in C for compiling assembly code at run-time
C
16
star
54

QuickNet

UDP Networking Library
C
16
star
55

docker

Docker Images
Python
16
star
56

VmBasic

基于虚拟机的仿 QuickBasic 语言
C++
14
star
57

vim-cppman

Read Cppman/Man pages right inside your vim.
Vim Script
14
star
58

skywind3000.github.io

Pages of Skywind
Python
12
star
59

language

Language Collection
Python
11
star
60

tcz_cd

Autojump for Total Commander !!
Python
10
star
61

LanguageMark

Native Language Benchmark in Numerous Algorithms
C
10
star
62

vim-proposal

Collection of Proposals for Vim
TypeScript
7
star
63

shell-scripts

常用的命令行脚本合集,让你每天的命令行生活更加高效
Shell
6
star
64

pyp2p

Python P2P Framework
Python
6
star
65

cannon

Cross Platform Network Framework
C
5
star
66

SimdVector

Cross Platform SIMD Vector Math In A Single Header File (SimdVector.h)
C++
5
star
67

crtzero

Zero Dependent on CRT (libc)
C
5
star
68

gosub

Golang Sub-routines for Network Development
Go
5
star
69

support

plugin collections for vim
Python
4
star
70

asyncredis

Async Redis Client for Python
Python
3
star
71

skywind

Personal Blog
HTML
3
star
72

directx9-samples

samples
C++
3
star
73

gfx

Just Another Toy yet !!
C++
3
star
74

treasure

Single-file MIT Licensed C/C++ Portable Libraries
C
3
star
75

winxp-editors

🍷 Text Editors Preservation Project for Windows XP+
Batchfile
3
star
76

colors-from-neovim.vim

🌈 Backported NeoVim Colors for Vim
Vim Script
3
star
77

ones

One single file MIT licensed C/C++ Libraries
2
star
78

asclib

Basic Java Network Lib
Java
2
star
79

toys

My PyQt Desktop Toys
Python
2
star
80

transmod

Automatically exported from code.google.com/p/transmod
C
2
star
81

rust

Rust Learning Repository
1
star
82

vile

Vile the vi-clone text editor
C
1
star
83

xvi

A portable multi-file text editor and the smallest full-function vi clone
C
1
star
84

emacs

Personal Emacs Profile
Emacs Lisp
1
star