first commit
This commit is contained in:
commit
42dda177d6
24
init.lua
Normal file
24
init.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
require('basic').load_default_options()
|
||||||
|
|
||||||
|
require('plugins')
|
||||||
|
|
||||||
|
require('keybindings')
|
||||||
|
|
||||||
|
require('plugin-config/nvim-tree')
|
||||||
|
require('plugin-config/bufferline')
|
||||||
|
require('plugin-config/treesitter')
|
||||||
|
require('plugin-config/telescope')
|
||||||
|
require('plugin-config/whichkey')
|
||||||
|
require('plugin-config/comment')
|
||||||
|
require('plugin-config/mason')
|
||||||
|
require('plugin-config/lualine')
|
||||||
|
require('plugin-config/notify')
|
||||||
|
require('plugin-config/nvim-autopairs')
|
||||||
|
require('plugin-config/project')
|
||||||
|
require('plugin-config/dashboard')
|
||||||
|
require('plugin-config/coderunner')
|
||||||
|
|
||||||
|
require('lsp')
|
||||||
|
require('lsp.cmp')
|
||||||
|
|
||||||
|
require('nvim-dap')
|
72
lua/basic.lua
Normal file
72
lua/basic.lua
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
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
|
||||||
|
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
|
||||||
|
vim.opt[k] = v
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local let_options = {
|
||||||
|
-- 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
|
127
lua/keybindings.lua
Normal file
127
lua/keybindings.lua
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
local pluginKeys = {}
|
||||||
|
|
||||||
|
-- 设定映射函数
|
||||||
|
-- set map function
|
||||||
|
local map = vim.api.nvim_set_keymap
|
||||||
|
local opt = {noremap = true, silent = true }
|
||||||
|
local wk = require("which-key")
|
||||||
|
|
||||||
|
-- basic operation for write and quit
|
||||||
|
-- 文件写入退出基本操作
|
||||||
|
wk.register({
|
||||||
|
["<Leader>s"] = {":w<CR>", "Save File"},
|
||||||
|
["<Leader>q"] = {":qa<CR>", "Quit All"},
|
||||||
|
["<Leader>S"] = {":wa<CR>", "Save All"},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- code related
|
||||||
|
-- 代码相关
|
||||||
|
map("n", ",", ":RunCode<CR>", opt)
|
||||||
|
|
||||||
|
-- file related
|
||||||
|
-- 文件相关操作
|
||||||
|
wk.register({
|
||||||
|
["<Leader><Tab>"] = {"<C-^>", "Last file"},
|
||||||
|
})
|
||||||
|
|
||||||
|
wk.register({
|
||||||
|
["<Leader>f"] = {
|
||||||
|
name = "+File",
|
||||||
|
p = {":Telescope projects<CR>", "Open project"},
|
||||||
|
r = {":Telescope oldfiles<CR>", "Recent files"},
|
||||||
|
n = {":enew<CR>", "New file"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- jk map to esc
|
||||||
|
-- jk映射为esc键
|
||||||
|
map("i", "jk", "<Esc>", opt)
|
||||||
|
|
||||||
|
-- window operate by which-key
|
||||||
|
-- 窗口操作(使用which-key快捷键设置)
|
||||||
|
wk.register({
|
||||||
|
["<Leader>w"] = {
|
||||||
|
name = "+Window",
|
||||||
|
h = {"<C-w>h", "To left"},
|
||||||
|
j = {"<C-w>j", "To up"},
|
||||||
|
k = {"<C-w>k", "To down"},
|
||||||
|
l = {"<C-w>l", "To right"},
|
||||||
|
s = {":sp<CR>", "Split window"},
|
||||||
|
v = {":vsplit<CR>", "Vsplit window"},
|
||||||
|
d = {":close<CR>", "Close window"},
|
||||||
|
o = {":only<CR>", "Close others"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--一般映射方式
|
||||||
|
--map("n", "<Leader>wh", "<C-w>h", opt)
|
||||||
|
--map("n", "<Leader>wj", "<C-w>j", opt)
|
||||||
|
--map("n", "<Leader>wk", "<C-w>k", opt)
|
||||||
|
--map("n", "<Leader>wl", "<C-w>l", opt)
|
||||||
|
|
||||||
|
-- base operation for visual mode
|
||||||
|
-- 可视模式下基本操作
|
||||||
|
map('v', '<', '<gv', opt)
|
||||||
|
map('v', '>', '>gv', opt)
|
||||||
|
|
||||||
|
-- nvimTree
|
||||||
|
map("n", "n", ":NvimTreeToggle<CR>", opt)
|
||||||
|
|
||||||
|
-- Packer
|
||||||
|
wk.register({
|
||||||
|
["<Leader>p"] = {
|
||||||
|
name = "+Packer",
|
||||||
|
i = {":PackerSync<CR>", "PackerSync"},
|
||||||
|
s = {":PackerStatus<CR>", "PackerStatus"},
|
||||||
|
c = {":PackerClean<CR>", "PackerClean"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Bufferline and buffer related
|
||||||
|
wk.register({
|
||||||
|
["<Leader>b"] = {
|
||||||
|
name = "+Buffer",
|
||||||
|
h = {":BufferLineCyclePrev<CR>", "Left tab"},
|
||||||
|
l = {":BufferLineCycleNext<CR>", "Right tab"},
|
||||||
|
k = {":bd<CR>", "Kill buffer"},
|
||||||
|
b = {":bp<CR>", "Last buffer"},
|
||||||
|
n = {":ls<CR>", "Buffer numbers"},
|
||||||
|
t = {":b ", "To buffer"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Mason
|
||||||
|
wk.register({
|
||||||
|
["<Leader>l"] = {
|
||||||
|
name = "+Lsp",
|
||||||
|
i = {":LspInstall<CR>", "Install lsp"},
|
||||||
|
I = {":MasonInstall ", "Install any"},
|
||||||
|
l = {":Mason<CR>", "Mason info"},
|
||||||
|
u = {":MasonUninstall<CR>", "Uninstall lsp"},
|
||||||
|
U = {":MasonUninstallAll<CR>", "Unistall all"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
map("n", "f", ":Telescope find_files<CR>", opt)
|
||||||
|
|
||||||
|
|
||||||
|
-- cmpeletion keys
|
||||||
|
-- 补全快捷键
|
||||||
|
pluginKeys.cmp = function(cmp)
|
||||||
|
return {
|
||||||
|
-- next option
|
||||||
|
-- 下一个
|
||||||
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<Up>'] = cmp.mapping.select_prev_item(),
|
||||||
|
|
||||||
|
['<CR>'] = cmp.mapping.confirm({
|
||||||
|
select = true,
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace
|
||||||
|
})
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return pluginKeys
|
67
lua/lsp/cmp.lua
Normal file
67
lua/lsp/cmp.lua
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
local lspkind = require('lspkind')
|
||||||
|
local cmp = require'cmp'
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
-- 指定 snippet 引擎
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
-- For `vsnip` users.
|
||||||
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
|
|
||||||
|
-- For `luasnip` users.
|
||||||
|
-- require('luasnip').lsp_expand(args.body)
|
||||||
|
|
||||||
|
-- For `ultisnips` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body)
|
||||||
|
|
||||||
|
-- For `snippy` users.
|
||||||
|
-- require'snippy'.expand_snippet(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- 来源
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
-- For vsnip users.
|
||||||
|
{ name = 'vsnip' },
|
||||||
|
-- For luasnip users.
|
||||||
|
-- { name = 'luasnip' },
|
||||||
|
--For ultisnips users.
|
||||||
|
-- { name = 'ultisnips' },
|
||||||
|
-- -- For snippy users.
|
||||||
|
-- { name = 'snippy' },
|
||||||
|
}, { { name = 'buffer' },
|
||||||
|
{ name = 'path' }
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- 快捷键
|
||||||
|
mapping = require('keybindings').cmp(cmp),
|
||||||
|
-- 使用lspkind-nvim显示类型图标
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
with_text = true, -- do not show text alongside icons
|
||||||
|
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||||
|
before = function (entry, vim_item)
|
||||||
|
-- Source 显示提示来源
|
||||||
|
vim_item.menu = "["..string.upper(entry.source.name).."]"
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Use buffer source for `/`.
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':'.
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
})
|
21
lua/lsp/config/clangd.lua
Normal file
21
lua/lsp/config/clangd.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
return {
|
||||||
|
on_setup = function(server)
|
||||||
|
server.setup({
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
-- 禁用格式化功能,交给专门插件插件处理
|
||||||
|
client.server_capabilities.document_formatting = false
|
||||||
|
client.server_capabilities.document_range_formatting = false
|
||||||
|
|
||||||
|
-- local function buf_set_keymap(...)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
-- end
|
||||||
|
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
-- 绑定快捷键
|
||||||
|
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
59
lua/lsp/config/lua.lua
Normal file
59
lua/lsp/config/lua.lua
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sumneko_lua
|
||||||
|
local runtime_path = vim.split(package.path, ";")
|
||||||
|
table.insert(runtime_path, "lua/?.lua")
|
||||||
|
table.insert(runtime_path, "lua/?/init.lua")
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = "LuaJIT",
|
||||||
|
-- Setup your lua path
|
||||||
|
path = runtime_path,
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
-- 禁用格式化功能,交给专门插件插件处理
|
||||||
|
client.server_capabilities.document_formatting = false
|
||||||
|
client.server_capabilities.document_range_formatting = false
|
||||||
|
|
||||||
|
-- local function buf_set_keymap(...)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
end
|
||||||
|
-- -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
-- -- 绑定快捷键
|
||||||
|
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||||
|
-- end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||||
|
opts.capabilities = capabilities
|
||||||
|
|
||||||
|
-- 查看目录等信息
|
||||||
|
-- print(vim.inspect(server))
|
||||||
|
|
||||||
|
return {
|
||||||
|
on_setup = function(server)
|
||||||
|
-- opts = require("lua-dev").setup({ lspconfig = opts })
|
||||||
|
server.setup(opts)
|
||||||
|
end,
|
||||||
|
}
|
21
lua/lsp/config/pyright.lua
Normal file
21
lua/lsp/config/pyright.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
return {
|
||||||
|
on_setup = function(server)
|
||||||
|
server.setup({
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
-- 禁用格式化功能,交给专门插件插件处理
|
||||||
|
client.server_capabilities.document_formatting = false
|
||||||
|
client.server_capabilities.document_range_formatting = false
|
||||||
|
|
||||||
|
-- local function buf_set_keymap(...)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
-- end
|
||||||
|
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
-- 绑定快捷键
|
||||||
|
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
30
lua/lsp/init.lua
Normal file
30
lua/lsp/init.lua
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
-- 安装列表
|
||||||
|
-- { key: 服务器名, value: 配置文件 }
|
||||||
|
-- key 必须为下列网址列出的 server name,不可以随便写
|
||||||
|
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
|
||||||
|
local servers = {
|
||||||
|
sumneko_lua = require("lsp.config.lua"), -- lua/lsp/config/lua.lua
|
||||||
|
clangd = require("lsp.config.clangd"),
|
||||||
|
-- bashls = require("lsp.config.bash"),
|
||||||
|
pyright = require("lsp.config.pyright"),
|
||||||
|
-- html = require("lsp.config.html"),
|
||||||
|
-- cssls = require("lsp.config.css"),
|
||||||
|
-- emmet_ls = require("lsp.config.emmet"),
|
||||||
|
-- jsonls = require("lsp.config.json"),
|
||||||
|
-- tsserver = require("lsp.config.ts"),
|
||||||
|
-- rust_analyzer = require("lsp.config.rust"),
|
||||||
|
-- yamlls = require("lsp.config.yamlls"),
|
||||||
|
-- remark_ls = require("lsp.config.markdown"),
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, config in pairs(servers) do
|
||||||
|
if config ~= nil and type(config) == "table" then
|
||||||
|
-- 自定义初始化配置文件必须实现on_setup 方法
|
||||||
|
config.on_setup(lspconfig[name])
|
||||||
|
else
|
||||||
|
-- 使用默认参数
|
||||||
|
lspconfig[name].setup({})
|
||||||
|
end
|
||||||
|
end
|
27
lua/nvim-dap/codelldb.lua
Normal file
27
lua/nvim-dap/codelldb.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local dap = require('dap')
|
||||||
|
dap.adapters.codelldb = {
|
||||||
|
type = 'server',
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = '/home/ubuntu/.local/share/nvim/mason/packages/codelldb/codelldb',
|
||||||
|
args = {"--port", "${port}"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = "Launch file",
|
||||||
|
type = "codelldb",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||||
|
end,
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
stopOnEntry = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
89
lua/nvim-dap/init.lua
Normal file
89
lua/nvim-dap/init.lua
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
-- local dap_install = require("dap-install")
|
||||||
|
-- dap_install.setup({
|
||||||
|
-- installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
|
||||||
|
-- })
|
||||||
|
|
||||||
|
local dap = require("dap")
|
||||||
|
local dapui = require("dapui")
|
||||||
|
|
||||||
|
-- require("nvim-dap-virtual-text").setup({
|
||||||
|
-- commented = true,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
vim.fn.sign_define("DapBreakpoint", {
|
||||||
|
text = "🛑",
|
||||||
|
texthl = "LspDiagnosticsSignError",
|
||||||
|
linehl = "",
|
||||||
|
numhl = "",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.fn.sign_define("DapStopped", {
|
||||||
|
text = "",
|
||||||
|
texthl = "LspDiagnosticsSignInformation",
|
||||||
|
linehl = "DiagnosticUnderlineInfo",
|
||||||
|
numhl = "LspDiagnosticsSignInformation",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.fn.sign_define("DapBreakpointRejected", {
|
||||||
|
text = "",
|
||||||
|
texthl = "LspDiagnosticsSignHint",
|
||||||
|
linehl = "",
|
||||||
|
numhl = "",
|
||||||
|
})
|
||||||
|
|
||||||
|
dapui.setup({
|
||||||
|
icons = { expanded = "▾", collapsed = "▸" },
|
||||||
|
mappings = {
|
||||||
|
-- Use a table to apply multiple mappings
|
||||||
|
expand = { "o", "<CR>", "<2-LeftMouse>" },
|
||||||
|
open = "o",
|
||||||
|
remove = "d",
|
||||||
|
edit = "e",
|
||||||
|
repl = "r",
|
||||||
|
toggle = "t",
|
||||||
|
},
|
||||||
|
-- sidebar = {
|
||||||
|
-- -- You can change the order of elements in the sidebar
|
||||||
|
-- elements = {
|
||||||
|
-- -- Provide as ID strings or tables with "id" and "size" keys
|
||||||
|
-- {
|
||||||
|
-- id = "scopes",
|
||||||
|
-- size = 0.25, -- Can be float or integer > 1
|
||||||
|
-- },
|
||||||
|
-- { id = "breakpoints", size = 0.25 },
|
||||||
|
-- { id = "stacks", size = 0.25 },
|
||||||
|
-- { id = "watches", size = 00.25 },
|
||||||
|
-- },
|
||||||
|
-- size = 40,
|
||||||
|
-- position = "left", -- Can be "left", "right", "top", "bottom"
|
||||||
|
-- },
|
||||||
|
-- tray = {
|
||||||
|
-- elements = { "repl" },
|
||||||
|
-- size = 10,
|
||||||
|
-- position = "bottom", -- Can be "left", "right", "top", "bottom"
|
||||||
|
-- },
|
||||||
|
floating = {
|
||||||
|
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||||
|
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||||
|
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||||
|
mappings = {
|
||||||
|
close = { "q", "<Esc>" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
windows = { indent = 1 },
|
||||||
|
render = {
|
||||||
|
max_type_length = nil, -- Can be integer or nil.
|
||||||
|
},
|
||||||
|
}) -- use default
|
||||||
|
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close()
|
||||||
|
end
|
||||||
|
|
||||||
|
require("nvim-dap.codelldb").setup()
|
4
lua/plugin-config/bufferline.lua
Normal file
4
lua/plugin-config/bufferline.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
require("bufferline").setup {
|
||||||
|
options = {
|
||||||
|
}
|
||||||
|
}
|
7
lua/plugin-config/coderunner.lua
Normal file
7
lua/plugin-config/coderunner.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require('code_runner').setup{
|
||||||
|
focus = false,
|
||||||
|
filetype = {
|
||||||
|
c = "cd $dir && gcc $fileName -o $fileNameWithoutExt -g && $dir/$fileNameWithoutExt",
|
||||||
|
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt -g && $dir/$fileNameWithoutExt",
|
||||||
|
}
|
||||||
|
}
|
45
lua/plugin-config/comment.lua
Normal file
45
lua/plugin-config/comment.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
require('Comment').setup{
|
||||||
|
---Add a space b/w comment and the line
|
||||||
|
padding = true,
|
||||||
|
---Whether the cursor should stay at its position
|
||||||
|
sticky = true,
|
||||||
|
---Lines to be ignored while (un)comment
|
||||||
|
ignore = "^$",
|
||||||
|
---LHS of toggle mappings in NORMAL mode
|
||||||
|
toggler = {
|
||||||
|
---Line-comment toggle keymap
|
||||||
|
line = 'gcc',
|
||||||
|
---Block-comment toggle keymap
|
||||||
|
block = 'gbc',
|
||||||
|
},
|
||||||
|
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
||||||
|
opleader = {
|
||||||
|
---Line-comment keymap
|
||||||
|
line = 'gc',
|
||||||
|
---Block-comment keymap
|
||||||
|
block = 'gb',
|
||||||
|
},
|
||||||
|
---LHS of extra mappings
|
||||||
|
extra = {
|
||||||
|
---Add comment on the line above
|
||||||
|
above = 'gcO',
|
||||||
|
---Add comment on the line below
|
||||||
|
below = 'gco',
|
||||||
|
---Add comment at the end of line
|
||||||
|
eol = 'gcA',
|
||||||
|
},
|
||||||
|
---Enable keybindings
|
||||||
|
---NOTE: If given `false` then the plugin won't create any mappings
|
||||||
|
mappings = {
|
||||||
|
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
||||||
|
basic = true,
|
||||||
|
---Extra mapping; `gco`, `gcO`, `gcA`
|
||||||
|
extra = true,
|
||||||
|
---Extended mapping; `g>` `g<` `g>[count]{motion}` `g<[count]{motion}`
|
||||||
|
extended = false,
|
||||||
|
},
|
||||||
|
---Function to call before (un)comment
|
||||||
|
pre_hook = nil,
|
||||||
|
---Function to call after (un)comment
|
||||||
|
post_hook = nil,
|
||||||
|
}
|
1
lua/plugin-config/dashboard.lua
Normal file
1
lua/plugin-config/dashboard.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
local db = require('dashboard')
|
40
lua/plugin-config/lualine.lua
Normal file
40
lua/plugin-config/lualine.lua
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
require('lualine').setup {
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = 'ayu_light',
|
||||||
|
component_separators = { left = '', right = ''},
|
||||||
|
section_separators = { left = '', right = ''},
|
||||||
|
disabled_filetypes = {
|
||||||
|
statusline = {},
|
||||||
|
winbar = {},
|
||||||
|
},
|
||||||
|
ignore_focus = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
globalstatus = false,
|
||||||
|
refresh = {
|
||||||
|
statusline = 1000,
|
||||||
|
tabline = 1000,
|
||||||
|
winbar = 1000,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = {'mode'},
|
||||||
|
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||||
|
lualine_c = {'filename'},
|
||||||
|
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||||
|
lualine_y = {'progress'},
|
||||||
|
lualine_z = {'location'}
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = {'filename'},
|
||||||
|
lualine_x = {'location'},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {}
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
winbar = {},
|
||||||
|
inactive_winbar = {},
|
||||||
|
extensions = {}
|
||||||
|
}
|
13
lua/plugin-config/mason.lua
Normal file
13
lua/plugin-config/mason.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
require("mason").setup({
|
||||||
|
automatic_installation = true, -- automatically detect which servers to install (based on which servers are set up via lspconfig)
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
server_installed = "✓",
|
||||||
|
server_pending = "➜",
|
||||||
|
server_uninstalled = "✗"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup()
|
2
lua/plugin-config/notify.lua
Normal file
2
lua/plugin-config/notify.lua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
require('notify').setup{
|
||||||
|
}
|
3
lua/plugin-config/nvim-autopairs.lua
Normal file
3
lua/plugin-config/nvim-autopairs.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
require('nvim-autopairs').setup({
|
||||||
|
enable_check_bracket_line = true
|
||||||
|
})
|
8
lua/plugin-config/nvim-tree.lua
Normal file
8
lua/plugin-config/nvim-tree.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
require 'nvim-tree'.setup({
|
||||||
|
sync_root_with_cwd = true,
|
||||||
|
respect_buf_cwd = true,
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_root = true
|
||||||
|
},
|
||||||
|
})
|
43
lua/plugin-config/project.lua
Normal file
43
lua/plugin-config/project.lua
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
require("project_nvim").setup{
|
||||||
|
|
||||||
|
-- Manual mode doesn't automatically change your root directory, so you have
|
||||||
|
-- the option to manually do so using `:ProjectRoot` command.
|
||||||
|
manual_mode = false,
|
||||||
|
|
||||||
|
-- Methods of detecting the root directory. **"lsp"** uses the native neovim
|
||||||
|
-- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
|
||||||
|
-- order matters: if one is not detected, the other is used as fallback. You
|
||||||
|
-- can also delete or rearangne the detection methods.
|
||||||
|
detection_methods = { "lsp", "pattern" },
|
||||||
|
|
||||||
|
-- All the patterns used to detect root dir, when **"pattern"** is in
|
||||||
|
-- detection_methods
|
||||||
|
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
|
||||||
|
|
||||||
|
-- Table of lsp clients to ignore by name
|
||||||
|
-- eg: { "efm", ... }
|
||||||
|
ignore_lsp = {},
|
||||||
|
|
||||||
|
-- Don't calculate root dir on specific directories
|
||||||
|
-- Ex: { "~/.cargo/*", ... }
|
||||||
|
exclude_dirs = {},
|
||||||
|
|
||||||
|
-- Show hidden files in telescope
|
||||||
|
show_hidden = false,
|
||||||
|
|
||||||
|
-- When set to false, you will get a message when project.nvim changes your
|
||||||
|
-- directory.
|
||||||
|
silent_chdir = true,
|
||||||
|
|
||||||
|
-- What scope to change the directory, valid options are
|
||||||
|
-- * global (default)
|
||||||
|
-- * tab
|
||||||
|
-- * win
|
||||||
|
scope_chdir = 'global',
|
||||||
|
|
||||||
|
-- Path where project.nvim will store the project history for use in
|
||||||
|
-- telescope
|
||||||
|
datapath = vim.fn.stdpath("data"),
|
||||||
|
|
||||||
|
|
||||||
|
}
|
32
lua/plugin-config/telescope.lua
Normal file
32
lua/plugin-config/telescope.lua
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
require('telescope').setup{
|
||||||
|
defaults = {
|
||||||
|
-- Default configuration for telescope goes here:
|
||||||
|
-- config_key = value,
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
-- map actions.which_key to <C-h> (default: <C-/>)
|
||||||
|
-- actions.which_key shows the mappings for your picker,
|
||||||
|
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||||
|
["<C-h>"] = "which_key"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
-- Default configuration for builtin pickers goes here:
|
||||||
|
-- picker_name = {
|
||||||
|
-- picker_config_key = value,
|
||||||
|
-- ...
|
||||||
|
-- }
|
||||||
|
-- Now the picker_config_key will be applied every time you call this
|
||||||
|
-- builtin picker
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
-- Your extension configuration goes here:
|
||||||
|
-- extension_name = {
|
||||||
|
-- extension_config_key = value,
|
||||||
|
-- }
|
||||||
|
-- please take a look at the readme of the extension you want to configure
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require('telescope').load_extension('projects')
|
55
lua/plugin-config/treesitter.lua
Normal file
55
lua/plugin-config/treesitter.lua
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
-- A list of parser names, or "all"
|
||||||
|
ensure_installed = {},
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
-- List of parsers to ignore installing (for "all")
|
||||||
|
-- ignore_install = { },
|
||||||
|
|
||||||
|
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||||
|
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
-- `false` will disable the whole extension
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||||
|
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||||
|
-- the name of the parser)
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = { "c", "rust" },
|
||||||
|
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||||
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||||
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||||
|
-- Instead of true it can also be a list of languages
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true,
|
||||||
|
enable_autocmd = false,
|
||||||
|
config = {
|
||||||
|
-- Languages that have a single comment style
|
||||||
|
typescript = "// %s",
|
||||||
|
css = "/* %s */",
|
||||||
|
scss = "/* %s */",
|
||||||
|
html = "<!-- %s -->",
|
||||||
|
svelte = "<!-- %s -->",
|
||||||
|
vue = "<!-- %s -->",
|
||||||
|
json = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
71
lua/plugin-config/whichkey.lua
Normal file
71
lua/plugin-config/whichkey.lua
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
require("which-key").setup{
|
||||||
|
plugins = {
|
||||||
|
marks = true, -- shows a list of your marks on ' and `
|
||||||
|
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||||
|
spelling = {
|
||||||
|
enabled = false, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||||
|
suggestions = 20, -- how many suggestions should be shown in the list?
|
||||||
|
},
|
||||||
|
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||||
|
-- No actual key bindings are created
|
||||||
|
presets = {
|
||||||
|
operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion
|
||||||
|
motions = true, -- adds help for motions
|
||||||
|
text_objects = true, -- help for text objects triggered after entering an operator
|
||||||
|
windows = true, -- default bindings on <c-w>
|
||||||
|
nav = true, -- misc bindings to work with windows
|
||||||
|
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||||
|
g = true, -- bindings for prefixed with g
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- add operators that will trigger motion and text object completion
|
||||||
|
-- to enable all native operators, set the preset / operators plugin above
|
||||||
|
operators = { gc = "Comments" },
|
||||||
|
key_labels = {
|
||||||
|
-- override the label used to display some keys. It doesn't effect WK in any other way.
|
||||||
|
-- For example:
|
||||||
|
-- ["<space>"] = "SPC",
|
||||||
|
-- ["<cr>"] = "RET",
|
||||||
|
-- ["<tab>"] = "TAB",
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||||
|
separator = "➜", -- symbol used between a key and it's label
|
||||||
|
group = "+", -- symbol prepended to a group
|
||||||
|
},
|
||||||
|
popup_mappings = {
|
||||||
|
scroll_down = '<c-d>', -- binding to scroll down inside the popup
|
||||||
|
scroll_up = '<c-u>', -- binding to scroll up inside the popup
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
border = "none", -- none, single, double, shadow
|
||||||
|
position = "bottom", -- bottom, top
|
||||||
|
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||||
|
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||||
|
winblend = 0
|
||||||
|
},
|
||||||
|
layout = {
|
||||||
|
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||||
|
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||||
|
spacing = 3, -- spacing between columns
|
||||||
|
align = "left", -- align columns left, center or right
|
||||||
|
},
|
||||||
|
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
|
||||||
|
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
|
||||||
|
show_help = true, -- show help message on the command line when the popup is visible
|
||||||
|
triggers = "auto", -- automatically setup triggers
|
||||||
|
-- triggers = {"<leader>"} -- or specify a list manually
|
||||||
|
triggers_blacklist = {
|
||||||
|
-- list of mode / prefixes that should never be hooked by WhichKey
|
||||||
|
-- this is mostly relevant for key maps that start with a native binding
|
||||||
|
-- most people should not need to change this
|
||||||
|
i = { "j", "k" },
|
||||||
|
v = { "j", "k" },
|
||||||
|
},
|
||||||
|
-- disable the WhichKey popup for certain buf types and file types.
|
||||||
|
-- Disabled by deafult for Telescope
|
||||||
|
disable = {
|
||||||
|
buftypes = {},
|
||||||
|
filetypes = { "TelescopePrompt" },
|
||||||
|
},
|
||||||
|
}
|
121
lua/plugins.lua
Normal file
121
lua/plugins.lua
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
return require('packer').startup(function()
|
||||||
|
-- Packer can manage itself
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
-- Nova theme for neovim light
|
||||||
|
use({
|
||||||
|
"zanglg/nova.nvim",
|
||||||
|
config = function()
|
||||||
|
-- support both dark and light style
|
||||||
|
require("nova").setup({ background = "light" })
|
||||||
|
|
||||||
|
-- load colorscheme
|
||||||
|
require("nova").load()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- nvim-tree for file manage
|
||||||
|
use {
|
||||||
|
'kyazdani42/nvim-tree.lua',
|
||||||
|
requires = 'kyazdani42/nvim-web-devicons',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- vim dashboard
|
||||||
|
-- vim 开始界面
|
||||||
|
use {'glepnir/dashboard-nvim'}
|
||||||
|
|
||||||
|
|
||||||
|
-- bufferline on the top
|
||||||
|
-- 顶部状态栏
|
||||||
|
use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'}
|
||||||
|
|
||||||
|
-- treesitter
|
||||||
|
use {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- telescope
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- project
|
||||||
|
-- 项目管理
|
||||||
|
-- Lua
|
||||||
|
use {
|
||||||
|
"ahmedkhalf/project.nvim",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- whick-key
|
||||||
|
use {
|
||||||
|
'folke/which-key.nvim'
|
||||||
|
}
|
||||||
|
|
||||||
|
-- comment
|
||||||
|
use {
|
||||||
|
'numToStr/Comment.nvim',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- lualine for bottom stausline
|
||||||
|
-- 底部状态栏
|
||||||
|
use {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- notify
|
||||||
|
-- 弹窗消息通知
|
||||||
|
use {
|
||||||
|
'rcarriga/nvim-notify'
|
||||||
|
}
|
||||||
|
|
||||||
|
-- autopairs
|
||||||
|
-- 自动补全括号
|
||||||
|
use {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- coderunner
|
||||||
|
-- 代码运行
|
||||||
|
use { 'CRAG666/code_runner.nvim', requires = 'nvim-lua/plenary.nvim' }
|
||||||
|
|
||||||
|
------------------- lsp --------------------------
|
||||||
|
-- mason for lsp dap linter and others
|
||||||
|
use {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- nlsp-settings
|
||||||
|
-- 方便的lsp配置插件
|
||||||
|
-- use {
|
||||||
|
-- "tamago324/nlsp-settings.nvim"
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- 补全引擎
|
||||||
|
use("hrsh7th/nvim-cmp")
|
||||||
|
-- Snippet 引擎
|
||||||
|
use("hrsh7th/vim-vsnip")
|
||||||
|
-- 补全源
|
||||||
|
use("hrsh7th/cmp-vsnip")
|
||||||
|
use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp }
|
||||||
|
use("hrsh7th/cmp-buffer") -- { name = 'buffer' },
|
||||||
|
use("hrsh7th/cmp-path") -- { name = 'path' }
|
||||||
|
use("hrsh7th/cmp-cmdline") -- { name = 'cmdline' }
|
||||||
|
use("hrsh7th/cmp-nvim-lsp-signature-help") -- { name = 'nvim_lsp_signature_help' }
|
||||||
|
-- 常见编程语言代码段
|
||||||
|
use("rafamadriz/friendly-snippets")
|
||||||
|
-- UI 增强
|
||||||
|
use("onsails/lspkind-nvim")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------- dap -----------------------
|
||||||
|
-- dap for neovim
|
||||||
|
-- dap ui和适配器
|
||||||
|
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
|
||||||
|
|
||||||
|
end)
|
254
plugin/packer_compiled.lua
Normal file
254
plugin/packer_compiled.lua
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
-- Automatically generated packer.nvim plugin loader code
|
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.inside_compile = true
|
||||||
|
|
||||||
|
local time
|
||||||
|
local profile_info
|
||||||
|
local should_profile = false
|
||||||
|
if should_profile then
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
profile_info = {}
|
||||||
|
time = function(chunk, start)
|
||||||
|
if start then
|
||||||
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_profiles(threshold)
|
||||||
|
local sorted_times = {}
|
||||||
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||||
|
end
|
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||||
|
local results = {}
|
||||||
|
for i, elem in ipairs(sorted_times) do
|
||||||
|
if not threshold or threshold and elem[2] > threshold then
|
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if threshold then
|
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||||
|
end
|
||||||
|
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/ubuntu/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/ubuntu/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/ubuntu/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/ubuntu/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/ubuntu/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||||
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
|
package.path = package.path .. ';' .. package_path_str
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], false)
|
||||||
|
time([[try_loadstring definition]], true)
|
||||||
|
local function try_loadstring(s, component, name)
|
||||||
|
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||||
|
if not success then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[try_loadstring definition]], false)
|
||||||
|
time([[Defining packer_plugins]], true)
|
||||||
|
_G.packer_plugins = {
|
||||||
|
["Comment.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||||
|
url = "https://github.com/numToStr/Comment.nvim"
|
||||||
|
},
|
||||||
|
["bufferline.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
|
||||||
|
url = "https://github.com/akinsho/bufferline.nvim"
|
||||||
|
},
|
||||||
|
["cmp-buffer"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
|
},
|
||||||
|
["cmp-cmdline"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp-signature-help"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
|
||||||
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
["cmp-vsnip"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-vsnip"
|
||||||
|
},
|
||||||
|
["code_runner.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/code_runner.nvim",
|
||||||
|
url = "https://github.com/CRAG666/code_runner.nvim"
|
||||||
|
},
|
||||||
|
["dashboard-nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/dashboard-nvim",
|
||||||
|
url = "https://github.com/glepnir/dashboard-nvim"
|
||||||
|
},
|
||||||
|
["friendly-snippets"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/friendly-snippets",
|
||||||
|
url = "https://github.com/rafamadriz/friendly-snippets"
|
||||||
|
},
|
||||||
|
["lspkind-nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
|
||||||
|
url = "https://github.com/onsails/lspkind-nvim"
|
||||||
|
},
|
||||||
|
["lualine.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||||
|
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||||
|
},
|
||||||
|
["mason-lspconfig.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
["mason.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
["nova.nvim"] = {
|
||||||
|
config = { "\27LJ\2\nc\0\0\3\0\5\0\f6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\0016\0\0\0'\2\1\0B\0\2\0029\0\4\0B\0\1\1K\0\1\0\tload\1\0\1\15background\nlight\nsetup\tnova\frequire\0" },
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nova.nvim",
|
||||||
|
url = "https://github.com/zanglg/nova.nvim"
|
||||||
|
},
|
||||||
|
["nvim-autopairs"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||||
|
url = "https://github.com/windwp/nvim-autopairs"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-dap"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-dap",
|
||||||
|
url = "https://github.com/mfussenegger/nvim-dap"
|
||||||
|
},
|
||||||
|
["nvim-dap-ui"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-dap-ui",
|
||||||
|
url = "https://github.com/rcarriga/nvim-dap-ui"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-notify"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-notify",
|
||||||
|
url = "https://github.com/rcarriga/nvim-notify"
|
||||||
|
},
|
||||||
|
["nvim-tree.lua"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||||
|
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["nvim-web-devicons"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||||
|
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||||
|
url = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["project.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/project.nvim",
|
||||||
|
url = "https://github.com/ahmedkhalf/project.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
["vim-vsnip"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/vim-vsnip",
|
||||||
|
url = "https://github.com/hrsh7th/vim-vsnip"
|
||||||
|
},
|
||||||
|
["which-key.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ubuntu/.local/share/nvim/site/pack/packer/start/which-key.nvim",
|
||||||
|
url = "https://github.com/folke/which-key.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false)
|
||||||
|
-- Config for: nova.nvim
|
||||||
|
time([[Config for nova.nvim]], true)
|
||||||
|
try_loadstring("\27LJ\2\nc\0\0\3\0\5\0\f6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\0016\0\0\0'\2\1\0B\0\2\0029\0\4\0B\0\1\1K\0\1\0\tload\1\0\1\15background\nlight\nsetup\tnova\frequire\0", "config", "nova.nvim")
|
||||||
|
time([[Config for nova.nvim]], false)
|
||||||
|
|
||||||
|
_G._packer.inside_compile = false
|
||||||
|
if _G._packer.needs_bufread == true then
|
||||||
|
vim.cmd("doautocmd BufRead")
|
||||||
|
end
|
||||||
|
_G._packer.needs_bufread = false
|
||||||
|
|
||||||
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not no_errors then
|
||||||
|
error_msg = error_msg:gsub('"', '\\"')
|
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user