add some plugin and complete config
This commit is contained in:
parent
00b293c1d8
commit
c7757805df
11
init.lua
11
init.lua
@ -5,20 +5,25 @@ require("plugins")
|
|||||||
require("keybindings")
|
require("keybindings")
|
||||||
|
|
||||||
require("plugin-config/nvim-tree")
|
require("plugin-config/nvim-tree")
|
||||||
require("plugin-config/bufferline")
|
require("plugin-config/buffer_line")
|
||||||
|
require("plugin-config/spectre")
|
||||||
require("plugin-config/treesitter")
|
require("plugin-config/treesitter")
|
||||||
require("plugin-config/telescope")
|
require("plugin-config/telescope")
|
||||||
require("plugin-config/whichkey")
|
require("plugin-config/whichkey")
|
||||||
require("plugin-config/comment")
|
require("plugin-config/comment")
|
||||||
require("plugin-config/mason")
|
require("plugin-config/mason")
|
||||||
require("plugin-config/lualine")
|
require("plugin-config/lua_line")
|
||||||
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/table-mode")
|
||||||
|
require("plugin-config/orgmode")
|
||||||
require("plugin-config/project")
|
require("plugin-config/project")
|
||||||
require("plugin-config/dashboard")
|
require("plugin-config/dashboard")
|
||||||
require("plugin-config/JABS")
|
require("plugin-config/neoscroll")
|
||||||
|
require("plugin-config/hop")
|
||||||
|
-- require("plugin-config/JABS")
|
||||||
require("plugin-config/toggleterm")
|
require("plugin-config/toggleterm")
|
||||||
|
require("plugin-config/indent-blankline")
|
||||||
require("plugin-config/coderunner")
|
require("plugin-config/coderunner")
|
||||||
require("plugin-config/lazygit")
|
require("plugin-config/lazygit")
|
||||||
-- require("plugin-config/neogit")
|
-- require("plugin-config/neogit")
|
||||||
|
@ -28,7 +28,7 @@ M.load_default_options = function()
|
|||||||
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
|
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
|
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
|
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
|
||||||
undodir = undodir, -- set an undo directory
|
-- undodir = undodir, -- set an undo directory
|
||||||
undofile = true, -- enable persistent undo
|
undofile = true, -- enable persistent undo
|
||||||
updatetime = 100, -- faster completion
|
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
|
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
|
||||||
@ -58,6 +58,7 @@ M.load_default_options = function()
|
|||||||
loaded_netrwPlugin = 1,
|
loaded_netrwPlugin = 1,
|
||||||
-- set leaderkey to space
|
-- set leaderkey to space
|
||||||
mapleader = " ",
|
mapleader = " ",
|
||||||
|
copilot_node_command = "~/.nodenv/versions/16.17.0/bin/node",
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(let_options) do
|
for k, v in pairs(let_options) do
|
||||||
|
@ -50,6 +50,7 @@ wk.register({
|
|||||||
r = { ":Telescope oldfiles<CR>", "Recent files" },
|
r = { ":Telescope oldfiles<CR>", "Recent files" },
|
||||||
f = { ":Telescope file_browser<CR>", "File browser" },
|
f = { ":Telescope file_browser<CR>", "File browser" },
|
||||||
n = { ":enew<CR>", "New file" },
|
n = { ":enew<CR>", "New file" },
|
||||||
|
s = { ":Telescope live_grep<CR>", "Search in project" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -103,9 +104,10 @@ wk.register({
|
|||||||
name = "+Buffer",
|
name = "+Buffer",
|
||||||
k = { ":bd!<CR>", "Kill buffer" },
|
k = { ":bd!<CR>", "Kill buffer" },
|
||||||
o = { ":BufferLineCloseRight<CR>:BufferLineCloseLeft<CR>", "Close other buffer" },
|
o = { ":BufferLineCloseRight<CR>:BufferLineCloseLeft<CR>", "Close other buffer" },
|
||||||
b = { ":JABSOpen<CR>", "Open buffers" },
|
b = { ":Telescope buffers<CR>", "Open buffers" },
|
||||||
n = { ":ls<CR>", "Buffer numbers" },
|
n = { ":ls<CR>", "Buffer numbers" },
|
||||||
c = { ":noh<CR>", "Cancel highlight" },
|
c = { ":noh<CR>", "Cancel highlight" },
|
||||||
|
s = { ":lua require('spectre').open_file_search()<CR>", "Searching in buffer" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
-- change left and right tab
|
-- change left and right tab
|
||||||
|
@ -19,6 +19,7 @@ cmp.setup({
|
|||||||
},
|
},
|
||||||
-- 来源
|
-- 来源
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
|
{ name = "orgmode" },
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
-- For vsnip users.
|
-- For vsnip users.
|
||||||
-- { name = "vsnip" },
|
-- { name = "vsnip" },
|
||||||
|
@ -37,7 +37,7 @@ local opts = {
|
|||||||
|
|
||||||
-- local function buf_set_keymap(...)
|
-- local function buf_set_keymap(...)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
end
|
end,
|
||||||
-- -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
-- -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
-- -- 绑定快捷键
|
-- -- 绑定快捷键
|
||||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||||
@ -45,7 +45,7 @@ local opts = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||||
opts.capabilities = capabilities
|
opts.capabilities = capabilities
|
||||||
|
|
||||||
-- 查看目录等信息
|
-- 查看目录等信息
|
||||||
|
3
lua/plugin-config/buffer_line.lua
Normal file
3
lua/plugin-config/buffer_line.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
require("bufferline").setup({
|
||||||
|
options = {},
|
||||||
|
})
|
@ -1,4 +0,0 @@
|
|||||||
require("bufferline").setup {
|
|
||||||
options = {
|
|
||||||
}
|
|
||||||
}
|
|
11
lua/plugin-config/cmake_tool.lua
Normal file
11
lua/plugin-config/cmake_tool.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
require("cmake-tools").setup({
|
||||||
|
cmake_command = "cmake",
|
||||||
|
cmake_build_directory = "build",
|
||||||
|
cmake_build_type = "Debug",
|
||||||
|
cmake_generate_options = { "-D", "CMAKE_EXPORT_COMPILE_COMMANDS=1" },
|
||||||
|
cmake_build_options = {},
|
||||||
|
cmake_console_size = 10, -- cmake output window height
|
||||||
|
cmake_show_console = "always", -- "always", "only_on_error"
|
||||||
|
cmake_dap_configuration = { name = "cpp", type = "codelldb", request = "launch" }, -- dap configuration, optional
|
||||||
|
cmake_dap_open_command = require("dap").repl.open, -- optional
|
||||||
|
})
|
@ -3,5 +3,6 @@ require("code_runner").setup({
|
|||||||
filetype = {
|
filetype = {
|
||||||
c = "cd $dir && gcc $fileName -o $fileNameWithoutExt -g && $dir/$fileNameWithoutExt",
|
c = "cd $dir && gcc $fileName -o $fileNameWithoutExt -g && $dir/$fileNameWithoutExt",
|
||||||
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt -g && $dir/$fileNameWithoutExt",
|
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt -g && $dir/$fileNameWithoutExt",
|
||||||
|
go = "cd $dir && go run $fileName",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1 +1,38 @@
|
|||||||
local db = require('dashboard')
|
local db = require("dashboard")
|
||||||
|
db.custom_header = {
|
||||||
|
"",
|
||||||
|
"┳┻| ",
|
||||||
|
"┻┳| ",
|
||||||
|
"┳┻|ヘ ∧ ",
|
||||||
|
"┻┳| ● w ● )",
|
||||||
|
"┳┻|⊂ノ ",
|
||||||
|
"┻┳|J ",
|
||||||
|
"",
|
||||||
|
}
|
||||||
|
|
||||||
|
db.custom_center = {
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Find File ",
|
||||||
|
action = "Telescope find_files find_command=rg,--hidden,--files",
|
||||||
|
shortcut = " f",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Recently opened files ",
|
||||||
|
action = "Telescope oldfiles",
|
||||||
|
shortcut = "SPC f r",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Open Project ",
|
||||||
|
action = "Telescope Project ",
|
||||||
|
shortcut = "SPC f p",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "File Browser ",
|
||||||
|
action = "Telescope file_browser",
|
||||||
|
shortcut = "SPC f f",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
14
lua/plugin-config/hop.lua
Normal file
14
lua/plugin-config/hop.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
require("hop").setup({})
|
||||||
|
--- place this in one of your configuration file(s)
|
||||||
|
local hop = require("hop")
|
||||||
|
local directions = require("hop.hint").HintDirection
|
||||||
|
vim.keymap.set("", "f", function()
|
||||||
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
|
||||||
|
end, { remap = true })
|
||||||
|
vim.keymap.set("", "F", function()
|
||||||
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
||||||
|
end, { remap = true })
|
||||||
|
|
||||||
|
vim.keymap.set("", "t", function()
|
||||||
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = 0 })
|
||||||
|
end, { remap = true })
|
7
lua/plugin-config/indent-blankline.lua
Normal file
7
lua/plugin-config/indent-blankline.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require("indent_blankline").setup({
|
||||||
|
-- for example, context is off by default, use this to turn it on
|
||||||
|
show_current_context = true,
|
||||||
|
indent_blankline_use_treesitter = true,
|
||||||
|
indent_blankline_use_treesitter_scope = true,
|
||||||
|
indent_blankline_char = "¦",
|
||||||
|
})
|
@ -36,5 +36,5 @@ require("lualine").setup({
|
|||||||
tabline = {},
|
tabline = {},
|
||||||
winbar = {},
|
winbar = {},
|
||||||
inactive_winbar = {},
|
inactive_winbar = {},
|
||||||
extensions = {},
|
extensions = { "quickfix" },
|
||||||
})
|
})
|
12
lua/plugin-config/neoscroll.lua
Normal file
12
lua/plugin-config/neoscroll.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
require("neoscroll").setup({
|
||||||
|
-- All these keys will be mapped to their corresponding default scrolling animation
|
||||||
|
mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
|
||||||
|
hide_cursor = true, -- Hide cursor while scrolling
|
||||||
|
stop_eof = true, -- Stop at <EOF> when scrolling downwards
|
||||||
|
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
|
||||||
|
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
|
||||||
|
easing_function = nil, -- Default easing function
|
||||||
|
pre_hook = nil, -- Function to run before the scrolling animation starts
|
||||||
|
post_hook = nil, -- Function to run after the scrolling animation ends
|
||||||
|
performance_mode = false, -- Disable "Performance Mode" on all buffers.
|
||||||
|
})
|
13
lua/plugin-config/orgmode.lua
Normal file
13
lua/plugin-config/orgmode.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
-- Load custom tree-sitter grammar for org filetype
|
||||||
|
require("orgmode").setup()
|
||||||
|
require("orgmode").setup_ts_grammar()
|
||||||
|
|
||||||
|
-- Tree-sitter configuration
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
-- If TS highlights are not enabled at all, or disabled via `disable` prop, highlighting will fallback to default Vim syntax highlighting
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = { "org" }, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar
|
||||||
|
},
|
||||||
|
ensure_installed = { "org" }, -- Or run :TSUpdate org
|
||||||
|
})
|
1
lua/plugin-config/spectre.lua
Normal file
1
lua/plugin-config/spectre.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
require("spectre").setup({})
|
@ -27,9 +27,14 @@ return require("packer").startup(function()
|
|||||||
-- 一个好的nvim内终端
|
-- 一个好的nvim内终端
|
||||||
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
||||||
|
|
||||||
-- git plugin like magit
|
-- chrome intergration
|
||||||
-- 类似magit的插件neogit
|
-- 浏览器集成
|
||||||
-- use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" })
|
-- use({
|
||||||
|
-- "glacambre/firenvim",
|
||||||
|
-- run = function()
|
||||||
|
-- vim.fn["firenvim#install"](0)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
-- lazygit support
|
-- lazygit support
|
||||||
-- 使用lazygit接口
|
-- 使用lazygit接口
|
||||||
@ -46,6 +51,14 @@ return require("packer").startup(function()
|
|||||||
-- 优化markdown添加表格
|
-- 优化markdown添加表格
|
||||||
use("dhruvasagar/vim-table-mode")
|
use("dhruvasagar/vim-table-mode")
|
||||||
|
|
||||||
|
-- nvim-markdown
|
||||||
|
-- markdown 增强
|
||||||
|
use("ixru/nvim-markdown")
|
||||||
|
|
||||||
|
-- orgmode support
|
||||||
|
-- orgmode 支持
|
||||||
|
use({ "nvim-orgmode/orgmode" })
|
||||||
|
|
||||||
-- nvim-tree for file manage
|
-- nvim-tree for file manage
|
||||||
use({
|
use({
|
||||||
"kyazdani42/nvim-tree.lua",
|
"kyazdani42/nvim-tree.lua",
|
||||||
@ -56,12 +69,16 @@ return require("packer").startup(function()
|
|||||||
-- vim 开始界面
|
-- vim 开始界面
|
||||||
use({ "glepnir/dashboard-nvim" })
|
use({ "glepnir/dashboard-nvim" })
|
||||||
|
|
||||||
|
-- smooth neovim scroll
|
||||||
|
-- 顺滑的neovim滚动
|
||||||
|
use("karb94/neoscroll.nvim")
|
||||||
|
|
||||||
-- bufferline on the top
|
-- bufferline on the top
|
||||||
-- 顶部状态栏
|
-- 顶部状态栏
|
||||||
use({ "akinsho/bufferline.nvim", requires = "kyazdani42/nvim-web-devicons" })
|
use({ "akinsho/bufferline.nvim", requires = "kyazdani42/nvim-web-devicons" })
|
||||||
|
|
||||||
-- 更方便的切换buffer
|
-- 更方便的切换buffer
|
||||||
use({ "matbme/JABS.nvim" })
|
-- use({ "matbme/JABS.nvim" })
|
||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
use({
|
use({
|
||||||
@ -92,11 +109,24 @@ return require("packer").startup(function()
|
|||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--------------------- buffer related -----------------
|
||||||
|
-- search and replace
|
||||||
|
use("windwp/nvim-spectre")
|
||||||
|
|
||||||
|
-- indent-blankline
|
||||||
|
-- 竖向加竖线显示对齐
|
||||||
|
use({ "lukas-reineke/indent-blankline.nvim" })
|
||||||
-- comment
|
-- comment
|
||||||
use({
|
use({
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- hop plugin
|
||||||
|
-- 快速跳转
|
||||||
|
use({
|
||||||
|
"phaazon/hop.nvim",
|
||||||
|
branch = "v2", -- optional but strongly recommended
|
||||||
|
})
|
||||||
-- lualine for bottom stausline
|
-- lualine for bottom stausline
|
||||||
-- 底部状态栏
|
-- 底部状态栏
|
||||||
use({
|
use({
|
||||||
@ -120,6 +150,10 @@ return require("packer").startup(function()
|
|||||||
-- 代码运行
|
-- 代码运行
|
||||||
use({ "CRAG666/code_runner.nvim", requires = "nvim-lua/plenary.nvim" })
|
use({ "CRAG666/code_runner.nvim", requires = "nvim-lua/plenary.nvim" })
|
||||||
|
|
||||||
|
-- cmake support
|
||||||
|
-- cmake 支持
|
||||||
|
use("Civitasv/cmake-tools.nvim")
|
||||||
|
|
||||||
------------------- lsp --------------------------
|
------------------- lsp --------------------------
|
||||||
-- mason for lsp dap linter and others
|
-- mason for lsp dap linter and others
|
||||||
use({
|
use({
|
||||||
@ -158,6 +192,8 @@ return require("packer").startup(function()
|
|||||||
use("rafamadriz/friendly-snippets")
|
use("rafamadriz/friendly-snippets")
|
||||||
-- UI 增强
|
-- UI 增强
|
||||||
use("onsails/lspkind-nvim")
|
use("onsails/lspkind-nvim")
|
||||||
|
-- copilot 增强
|
||||||
|
use("github/copilot.vim")
|
||||||
|
|
||||||
------------------- dap -----------------------
|
------------------- dap -----------------------
|
||||||
-- dap for neovim
|
-- dap for neovim
|
||||||
|
28
readme.md
28
readme.md
@ -44,6 +44,7 @@
|
|||||||
| \<leader>S | 保存所有文件 |
|
| \<leader>S | 保存所有文件 |
|
||||||
| \<leader><tab> | 切换回上一个buffer,用于两buffer间来回切换 |
|
| \<leader><tab> | 切换回上一个buffer,用于两buffer间来回切换 |
|
||||||
| , | 运行当前文件代码,需要自行配置各种语言 |
|
| , | 运行当前文件代码,需要自行配置各种语言 |
|
||||||
|
| Ctrl-\\ | 打开终端 |
|
||||||
|
|
||||||
### Packer
|
### Packer
|
||||||
| key | function |
|
| key | function |
|
||||||
@ -77,14 +78,35 @@
|
|||||||
|
|
||||||
### buffer
|
### buffer
|
||||||
| key | function |
|
| key | function |
|
||||||
|-------------|----------------|
|
|-------------|--------------------------------|
|
||||||
| \<leader>bb | 打开某个buffer |
|
| \<leader>bb | 打开某个buffer |
|
||||||
| \<leader>bk | 关闭当前buffer |
|
| \<leader>bk | 关闭当前buffer |
|
||||||
|
| \<leader>bc | 取消高亮(可用于搜索后取消高亮) |
|
||||||
|
| \<leader>bo | 关闭其他buffer |
|
||||||
|
|
||||||
|
### window
|
||||||
|
| key | function |
|
||||||
|
|-------------------|--------------------|
|
||||||
|
| \<leader>wo | 关闭其他窗口 |
|
||||||
|
| \<leader>wd | 关闭当前窗口 |
|
||||||
|
| \<leader>wh,j,k,l | 切换其他方向的窗口 |
|
||||||
|
| \<leader>ws | 水平分割窗口 |
|
||||||
|
|
||||||
|
|
||||||
|
### file
|
||||||
|
| key | function |
|
||||||
|
|-------------|------------------------|
|
||||||
|
| \<leader>ff | telescope 文件浏览 |
|
||||||
|
| \<leader>fr | 最近打开的文件 |
|
||||||
|
| \<leader>fs | 在项目文件中搜索字符串 |
|
||||||
|
| \<leader>fp | 打开项目 |
|
||||||
|
|
||||||
## 问题
|
## 问题
|
||||||
|
|
||||||
### 根据文件类型启动某些功能
|
### 根据文件类型启动某些功能
|
||||||
可以在ftplugin文件夹中放入对应文件类型的lua文件,如markdown.lua对应markdown文件.写入要执行的命令即可.例子可见ftplugin/markdown中启动markdown table mode
|
可以在ftplugin文件夹中放入对应文件类型的lua文件,如markdown.lua对应markdown文件.写入要执行的命令即可.例子可见ftplugin/markdown中启动markdown table mode()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user