فهرست منبع

vim-mode: <leader>w to save note

Le Tan 8 سال پیش
والد
کامیت
4ad79e4d92
3فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 2 1
      src/resources/docs/shortcuts_en.md
  2. 2 1
      src/resources/docs/shortcuts_zh.md
  3. 4 0
      src/utils/vvim.cpp

+ 2 - 1
src/resources/docs/shortcuts_en.md

@@ -162,7 +162,7 @@ VNote supports a simple but useful Vim mode, including **Normal**, **Insert**, *
 VNote supports following features of Vim:
 
 - `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, and `O`;
-- Actions `d`, `c`, `y`, `p`, `<`, `>`, `gu`, `gU`, and `~`;
+- Actions `d`, `c`, `y`, `p`, `<`, `>`, `gu`, `gU`, `J`, `gJ`, and `~`;
 - Movements `h/j/k/l`, `gj/gk`, `Ctrl+U`, `Ctrl+D`, `gg`, `G`, `0`, `^`, `{`, `}`, and `$`;
 - Marks `a-z`;
 - Registers `"`, `_`, `+`, `a-z`(`A-Z`);
@@ -170,6 +170,7 @@ VNote supports following features of Vim:
 - Leader key (`Space`)
     - Currently `<leader>y/d/p` equals to `"+y/d/p`, which will access the system's clipboard;
     - `<leader><Space>` to clear search highlight;
+    - `<leader>w` to save note;
 - `zz`, `zb`, `zt`;
 - `u` and `Ctrl+R` for undo and redo;
 - Text objects `i/a`: word, WORD, `''`, `""`, `` ` ` ``, `()`, `[]`, `<>`, and `{}`;

+ 2 - 1
src/resources/docs/shortcuts_zh.md

@@ -163,7 +163,7 @@ VNote支持一个简单但有用的Vim模式,包括 **正常**, **插入**
 VNote支持以下几个Vim的特性:
 
 - `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, `O`;
-- 操作 `d`, `c`, `y`, `p`, `<`, `>`, `gu`, `gU`, `~`;
+- 操作 `d`, `c`, `y`, `p`, `<`, `>`, `gu`, `gU`, `J`, `gJ`, `~`;
 - 移动 `h/j/k/l`, `gj/gk`, `Ctrl+U`, `Ctrl+D`, `gg`, `G`, `0`, `^`, `{`, `}`, `$`;
 - 标记 `a-z`;
 - 寄存器 `"`, `_`, `+`, `a-z`(`A-Z`);
@@ -171,6 +171,7 @@ VNote支持以下几个Vim的特性:
 - 前导键 (`Space`)
     - 目前 `<leader>y/d/p` 等同于 `"+y/d/p`, 从而可以访问系统剪切板;
     - `<leader><Space>` 清除查找高亮;
+    - `<leader>w` 保存笔记;
 - `zz`, `zb`, `zt`;
 - `u` 和 `Ctrl+R` 撤销和重做;
 - 文本对象 `i/a`:word, WORD, `''`, `""`, `` ` ` ``, `()`, `[]`, `<>`, `{}`;

+ 4 - 0
src/utils/vvim.cpp

@@ -5459,6 +5459,10 @@ bool VVim::processLeaderSequence(const Key &p_key)
     } else if (p_key == Key(Qt::Key_Space)) {
         // <leader><space>, clear search highlight
         clearSearchHighlight();
+    } else if (p_key == Key(Qt::Key_W)) {
+        // <leader>w, save note
+        emit m_editor->saveNote();
+        message(tr("Note has been saved"));
     } else {
         validSequence = false;
     }