Vim是一个强大的文本编辑器,其可以追溯到 20 世纪 70 年代的 Vi,1991 年演变为 Vim(意为 “Vi IMproved”)。 这款工具以纯键盘操作为核心,让用户能够精准高效地掌控代码和文本。 尽管它以学习曲线陡峭著称,一旦你熟悉了它,你会发现它不仅提升了文本处理效率和控制力,还让操作过程看起来非常炫酷。
easyVim项目旨在打造一个简单好用的“阉割版”Vim,用户可以根据此项目学习vim以及c++。
本项目旨在提供如下贡献:
- 一个简单轻量的Vim文本编辑器
- 一个性能优越,接口简洁的文本文件处理库
- 一个轻量好用,便于快速构建启动的c++框架
本项目为南方科技大学
CS219 计算机高级程序设计课程项目
.
├── CMakeLists.txt
├── Doxyfile
├── README.md
├── docs
│ └── ...
├── src
│ ├── include.hpp
│ ├── modules
│ │ ├── CMakeLists.txt
│ │ ├── config.hpp
│ │ ├── lib.cpp
│ │ ├── main.cpp
│ │ ├── show.cpp
│ │ ├── show.hpp
│ │ └── ...
│ └── test
│ ├── CMakeLists.txt
│ ├── test.cpp
│ └── ...
├── third_party
│ ├── ...
│ └── googletest
└── tools
└── ...
示例Linux版本: 5.15.167.4-microsoft-standard-WSL2 x86_64 GNU/Linux (Ubuntu 22.04.4 LTS)
示例编译配置: gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37
-
下载相关依赖
easyVim强依赖于ncurses库,因此需要下载依赖:sudo apt install libncurses5-dev
如果你希望使用
googletest进行测试,那么需要使用依赖:git submodule update --init --recursive
-
编译
在当前文件夹下运行如下指令:
mkdir build && cd build cmake .. -DTEST_OPTION=OFF make -j4
注意:
- 如果您希望运行测试文件,那么需要打开测试选项
-DTEST_OPTION=ON
- 如果您希望运行测试文件,那么需要打开测试选项
-
运行
在当前文件夹下运行如下指令:
cd build/bin ./easyVim yourfile.txt对于测试,可以使用
make test或者./tests/tests -
生成动态库
使用如下命令后可以在
install文件夹下找到对应的动态库链接make install
我们在beta版本中提供了多种实用工具,我们已经进行了初步的测试,您可以通过以下步骤进行部署尝试:
-
中文补丁
- 如果你希望能支持UTF-8文字,那么需要使用
ncursesw库,则下载依赖:
sudo apt install libncursesw5-dev
- 然后在
cmake时您需要打开选项-DUTF8_OPTION=ON
注意:
💣 由于中文字符的特殊性,目前读写中文字符都可能导致排版出现问题 :(
🤯 同时,由于未知原因(代码限制了utf-8的输入识别以避免一些奇怪的问题),我们目前并不支持输入,仅支持显示。
- 如果你希望能支持UTF-8文字,那么需要使用
-
多文件读写工具
- 首先您需要安装
gnome-terminal依赖:
sudo apt install gnome-terminal
- 然后在
cmake时您需要打开选项-DMWS_OPTION=ON - 接下来您可以在
build文件夹下找到可执行文件mevim,使用./mevim运行即可体验!
注意:
-
您有可能需要sudo权限才能正确运行该程序,例如
sudo ./mevim -
如果您正在使用wsl2并且希望多文件读写时能够显示中文字符,并且您的wsl已经配置了中文环境,那么可以尝试(windows11系统):
sudo mkdir -p /usr/share/fonts/windows11 sudo cp /mnt/c/Windows/Fonts/* /usr/share/fonts/windows11 - 首先您需要安装
欢迎所有的issue和pull-request ❤️,我们提供了模板,但是请随意,不必拘泥于模板!
项目中的部分代码来自互联网上的开源代码,相关协议以及链接已在对应代码中标识,还有一部分教程我们没有直接使用其代码,但是也帮助了我们许多。 由于太多了没有办法全部列举出链接,在此感谢所有开源创作者!
Vim is a powerful text editor, which can be traced back to Vi in the 1970s and evolved into Vim (meaning "Vi IMproved") in 1991. This tool focuses on pure keyboard operation, enabling users to precisely and efficiently control code and text. Although it is known for its steep learning curve, once you get familiar with it, you will find that it not only improves the efficiency and control of text processing but also makes the operation process look really cool.
The easyVim project aims to create a simple and user-friendly "lite version" of Vim. Users can learn vim and C++ through this project.
This project intends to make the following contributions:
- A simple and lightweight Vim text editor.
- A text file processing library with superior performance and a concise interface.
- A lightweight and handy C++ framework that is convenient for quick construction and startup.
This project is the course project for the "CS219 Advanced Computer Programming" course at Southern University of Science and Technology.
.
├── CMakeLists.txt
├── Doxyfile
├── README.md
├── docs
│ └──...
├── src
│ ├── include.hpp
│ ├── modules
│ │ ├── CMakeLists.txt
│ │ ├── config.hpp
│ │ ├── lib.cpp
│ │ ├── main.cpp
│ │ ├── show.cpp
│ │ ├── show.hpp
│ │ └──...
│ └── test
│ ├── CMakeLists.txt
│ ├── test.cpp
│ └──...
├── third_party
│ ├──...
│ └── googletest
└── tools
└──...
Example Linux Version: 5.15.167.4-microsoft-standard-WSL2 x86_64 GNU/Linux (Ubuntu 22.04.4 LTS)
Example Compilation Configuration: gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37
- Download Relevant Dependencies
The easyVim strongly depends on the ncurses library, so you need to download the dependencies:
sudo apt install libncurses5-devIf you want to use googletest for testing, then you need to use the following dependencies:
git submodule update --init --recursive- Compilation
Run the following commands in the current folder:
mkdir build && cd build
cmake.. -DTEST_OPTION=OFF
make -j4Note:
-
If you want to run the test files, you need to turn on the test option
-DTEST_OPTION=ON. -
Running
Run the following commands in the current folder:
cd build/bin
./easyVim yourfile.txtFor testing, you can use make test or ./tests/tests.
- Generating Dynamic Libraries
After using the following command, you can find the corresponding dynamic library links in the install folder:
make installWe have provided several practical tools in the beta version, and we have already conducted preliminary tests. You can deploy and try them through the following steps:
-
UTF-8 Support
- If you want to support UTF-8 characters, you need to use the
ncurseswlibrary, and then download the dependencies:
sudo apt install libncursesw5-dev
- Then, when using
cmake, you need to turn on the option-DUTF8_OPTION=ON.
Note:
💣 Due to the particularity of Chinese characters, there may be layout problems when reading and writing Chinese characters at present. :(
- If you want to support UTF-8 characters, you need to use the
-
Multi-file Reading and Writing Tools
- First, you need to install the
gnome-terminaldependency:
sudo apt install gnome-terminal
- Then, when using
cmake, you need to turn on the option-DMWS_OPTION=ON. - Next, you can find the executable file
mevimin thebuildfolder and run it using./mevimto experience it!
Note:
- You may need
sudoprivileges to run the program correctly, for example,sudo./mevim. - If you are using WSL2 and want to display Chinese characters when reading and writing multiple files, and your WSL has been configured with a Chinese environment, you can try (for Windows 11 system):
sudo mkdir -p /usr/share/fonts/windows11 sudo cp /mnt/c/Windows/Fonts/* /usr/share/fonts/windows11 - First, you need to install the
All issues and pull-requests are welcome ❤️. We have provided templates, but feel free to contribute without being restricted by the templates!
Some of the code in this project comes from open-source code on the Internet. The relevant agreements and links have been marked in the corresponding code. There is also a part of the tutorials that we didn't directly use their code but were also of great help to us. Since there are too many to list all the links, we would like to thank all open-source creators here!

