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/>.