add table-mode and toggleterm,change readme
This commit is contained in:
parent
1291acb250
commit
2d25c86d3c
2
init.lua
2
init.lua
@ -14,8 +14,10 @@ require("plugin-config/mason")
|
|||||||
require("plugin-config/lualine")
|
require("plugin-config/lualine")
|
||||||
require("plugin-config/notify")
|
require("plugin-config/notify")
|
||||||
require("plugin-config/nvim-autopairs")
|
require("plugin-config/nvim-autopairs")
|
||||||
|
require("plugin-config/table-mode")
|
||||||
require("plugin-config/project")
|
require("plugin-config/project")
|
||||||
require("plugin-config/dashboard")
|
require("plugin-config/dashboard")
|
||||||
|
require("plugin-config/toggleterm")
|
||||||
require("plugin-config/coderunner")
|
require("plugin-config/coderunner")
|
||||||
require("plugin-config/lazygit")
|
require("plugin-config/lazygit")
|
||||||
-- require("plugin-config/neogit")
|
-- require("plugin-config/neogit")
|
||||||
|
126
lua/basic.lua
126
lua/basic.lua
@ -1,72 +1,68 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.load_default_options = function()
|
M.load_default_options = function()
|
||||||
|
local set_options = {
|
||||||
|
backup = false, -- creates a backup file
|
||||||
|
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
||||||
|
cmdheight = 1, -- more space in the neovim command line for displaying messages
|
||||||
|
completeopt = { "menuone", "noselect" },
|
||||||
|
conceallevel = 0, -- so that `` is visible in markdown files
|
||||||
|
fileencoding = "utf-8", -- the encoding written to a file
|
||||||
|
foldmethod = "manual", -- folding, set to "expr" for treesitter based folding
|
||||||
|
foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
|
||||||
|
guifont = "monospace:h17", -- the font used in graphical neovim applications
|
||||||
|
background = "light", -- set the background to light or dark
|
||||||
|
hidden = true, -- required to keep multiple buffers and open multiple buffers
|
||||||
|
hlsearch = true, -- highlight all matches on previous search pattern
|
||||||
|
ignorecase = true, -- ignore case in search patterns
|
||||||
|
mouse = "a", -- allow the mouse to be used in neovim
|
||||||
|
pumheight = 10, -- pop up menu height
|
||||||
|
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||||
|
showtabline = 2, -- always show tabs
|
||||||
|
smartcase = true, -- smart case
|
||||||
|
smartindent = true, -- make indenting smarter again
|
||||||
|
splitbelow = true, -- force all horizontal splits to go below current window
|
||||||
|
splitright = true, -- force all vertical splits to go to the right of current window
|
||||||
|
swapfile = false, -- creates a swapfile
|
||||||
|
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||||
|
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||||
|
title = true, -- set the title of window to the value of the titlestring
|
||||||
|
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
|
||||||
|
undodir = undodir, -- set an undo directory
|
||||||
|
undofile = true, -- enable persistent undo
|
||||||
|
updatetime = 100, -- faster completion
|
||||||
|
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||||
|
expandtab = true, -- convert tabs to spaces
|
||||||
|
shiftwidth = 2, -- the number of spaces inserted for each indentation
|
||||||
|
tabstop = 2, -- insert 2 spaces for a tab
|
||||||
|
cursorline = true, -- highlight the current line
|
||||||
|
number = true, -- set numbered lines
|
||||||
|
numberwidth = 4, -- set number column width to 2 {default 4}
|
||||||
|
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
||||||
|
wrap = true, -- display lines as one long line
|
||||||
|
-- shadafile = join_paths(get_cache_dir(), "lvim.shada"),
|
||||||
|
scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor.
|
||||||
|
sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor.
|
||||||
|
showcmd = false,
|
||||||
|
ruler = false,
|
||||||
|
laststatus = 3,
|
||||||
|
}
|
||||||
|
|
||||||
local set_options = {
|
for k, v in pairs(set_options) do
|
||||||
backup = false, -- creates a backup file
|
vim.opt[k] = v
|
||||||
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
end
|
||||||
cmdheight = 1, -- more space in the neovim command line for displaying messages
|
|
||||||
completeopt = { "menuone", "noselect" },
|
|
||||||
conceallevel = 0, -- so that `` is visible in markdown files
|
|
||||||
fileencoding = "utf-8", -- the encoding written to a file
|
|
||||||
foldmethod = "manual", -- folding, set to "expr" for treesitter based folding
|
|
||||||
foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
|
|
||||||
guifont = "monospace:h17", -- the font used in graphical neovim applications
|
|
||||||
background = "light", -- set the background to light or dark
|
|
||||||
hidden = true, -- required to keep multiple buffers and open multiple buffers
|
|
||||||
hlsearch = true, -- highlight all matches on previous search pattern
|
|
||||||
ignorecase = true, -- ignore case in search patterns
|
|
||||||
mouse = "a", -- allow the mouse to be used in neovim
|
|
||||||
pumheight = 10, -- pop up menu height
|
|
||||||
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
|
||||||
showtabline = 2, -- always show tabs
|
|
||||||
smartcase = true, -- smart case
|
|
||||||
smartindent = true, -- make indenting smarter again
|
|
||||||
splitbelow = true, -- force all horizontal splits to go below current window
|
|
||||||
splitright = true, -- force all vertical splits to go to the right of current window
|
|
||||||
swapfile = false, -- creates a swapfile
|
|
||||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
|
||||||
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
|
|
||||||
title = true, -- set the title of window to the value of the titlestring
|
|
||||||
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
|
|
||||||
undodir = undodir, -- set an undo directory
|
|
||||||
undofile = true, -- enable persistent undo
|
|
||||||
updatetime = 100, -- faster completion
|
|
||||||
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
|
||||||
expandtab = true, -- convert tabs to spaces
|
|
||||||
shiftwidth = 2, -- the number of spaces inserted for each indentation
|
|
||||||
tabstop = 2, -- insert 2 spaces for a tab
|
|
||||||
cursorline = true, -- highlight the current line
|
|
||||||
number = true, -- set numbered lines
|
|
||||||
numberwidth = 4, -- set number column width to 2 {default 4}
|
|
||||||
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
|
||||||
wrap = true, -- display lines as one long line
|
|
||||||
-- shadafile = join_paths(get_cache_dir(), "lvim.shada"),
|
|
||||||
scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor.
|
|
||||||
sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor.
|
|
||||||
showcmd = false,
|
|
||||||
ruler = false,
|
|
||||||
laststatus = 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v in pairs(set_options) do
|
local let_options = {
|
||||||
vim.opt[k] = v
|
-- disable netrw at the very start of your init.lua (strongly advised)
|
||||||
end
|
loaded = 1,
|
||||||
|
loaded_netrwPlugin = 1,
|
||||||
|
-- set leaderkey to space
|
||||||
|
mapleader = " ",
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v in pairs(let_options) do
|
||||||
|
vim.g[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local let_options = {
|
return M
|
||||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
|
||||||
loaded = 1,
|
|
||||||
loaded_netrwPlugin = 1,
|
|
||||||
-- set leaderkey to space
|
|
||||||
mapleader = " ",
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v in pairs(let_options) do
|
|
||||||
vim.g[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
@ -18,6 +18,20 @@ wk.register({
|
|||||||
-- 代码相关
|
-- 代码相关
|
||||||
map("n", ",", ":RunCode<CR>", opt)
|
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 related
|
||||||
-- git 相关
|
-- git 相关
|
||||||
wk.register({
|
wk.register({
|
||||||
|
@ -1,45 +1,53 @@
|
|||||||
require('Comment').setup{
|
require("Comment").setup({
|
||||||
---Add a space b/w comment and the line
|
---Add a space b/w comment and the line
|
||||||
padding = true,
|
padding = true,
|
||||||
---Whether the cursor should stay at its position
|
---Whether the cursor should stay at its position
|
||||||
sticky = true,
|
sticky = true,
|
||||||
---Lines to be ignored while (un)comment
|
---Lines to be ignored while (un)comment
|
||||||
ignore = "^$",
|
ignore = "^$",
|
||||||
---LHS of toggle mappings in NORMAL mode
|
---LHS of toggle mappings in NORMAL mode
|
||||||
toggler = {
|
toggler = {
|
||||||
---Line-comment toggle keymap
|
---Line-comment toggle keymap
|
||||||
line = 'gcc',
|
line = "gcc",
|
||||||
---Block-comment toggle keymap
|
---Block-comment toggle keymap
|
||||||
block = 'gbc',
|
block = "gbc",
|
||||||
},
|
},
|
||||||
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
||||||
opleader = {
|
opleader = {
|
||||||
---Line-comment keymap
|
---Line-comment keymap
|
||||||
line = 'gc',
|
line = "gc",
|
||||||
---Block-comment keymap
|
---Block-comment keymap
|
||||||
block = 'gb',
|
block = "gb",
|
||||||
},
|
},
|
||||||
---LHS of extra mappings
|
---LHS of extra mappings
|
||||||
extra = {
|
extra = {
|
||||||
---Add comment on the line above
|
---Add comment on the line above
|
||||||
above = 'gcO',
|
above = "gcO",
|
||||||
---Add comment on the line below
|
---Add comment on the line below
|
||||||
below = 'gco',
|
below = "gco",
|
||||||
---Add comment at the end of line
|
---Add comment at the end of line
|
||||||
eol = 'gcA',
|
eol = "gcA",
|
||||||
},
|
},
|
||||||
---Enable keybindings
|
---Enable keybindings
|
||||||
---NOTE: If given `false` then the plugin won't create any mappings
|
---NOTE: If given `false` then the plugin won't create any mappings
|
||||||
mappings = {
|
mappings = {
|
||||||
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
||||||
basic = true,
|
basic = true,
|
||||||
---Extra mapping; `gco`, `gcO`, `gcA`
|
---Extra mapping; `gco`, `gcO`, `gcA`
|
||||||
extra = true,
|
extra = true,
|
||||||
---Extended mapping; `g>` `g<` `g>[count]{motion}` `g<[count]{motion}`
|
---Extended mapping; `g>` `g<` `g>[count]{motion}` `g<[count]{motion}`
|
||||||
extended = false,
|
extended = false,
|
||||||
},
|
},
|
||||||
---Function to call before (un)comment
|
---Function to call before (un)comment
|
||||||
pre_hook = nil,
|
pre_hook = nil,
|
||||||
---Function to call after (un)comment
|
---Function to call after (un)comment
|
||||||
post_hook = nil,
|
post_hook = nil,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
-- cancel auto next line comment
|
||||||
|
-- 取消换行后自动添加注释
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
callback = function()
|
||||||
|
vim.opt.formatoptions = vim.opt.formatoptions - { "o" }
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
5
lua/plugin-config/table-mode.lua
Normal file
5
lua/plugin-config/table-mode.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
local let_table_settings = {}
|
||||||
|
|
||||||
|
for k, v in pairs(let_table_settings) do
|
||||||
|
vim.g[k] = v
|
||||||
|
end
|
8
lua/plugin-config/toggleterm.lua
Normal file
8
lua/plugin-config/toggleterm.lua
Normal 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",
|
||||||
|
})
|
@ -14,6 +14,10 @@ return require("packer").startup(function()
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- a good terminal
|
||||||
|
-- 一个好的nvim内终端
|
||||||
|
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
||||||
|
|
||||||
-- git plugin like magit
|
-- git plugin like magit
|
||||||
-- 类似magit的插件neogit
|
-- 类似magit的插件neogit
|
||||||
-- use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" })
|
-- use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" })
|
||||||
@ -22,6 +26,17 @@ return require("packer").startup(function()
|
|||||||
-- 使用lazygit接口
|
-- 使用lazygit接口
|
||||||
use("kdheepak/lazygit.nvim")
|
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
|
-- nvim-tree for file manage
|
||||||
use({
|
use({
|
||||||
"kyazdani42/nvim-tree.lua",
|
"kyazdani42/nvim-tree.lua",
|
||||||
|
84
readme.md
84
readme.md
@ -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 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user