change some keybindings and complete readme

This commit is contained in:
gameloader 2022-10-31 21:23:09 +08:00
parent f1ad37b19c
commit e9d69cba33
3 changed files with 49 additions and 0 deletions

View File

@ -59,6 +59,7 @@ M.load_default_options = function()
loaded_netrwPlugin = 1, loaded_netrwPlugin = 1,
-- set leaderkey to space -- set leaderkey to space
mapleader = " ", mapleader = " ",
maplocalleader = "\\",
copilot_node_command = "~/.nodenv/versions/16.17.0/bin/node", copilot_node_command = "~/.nodenv/versions/16.17.0/bin/node",
} }

View File

@ -123,10 +123,17 @@ wk.register({
s = { ":Telescope current_buffer_fuzzy_find<CR>", "Searching in buffer" }, s = { ":Telescope current_buffer_fuzzy_find<CR>", "Searching in buffer" },
}, },
}) })
-- insert 模式下ctrl a e跳转开头结尾
map("i", "<C-a>", "<C-o>I", opt)
map("i", "<C-e>", "<C-o>A", opt)
-- change left and right tab -- change left and right tab
-- 左右Tab切换 -- 左右Tab切换
map("n", "<C-h>", ":BufferLineCyclePrev<CR>", opt) map("n", "<C-h>", ":BufferLineCyclePrev<CR>", opt)
map("n", "<C-l>", ":BufferLineCycleNext<CR>", opt) map("n", "<C-l>", ":BufferLineCycleNext<CR>", opt)
map("i", "<C-h>", "<C-o>:BufferLineCyclePrev<CR>", opt)
map("i", "<C-l>", "<C-o>:BufferLineCycleNext<CR>", opt)
-- Mason -- Mason
wk.register({ wk.register({
@ -190,4 +197,23 @@ map("i", "<C-d>", ":lua require'dap'.continue()<CR>", opt)
map("n", "<C-n>", ":lua require'dap'.step_into()<CR>", opt) map("n", "<C-n>", ":lua require'dap'.step_into()<CR>", opt)
map("n", "<C-o>", ":lua require'dap'.step_over()<CR>", opt) map("n", "<C-o>", ":lua require'dap'.step_over()<CR>", opt)
-- set keymap based on file type
vim.cmd("autocmd FileType * lua SetKeybinds()")
function SetKeybinds()
local fileTy = vim.api.nvim_buf_get_option(0, "filetype")
local opts = { prefix = "<localleader>", buffer = 0 }
if fileTy == "markdown" then
wk.register({
["t"] = { ":InsertNToc<CR>", "Insert table of content" },
["d"] = { ":HeaderDecrease<CR>", "All header decrease" },
["i"] = { ":HeaderIncrease<CR>", "All header increase" },
}, opts)
-- elseif fileTy == "sh" then
-- wk.register({
-- ["W"] = { ":w<CR>", "test write" },
-- ["Q"] = { ":q<CR>", "test quit" },
-- }, opts)
end
end
return pluginKeys return pluginKeys

View File

@ -32,6 +32,7 @@
## 快捷键 ## 快捷键
\<leader>键被配置为空格 \<leader>键被配置为空格
\<localleader>被配置为\\
### 常用 ### 常用
| key | function | | key | function |
|----------------|-------------------------------------------| |----------------|-------------------------------------------|
@ -46,6 +47,12 @@
| , | 运行当前文件代码,需要自行配置各种语言 | | , | 运行当前文件代码,需要自行配置各种语言 |
| Ctrl-\\ | 打开终端 | | Ctrl-\\ | 打开终端 |
### Insert模式下特殊按键
| key | function |
|--------|------------|
| Ctrl-a | 跳转到行首 |
| Ctrl-e | 跳转到行尾 |
### Packer ### Packer
| key | function | | key | function |
|-------------|------------------------| |-------------|------------------------|
@ -60,6 +67,10 @@
| \<leader>lI | 打开Mason安装lsp dap 等任意服务 | | \<leader>lI | 打开Mason安装lsp dap 等任意服务 |
| \<leader>ll | 打开Mason查看安装的服务 | | \<leader>ll | 打开Mason查看安装的服务 |
| \<leader>lu | 卸载当前语言对应的lsp | | \<leader>lu | 卸载当前语言对应的lsp |
| \<leader>lr | 重启lsp |
| ]d | 跳转到函数定义 |
| ]i | 跳转到函数实现 |
| ]r | 跳转到函数引用 |
### git ### git
| key | function | | key | function |
@ -83,6 +94,7 @@
| \<leader>bk | 关闭当前buffer | | \<leader>bk | 关闭当前buffer |
| \<leader>bc | 取消高亮(可用于搜索后取消高亮) | | \<leader>bc | 取消高亮(可用于搜索后取消高亮) |
| \<leader>bo | 关闭其他buffer | | \<leader>bo | 关闭其他buffer |
| \<leader>bs | 搜索当前buffer |
### window ### window
| key | function | | key | function |
@ -100,6 +112,16 @@
| \<leader>fr | 最近打开的文件 | | \<leader>fr | 最近打开的文件 |
| \<leader>fs | 在项目文件中搜索字符串 | | \<leader>fs | 在项目文件中搜索字符串 |
| \<leader>fp | 打开项目 | | \<leader>fp | 打开项目 |
| \<leader>fn | 新建文件 |
### markdown
| key | function |
|-----------------|--------------------|
| \<leader>m | 预览markdown |
| \<localleader>t | 在当前位置插入目录 |
| \<localleader>d | 降低所有目录等级 |
| \<localleader>i | 升高所有目录等级 |
## 问题 ## 问题
### 根据文件类型启动某些功能 ### 根据文件类型启动某些功能