ewig
1.0.0
ewig是一个简单的文本编辑器(Ersatz Emacs),使用 C++ 中的不可变数据结构编写。
该代码以简单的风格编写,以展示基于价值的功能架构。我们邀请您研究代码。在CppCon'17 演讲中了解更多信息:后现代不可变数据结构。
该项目是帮助交互式和并发 C++ 程序变得更容易编写的长期愿景的一部分。通过成为赞助人或购买赞助套餐来帮助该项目的长期可持续性: [email protected]
如果您使用 Nix 包管理器(我们强烈推荐它),您只需安装该软件即可。
nix-env -if https://github.com/arximboldi/ewig/archive/master.tar.gz
要构建代码,您需要 C++17 编译器、 cmake
和支持 unicode 的ncurses
(Debian 及其朋友中的软件包libncursesw5-dev
)。
您可以手动安装它们,但启动并运行开发环境的最简单方法是使用 Nix 包管理器。在存储库的根目录中只需键入:
nix-shell
这将下载所有必需的依赖项并创建一个隔离的环境,您可以在其中使用这些依赖项,而不会污染您的系统。
然后就可以使用CMake生成开发项目了。
mkdir build && cd build
cmake ..
要配置优化的构建和编译,请执行以下操作:
cmake .. -DCMAKE_BUILD_TYPE=Release
make
全局安装已编译的软件:
sudo make install
摘自main.cpp
:
const auto key_map_emacs = make_key_map(
{
{ key::seq ( key::ctrl ( ' p ' )), " move-up " },
{ key::seq (key::up), " move-up " },
{ key::seq (key::down), " move-down " },
{ key::seq ( key::ctrl ( ' n ' )), " move-down " },
{ key::seq ( key::ctrl ( ' b ' )), " move-left " },
{ key::seq (key::left), " move-left " },
{ key::seq ( key::ctrl ( ' f ' )), " move-right " },
{ key::seq (key::right), " move-right " },
{ key::seq (key::page_down), " page-down " },
{ key::seq (key::page_up), " page-up " },
{ key::seq (key::backspace), " delete-char " },
{ key::seq (key::backspace_), " delete-char " },
{ key::seq (key::delete_), " delete-char-right " },
{ key::seq (key::home), " move-beginning-of-line " },
{ key::seq ( key::ctrl ( ' a ' )), " move-beginning-of-line " },
{ key::seq (key::end), " move-end-of-line " },
{ key::seq ( key::ctrl ( ' e ' )), " move-end-of-line " },
{ key::seq ( key::ctrl ( ' i ' )), " insert-tab " }, // tab
{ key::seq ( key::ctrl ( ' j ' )), " new-line " }, // enter
{ key::seq ( key::ctrl ( ' k ' )), " kill-line " },
{ key::seq ( key::ctrl ( ' w ' )), " cut " },
{ key::seq ( key::ctrl ( ' y ' )), " paste " },
{ key::seq ( key::ctrl ( ' @ ' )), " start-selection " }, // ctrl-space
{ key::seq ( key::ctrl ( ' _ ' )), " undo " },
{ key::seq ( key::ctrl ( ' x ' ), key::ctrl ( ' C ' )), " quit " },
{ key::seq ( key::ctrl ( ' x ' ), key::ctrl ( ' S ' )), " save " },
{ key::seq ( key::ctrl ( ' x ' ), ' h ' ), " select-whole-buffer " },
{ key::seq ( key::ctrl ( ' x ' ), ' [ ' ), " move-beginning-buffer " },
{ key::seq ( key::ctrl ( ' x ' ), ' ] ' ), " move-end-buffer " },
{ key::seq ( key::alt ( ' w ' )), " copy " },
});
该软件根据 GPLv3 许可证获得许可。
Copyright (C) 2016 Juan Pedro Bolivar Puente
This file is part of ewig.
ewig is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ewig is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ewig. If not, see <http://www.gnu.org/licenses/>.