add table-mode and toggleterm,change readme

This commit is contained in:
gameloader 2022-10-07 19:27:54 +08:00
parent 1291acb250
commit 2d25c86d3c
8 changed files with 242 additions and 110 deletions

View File

@ -14,8 +14,10 @@ require("plugin-config/mason")
require("plugin-config/lualine")
require("plugin-config/notify")
require("plugin-config/nvim-autopairs")
require("plugin-config/table-mode")
require("plugin-config/project")
require("plugin-config/dashboard")
require("plugin-config/toggleterm")
require("plugin-config/coderunner")
require("plugin-config/lazygit")
-- require("plugin-config/neogit")

View File

@ -1,7 +1,6 @@
local M = {}
M.load_default_options = function()
local set_options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
@ -53,7 +52,6 @@ M.load_default_options = function()
vim.opt[k] = v
end
local let_options = {
-- disable netrw at the very start of your init.lua (strongly advised)
loaded = 1,
@ -67,6 +65,4 @@ M.load_default_options = function()
end
end
return M

View File

@ -18,6 +18,20 @@ wk.register({
-- 代码相关
map("n", ",", ":RunCode<CR>", opt)
-- markdown related
-- markdown 相关
wk.register({
["<Leader>m"] = { ":MarkdownPreview<CR>", "Markdown preview" },
})
-- markdown table
-- markdown 表格
wk.register({
["<Leader>t"] = {
name = "+Table",
},
})
-- git related
-- git 相关
wk.register({

View File

@ -1,4 +1,4 @@
require('Comment').setup{
require("Comment").setup({
---Add a space b/w comment and the line
padding = true,
---Whether the cursor should stay at its position
@ -8,25 +8,25 @@ require('Comment').setup{
---LHS of toggle mappings in NORMAL mode
toggler = {
---Line-comment toggle keymap
line = 'gcc',
line = "gcc",
---Block-comment toggle keymap
block = 'gbc',
block = "gbc",
},
---LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
---Line-comment keymap
line = 'gc',
line = "gc",
---Block-comment keymap
block = 'gb',
block = "gb",
},
---LHS of extra mappings
extra = {
---Add comment on the line above
above = 'gcO',
above = "gcO",
---Add comment on the line below
below = 'gco',
below = "gco",
---Add comment at the end of line
eol = 'gcA',
eol = "gcA",
},
---Enable keybindings
---NOTE: If given `false` then the plugin won't create any mappings
@ -42,4 +42,12 @@ require('Comment').setup{
pre_hook = nil,
---Function to call after (un)comment
post_hook = nil,
}
})
-- cancel auto next line comment
-- 取消换行后自动添加注释
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
vim.opt.formatoptions = vim.opt.formatoptions - { "o" }
end,
})

View File

@ -0,0 +1,5 @@
local let_table_settings = {}
for k, v in pairs(let_table_settings) do
vim.g[k] = v
end

View File

@ -0,0 +1,8 @@
require("toggleterm").setup({
open_mapping = [[<C-\>]],
insert_mapping = true,
start_in_insert = true,
autochdir = true,
auto_scroll = false, -- automatically scroll to the bottom on terminal output
direction = "horizontal",
})

View File

@ -14,6 +14,10 @@ return require("packer").startup(function()
end,
})
-- a good terminal
-- 一个好的nvim内终端
use({ "akinsho/toggleterm.nvim", tag = "*" })
-- git plugin like magit
-- 类似magit的插件neogit
-- use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" })
@ -22,6 +26,17 @@ return require("packer").startup(function()
-- 使用lazygit接口
use("kdheepak/lazygit.nvim")
----------------- markdown --------------------
-- markdown preview
-- markdown自动预览
use({
"iamcco/markdown-preview.nvim",
})
-- markdown table
-- 优化markdown添加表格
use("dhruvasagar/vim-table-mode")
-- nvim-tree for file manage
use({
"kyazdani42/nvim-tree.lua",

View File

@ -0,0 +1,84 @@
# Neovim 配置
这次决定从头开始打造自己的编辑器,其中所有的功能都是自行组装
使用的插件列表如下
| name | decription |
|---------------------------------|---------------------------------------------------------------------|
| nvim-telescope/telescope.nvim | 查找,过滤,预览文件 |
| kdheepak/lazygit.nvim | 与lazygit进行集成,需要自行安装lazygit,用法可参考lazygit的github页面 |
| nvim-treesitter/nvim-treesitter | 高性能的语法高亮 |
| folke/which-key.nvim | 快捷键弹窗查看和更方便的快捷键设置 |
| akinsho/bufferline.nvim | 顶部标签栏 |
| hrsh7th/nvim-cmp | 优秀的补全插件 |
| hrsh7th/cmp-path | 补全路径 |
| hrsh7th/cmp-buffer | 缓冲区内重复单词补全 |
| hrsh7th/cmp-nvim-lsp | 补全与lsp的集成 |
| kyazdani42/nvim-tree.lua | 文件查看器,不用多说 |
| numToStr/Comment.nvim | 强大的注释插件 |
| windwp/nvim-autopairs | 括号自动补全 |
| ahmedkhalf/project.nvim | 出色的项目管理工具,可与telescope集成 |
| jose-elias-alvarez/null-ls.nvim | 代码格式化工具,还可提供其他与lsp集成的功能 |
| neovim/nvim-lspconfig | 快速的lsp配置工具 |
| williamboman/mason.nvim | lsp-installer作者的新作,方便管理lsp dap linter formatter等 |
| rafamadriz/friendly-snippets | 自定义各种语言的一些代码模板 |
| nvim-lualine/lualine.nvim | 底部状态栏 |
| wbthomason/packer.nvim | 大名鼎鼎的包管理工具 |
| rcarriga/nvim-notify | 现代化的消息弹窗提示 |
| akinsho/toggleterm.nvim | 优秀的nvim集成终端 |
| mfussenegger/nvim-dap | neovim 的dap实现 |
## 快捷键
\<leader>键被配置为空格
### 常用
| key | function |
|----------------|-------------------------------------------|
| n | 打开nvim-tree文件浏览 |
| f | 打开telescope进行文件查找 |
| Ctrl-h | 切换到左标签栏 |
| Ctrl-l | 切换到右标签栏 |
| \<leader>q | 退出neovim |
| \<leader>s | 保存当前文件 |
| \<leader>S | 保存所有文件 |
| \<leader><tab> | 切换回上一个buffer,用于两buffer间来回切换 |
### Packer
| key | function |
|-------------|------------------------|
| \<leader>pi | 包同步PackerSync |
| \<leader>pc | 包清理PackerClean |
| \<leader>ps | 包状态查看PackerStatus |
### lsp
| key | function |
|-------------|---------------------------------|
| \<leader>li | 安装当前文件语言对应的lsp服务 |
| \<leader>lI | 打开Mason安装lsp dap 等任意服务 |
| \<leader>ll | 打开Mason查看安装的服务 |
| \<leader>lu | 卸载当前语言对应的lsp |
### git
| key | function |
|------------|-----------------|
| \<leader>g | 打开lazygit界面 |
### dap
| key | function |
|-------------|-----------|
| \<leader>db | 打断点 |
| \<leader>de | 停止debug |
| \<leader>dc | 清理断点 |
| \<leader>dr | 开始debug |
| \<Ctrl-n> | step into |
| \<Ctrl-o> | step over |