Last active
February 8, 2023 01:17
-
-
Save ueaner/050beca4993fdbddc7679dad7160bd32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://github.com/chzyer/readline/blob/master/doc/shortcut.md | |
| -- Readline-style keymap for insert mode | |
| -- stylua: ignore start | |
| vim.keymap.set("i", "<C-A>", "<Home>") -- 移动:行首 | |
| vim.keymap.set("i", "<C-E>", "<End>") -- 移动:行尾 | |
| vim.keymap.set("i", "<C-B>", "<Left>") -- 移动:向左一个字符 | |
| vim.keymap.set("i", "<C-F>", "<Right>") -- 移动:向右一个字符 | |
| -- :help i_CTRL-H -- 删除:光标前一个字符 | |
| vim.keymap.set("i", "<C-D>", "<Del>") -- 删除:光标后一个字符 | |
| -- :help i_CTRL-W 依赖 iskeyword 选项 -- 删除:光标前一个单词 | |
| -- :help i_CTRL-U 且保存到剪切板 | |
| vim.keymap.set("i", "<C-U>", "<Esc>v<Home>di") -- 删除:光标前所有字符 | |
| -- :help i_CTRL-O execute one command, return to Insert mode | |
| vim.keymap.set("i", "<C-K>", "<C-O>D") -- 删除:光标后所有字符 | |
| vim.cmd("inoremap <C-K> <C-O>D") -- 删除:光标后所有字符 | |
| vim.keymap.set("i", "<C-Y>", "<Esc>Pa") -- 粘贴 | |
| -- stylua: ignore end | |
| -- Readline-style keymap for command mode | |
| vim.keymap.set("c", "<C-A>", "<Home>") | |
| -- :help c_CTRL-E | |
| vim.keymap.set("c", "<C-B>", "<Left>") | |
| vim.keymap.set("c", "<C-F>", "<Right>") | |
| -- :help i_CTRL-H | |
| vim.keymap.set("c", "<C-D>", "<Del>") | |
| -- :help c_CTRL-W | |
| -- :help c_CTRL-U | |
| -- cnoremap <C-K> <C-\>e getcmdpos() == 1 ? '' : getcmdline()[:getcmdpos()-2]<CR> | |
| -- :help c_CTRL-\_e Evaluate {expr} and replace the whole command line with the result. | |
| vim.keymap.set("c", "<C-K>", "<C-\\>e getcmdpos() == 1 ? '' : getcmdline()[:getcmdpos()-2]<CR>") | |
| -- :help c_CTRL-Y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment