mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
vim-mode: <leader>w to save note
This commit is contained in:
parent
3daa463a6d
commit
4ad79e4d92
@ -162,7 +162,7 @@ VNote supports a simple but useful Vim mode, including **Normal**, **Insert**, *
|
|||||||
VNote supports following features of Vim:
|
VNote supports following features of Vim:
|
||||||
|
|
||||||
- `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, and `O`;
|
- `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 `$`;
|
- Movements `h/j/k/l`, `gj/gk`, `Ctrl+U`, `Ctrl+D`, `gg`, `G`, `0`, `^`, `{`, `}`, and `$`;
|
||||||
- Marks `a-z`;
|
- Marks `a-z`;
|
||||||
- Registers `"`, `_`, `+`, `a-z`(`A-Z`);
|
- Registers `"`, `_`, `+`, `a-z`(`A-Z`);
|
||||||
@ -170,6 +170,7 @@ VNote supports following features of Vim:
|
|||||||
- Leader key (`Space`)
|
- Leader key (`Space`)
|
||||||
- Currently `<leader>y/d/p` equals to `"+y/d/p`, which will access the system's clipboard;
|
- Currently `<leader>y/d/p` equals to `"+y/d/p`, which will access the system's clipboard;
|
||||||
- `<leader><Space>` to clear search highlight;
|
- `<leader><Space>` to clear search highlight;
|
||||||
|
- `<leader>w` to save note;
|
||||||
- `zz`, `zb`, `zt`;
|
- `zz`, `zb`, `zt`;
|
||||||
- `u` and `Ctrl+R` for undo and redo;
|
- `u` and `Ctrl+R` for undo and redo;
|
||||||
- Text objects `i/a`: word, WORD, `''`, `""`, `` ` ` ``, `()`, `[]`, `<>`, and `{}`;
|
- Text objects `i/a`: word, WORD, `''`, `""`, `` ` ` ``, `()`, `[]`, `<>`, and `{}`;
|
||||||
|
@ -163,7 +163,7 @@ VNote支持一个简单但有用的Vim模式,包括 **正常**, **插入**
|
|||||||
VNote支持以下几个Vim的特性:
|
VNote支持以下几个Vim的特性:
|
||||||
|
|
||||||
- `r`, `s`, `S`, `i`, `I`, `a`, `A`, `c`, `C`, `o`, `O`;
|
- `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`, `^`, `{`, `}`, `$`;
|
- 移动 `h/j/k/l`, `gj/gk`, `Ctrl+U`, `Ctrl+D`, `gg`, `G`, `0`, `^`, `{`, `}`, `$`;
|
||||||
- 标记 `a-z`;
|
- 标记 `a-z`;
|
||||||
- 寄存器 `"`, `_`, `+`, `a-z`(`A-Z`);
|
- 寄存器 `"`, `_`, `+`, `a-z`(`A-Z`);
|
||||||
@ -171,6 +171,7 @@ VNote支持以下几个Vim的特性:
|
|||||||
- 前导键 (`Space`)
|
- 前导键 (`Space`)
|
||||||
- 目前 `<leader>y/d/p` 等同于 `"+y/d/p`, 从而可以访问系统剪切板;
|
- 目前 `<leader>y/d/p` 等同于 `"+y/d/p`, 从而可以访问系统剪切板;
|
||||||
- `<leader><Space>` 清除查找高亮;
|
- `<leader><Space>` 清除查找高亮;
|
||||||
|
- `<leader>w` 保存笔记;
|
||||||
- `zz`, `zb`, `zt`;
|
- `zz`, `zb`, `zt`;
|
||||||
- `u` 和 `Ctrl+R` 撤销和重做;
|
- `u` 和 `Ctrl+R` 撤销和重做;
|
||||||
- 文本对象 `i/a`:word, WORD, `''`, `""`, `` ` ` ``, `()`, `[]`, `<>`, `{}`;
|
- 文本对象 `i/a`:word, WORD, `''`, `""`, `` ` ` ``, `()`, `[]`, `<>`, `{}`;
|
||||||
|
@ -5459,6 +5459,10 @@ bool VVim::processLeaderSequence(const Key &p_key)
|
|||||||
} else if (p_key == Key(Qt::Key_Space)) {
|
} else if (p_key == Key(Qt::Key_Space)) {
|
||||||
// <leader><space>, clear search highlight
|
// <leader><space>, clear search highlight
|
||||||
clearSearchHighlight();
|
clearSearchHighlight();
|
||||||
|
} else if (p_key == Key(Qt::Key_W)) {
|
||||||
|
// <leader>w, save note
|
||||||
|
emit m_editor->saveNote();
|
||||||
|
message(tr("Note has been saved"));
|
||||||
} else {
|
} else {
|
||||||
validSequence = false;
|
validSequence = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user