new version

This commit is contained in:
zxd 2022-11-25 12:03:22 +08:00
parent 38cf7c82fc
commit 504f938082
21 changed files with 651 additions and 193 deletions

View File

@ -1,7 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.diagnostics.globals": [
"vim",
"use"
]
}

View File

29
init.lua Normal file
View File

@ -0,0 +1,29 @@
-- 基础设置
require('basic')
-- 快捷键映射
require("keybindings")
-- Packer 插件管理
require("plugins")
-- 主题设置
require("colorscheme")
-- 插件配置
require("plugin-config.nvim-tree")
require("plugin-config.bufferline")
require("plugin-config.lualine")
require("plugin-config.telescope")
require("plugin-config.dashboard")
require("plugin-config.project")
require("plugin-config.nvim-treesitter") -- (新增)
-- 内置LSP (新增)
require("lsp.setup")

View File

@ -1,11 +0,0 @@
lua require('basic')
lua require('keybindings')
lua require('plugins')
" 插件配置
lua require('plugin-config/nvim-tree')
lua require('plugin-config/nvim-treesitter')
lua require('lsp/setup')
set background=dark
colorscheme nord

View File

@ -1,7 +1,7 @@
-- utf8
vim.g.encoding = "UTF-8"
vim.o.fileencoding = 'utf-8'
-- jk移动时光标下上方保留8行
-- jkhl 移动时光标周围保留8行
vim.o.scrolloff = 8
vim.o.sidescrolloff = 8
-- 使用相对行号
@ -21,9 +21,10 @@ vim.o.shiftround = true
-- >> << 时移动长度
vim.o.shiftwidth = 2
vim.bo.shiftwidth = 2
-- 新行对齐当前行,空格替代tab
-- 空格替代tab
vim.o.expandtab = true
vim.bo.expandtab = true
-- 新行对齐当前行
vim.o.autoindent = true
vim.bo.autoindent = true
vim.o.smartindent = true
@ -34,18 +35,15 @@ vim.o.smartcase = true
vim.o.hlsearch = false
-- 边输入边搜索
vim.o.incsearch = true
-- 使用增强状态栏后不再需要 vim 的模式提示
vim.o.showmode = false
-- 命令行高为2提供足够的显示空间
vim.o.cmdheight = 2
-- 当文件被外部程序修改时,自动加载
vim.o.autoread = true
vim.bo.autoread = true
-- 禁止折行
vim.o.wrap = false
vim.wo.wrap = false
-- 行结尾可以跳到下一行
vim.o.whichwrap = 'b,s,<,>,[,],h,l'
-- 光标在行首尾时<Left><Right>可以跳到下一行
vim.o.whichwrap = '<,>,[,]'
-- 允许隐藏被修改过的buffer
vim.o.hidden = true
-- 鼠标支持
@ -56,9 +54,8 @@ vim.o.writebackup = false
vim.o.swapfile = false
-- smaller updatetime
vim.o.updatetime = 300
-- 设置 timeoutlen 为等待键盘快捷键连击时间200毫秒可根据需要设置
-- 遇到问题详见https://github.com/nshen/learn-neovim-lua/issues/1
vim.o.timeoutlen = 200
-- 设置 timeoutlen 为等待键盘快捷键连击时间500毫秒可根据需要设置
vim.o.timeoutlen = 500
-- split window 从下边和右边出现
vim.o.splitbelow = true
vim.o.splitright = true
@ -75,6 +72,9 @@ vim.o.listchars = "space:·"
vim.o.wildmenu = true
-- Dont' pass messages to |ins-completin menu|
vim.o.shortmess = vim.o.shortmess .. 'c'
-- 补全最多显示10行
vim.o.pumheight = 10
-- always show tabline
-- 永远显示 tabline
vim.o.showtabline = 2
-- 使用增强状态栏插件后不再需要 vim 的模式提示
vim.o.showmode = false

6
lua/colorscheme.lua Normal file
View File

@ -0,0 +1,6 @@
local colorscheme = "tokyonight"
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
vim.notify("colorscheme " .. colorscheme .. " 没有找到!")
return
end

View File

@ -1,53 +1,165 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local map = vim.api.nvim_set_keymap
-- 复用 opt 参数
local opt = {noremap = true, silent = true }
map("n", "<C-u>", "9k", opt)
map("n", "<C-d>", "9j", opt)
-- map('v', '<', '<gv', opt)
-- map('v', '>', '>gv', opt)
-- 取消 s 默认功能
map("n", "s", "", opt)
-- windows 分屏快捷键
map("n", "sv", ":vsp<CR>", opt)
map("n", "sh", ":sp<CR>", opt)
-- 关闭当前
map("n", "sc", "<C-w>c", opt)
map("n", "so", "<C-w>o", opt) -- close others
-- 关闭其他
map("n", "so", "<C-w>o", opt)
-- Alt + hjkl 窗口之间跳转
map("n", "<A-h>", "<C-w>h", opt)
map("n", "<A-j>", "<C-w>j", opt)
map("n", "<A-k>", "<C-w>k", opt)
map("n", "<A-l>", "<C-w>l", opt)
-- nvimTree
map('n', 'ct', ':NvimTreeToggle<CR>', opt)
-- 左右比例控制
map("n", "<C-Left>", ":vertical resize -2<CR>", opt)
map("n", "<C-Right>", ":vertical resize +2<CR>", opt)
map("n", "s,", ":vertical resize -20<CR>", opt)
map("n", "s.", ":vertical resize +20<CR>", opt)
-- 上下比例
map("n", "sj", ":resize +10<CR>", opt)
map("n", "sk", ":resize -10<CR>", opt)
map("n", "<C-Down>", ":resize +2<CR>", opt)
map("n", "<C-Up>", ":resize -2<CR>", opt)
-- 等比例
map("n", "s=", "<C-w>=", opt)
-- Terminal相关
map("n", "<leader>t", ":sp | terminal<CR>", opt)
map("n", "<leader>vt", ":vsp | terminal<CR>", opt)
map("t", "<Esc>", "<C-\\><C-n>", opt)
map("t", "<A-h>", [[ <C-\><C-N><C-w>h ]], opt)
map("t", "<A-j>", [[ <C-\><C-N><C-w>j ]], opt)
map("t", "<A-k>", [[ <C-\><C-N><C-w>k ]], opt)
map("t", "<A-l>", [[ <C-\><C-N><C-w>l ]], opt)
-- visual模式下缩进代码
map("v", "<", "<gv", opt)
map("v", ">", ">gv", opt)
-- 上下移动选中文本
map("v", "J", ":move '>+1<CR>gv-gv", opt)
map("v", "K", ":move '<-2<CR>gv-gv", opt)
-- 上下滚动浏览
map("n", "<C-j>", "4j", opt)
map("n", "<C-k>", "4k", opt)
-- ctrl u / ctrl + d 只移动9行默认移动半屏
map("n", "<C-u>", "9k", opt)
map("n", "<C-d>", "9j", opt)
-- 在visual 模式里粘贴不要复制
map("v", "p", '"_dP', opt)
-- 退出
map("n", "q", ":q<CR>", opt)
map("n", "qq", ":q!<CR>", opt)
map("n", "Q", ":qa!<CR>", opt)
-- insert 模式下,跳到行首行尾
map("i", "<C-h>", "<ESC>I", opt)
map("i", "<C-l>", "<ESC>A", opt)
-- bufferline
-- 左右Tab切换
map("n", "<C-h>", ":BufferLineCyclePrev<CR>", opt)
map("n", "<C-l>", ":BufferLineCycleNext<CR>", opt)
-- 关闭
--"moll/vim-bbye"
map("n", "<C-w>", ":Bdelete!<CR>", opt)
map("n", "<leader>bl", ":BufferLineCloseRight<CR>", opt)
map("n", "<leader>bh", ":BufferLineCloseLeft<CR>", opt)
map("n", "<leader>bc", ":BufferLinePickClose<CR>", opt)
-- Telescope
-- 查找文件
map("n", "<C-p>", ":Telescope find_files<CR>", opt)
-- 全局搜索
map("n", "<C-f>", ":Telescope live_grep<CR>", opt)
-- 插件快捷键
local pluginKeys = {}
-- nvim-tree
-- alt + m 键打开关闭tree
map("n", "<A-m>", ":NvimTreeToggle<CR>", opt)
-- 列表快捷键
pluginKeys.nvimTreeList = {
-- 打开文件或文件夹
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
-- 分屏打开文件
{ key = "v", action = "vsplit" },
{ key = "h", action = "split" },
-- 显示隐藏文件
{ key = "i", action = "toggle_custom" }, -- 对应 filters 中的 custom (node_modules)
{ key = ".", action = "toggle_dotfiles" }, -- Hide (dotfiles)
-- 文件操作
{ key = "<F5>", action = "refresh" },
{ key = "a", action = "create" },
{ key = "d", action = "remove" },
{ key = "r", action = "rename" },
{ key = "x", action = "cut" },
{ key = "c", action = "copy" },
{ key = "p", action = "paste" },
{ key = "s", action = "system_open" },
}
-- Telescope 列表中 插入模式快捷键
pluginKeys.telescopeList = {
i = {
-- 上下移动
["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous",
["<Down>"] = "move_selection_next",
["<Up>"] = "move_selection_previous",
-- 历史记录
["<C-n>"] = "cycle_history_next",
["<C-p>"] = "cycle_history_prev",
-- 关闭窗口
["<C-c>"] = "close",
-- 预览窗口上下滚动
["<C-u>"] = "preview_scrolling_up",
["<C-d>"] = "preview_scrolling_down",
},
}
-- lsp 回调函数快捷键设置
pluginKeys.maplsp = function(mapbuf)
pluginKeys.mapLSP = function(mapbuf)
-- rename
mapbuf('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opt)
mapbuf("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opt)
-- code action
mapbuf('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opt)
mapbuf("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opt)
-- go xx
mapbuf('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opt)
mapbuf('n', 'gh', '<cmd>lua vim.lsp.buf.hover()<CR>', opt)
mapbuf('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opt)
mapbuf('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opt)
mapbuf('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opt)
mapbuf("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opt)
mapbuf("n", "gh", "<cmd>lua vim.lsp.buf.hover()<CR>", opt)
mapbuf("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opt)
mapbuf("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opt)
mapbuf("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opt)
-- diagnostic
mapbuf('n', 'go', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
mapbuf('n', 'gp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opt)
mapbuf('n', 'gn', '<cmd>lua vim.diagnostic.goto_next()<CR>', opt)
mapbuf("n", "gp", "<cmd>lua vim.diagnostic.open_float()<CR>", opt)
mapbuf("n", "gk", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opt)
mapbuf("n", "gj", "<cmd>lua vim.diagnostic.goto_next()<CR>", opt)
mapbuf("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opt)
-- 没用到
-- mapbuf('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opt)
-- leader + =
mapbuf('n', '<leader>=', '<cmd>lua vim.lsp.buf.formatting()<CR>', opt)
-- mapbuf('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opt)
-- mapbuf("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opt)
-- mapbuf('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opt)
-- mapbuf('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opt)
-- mapbuf('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opt)

View File

@ -1 +0,0 @@

54
lua/lsp/config/lua.lua Normal file
View File

@ -0,0 +1,54 @@
-- 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.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
-- 绑定快捷键
require('keybindings').mapLSP(buf_set_keymap)
-- 保存时自动格式化
-- vim.cmd('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
end,
}
-- 查看目录等信息
return {
on_setup = function(server)
server:setup(opts)
end,
}

View File

View File

@ -1,14 +1,14 @@
local lsp_installer = require "nvim-lsp-installer"
local lsp_installer = require("nvim-lsp-installer")
-- 安装列表
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
-- { key: 语言 value: 配置文件 }
-- key 必须为下列网址列出的名称
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
local servers = {
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
clangd = require "lsp.lua" -- /lua/lsp/clangd.lua
sumneko_lua = require("lsp.config.lua"), -- lua/lsp/config/lua.lua
clangd = require("lsp.config.lua"),
}
-- 自动安装 LanguageServers
-- 自动安装 Language Servers
for name, _ in pairs(servers) do
local server_is_found, server = lsp_installer.get_server(name)
if server_is_found then
@ -19,20 +19,14 @@ for name, _ in pairs(servers) do
end
end
lsp_installer.on_server_ready(function(server)
local opts = servers[server.name]
if opts then
opts.on_attach = function(_, bufnr)
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
opts.flags = {
debounce_text_changes = 150,
}
server:setup(opts)
local config = servers[server.name]
if config == nil then
return
end
if config.on_setup then
config.on_setup(server)
else
server:setup({})
end
end)

View File

@ -0,0 +1,37 @@
local status, bufferline = pcall(require, "bufferline")
if not status then
vim.notify("没有找到 bufferline")
return
end
-- bufferline 配置
-- https://github.com/akinsho/bufferline.nvim#configuration
bufferline.setup({
options = {
-- 关闭 Tab 的命令,这里使用 moll/vim-bbye 的 :Bdelete 命令
close_command = "Bdelete! %d",
right_mouse_command = "Bdelete! %d",
-- 侧边栏配置
-- 左侧让出 nvim-tree 的位置,显示文字 File Explorer
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",
highlight = "Directory",
text_align = "left",
},
},
-- 使用 nvim 内置 LSP 后续课程会配置
diagnostics = "nvim_lsp",
-- 可选,显示 LSP 报错图标
---@diagnostic disable-next-line: unused-local
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local s = " "
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and "" or (e == "warning" and "" or "")
s = s .. n .. sym
end
return s
end,
},
})

View File

@ -0,0 +1,73 @@
local status, db = pcall(require, "dashboard")
if not status then
vim.notify("没有找到 dashboard")
return
end
db.custom_footer = {
"",
"",
"https://github.com/nshen/learn-neovim-lua",
}
db.custom_center = {
{
icon = "",
desc = "Projects ",
action = "Telescope projects",
},
{
icon = "",
desc = "Recently files ",
action = "Telescope oldfiles",
},
{
icon = "",
desc = "Edit keybindings ",
action = "edit ~/.config/nvim/lua/keybindings.lua",
},
{
icon = "",
desc = "Edit Projects ",
action = "edit ~/.local/share/nvim/project_nvim/project_history",
},
-- {
-- icon = " ",
-- desc = "Edit .bashrc ",
-- action = "edit ~/.bashrc",
-- },
-- {
-- icon = " ",
-- desc = "Change colorscheme ",
-- action = "ChangeColorScheme",
-- },
-- {
-- icon = " ",
-- desc = "Edit init.lua ",
-- action = "edit ~/.config/nvim/init.lua",
-- },
-- {
-- icon = " ",
-- desc = "Find file ",
-- action = "Telescope find_files",
-- },
-- {
-- icon = " ",
-- desc = "Find text ",
-- action = "Telescopecope live_grep",
-- },
}
db.custom_header = {
[[ ▀████▀▄▄ ▄█ ]],
[[ █▀ ▀▀▄▄▄▄▄ ▄▄▀▀█ ]],
[[ ▄ █ ▀▀▀▀▄ ▄▀ ]],
[[ ▄▀ ▀▄ ▀▄ ▀▄▀ ]],
[[ ▄▀ █ █▀ ▄█▀▄ ▄█ ]],
[[ ▀▄ ▀▄ █ ▀██▀ ██▄█ ]],
[[ ▀▄ ▄▀ █ ▄██▄ ▄ ▄ ▀▀ █ ]],
[[ █ ▄▀ █ ▀██▀ ▀▀ ▀▀ ▄▀ ]],
[[ █ █ █ ▄▄ ▄▀ ]],
}

View File

@ -0,0 +1,43 @@
-- 如果找不到lualine 组件,就不继续执行
local status, lualine = pcall(require, "lualine")
if not status then
vim.notify("没有找到 lualine")
return
end
lualine.setup({
options = {
theme = "tokyonight",
component_separators = { left = "|", right = "|" },
-- https://github.com/ryanoasis/powerline-extra-symbols
section_separators = { left = "", right = "" },
},
extensions = { "nvim-tree", "toggleterm" },
sections = {
lualine_c = {
"filename",
{
"lsp_progress",
spinner_symbols = { "", "", "", "", "", "" },
},
},
lualine_x = {
"filesize",
{
"fileformat",
-- symbols = {
-- unix = '', -- e712
-- dos = '', -- e70f
-- mac = '', -- e711
-- },
symbols = {
unix = "LF",
dos = "CRLF",
mac = "CR",
},
},
"encoding",
"filetype",
},
},
})

View File

@ -1,7 +1,67 @@
require'nvim-tree'.setup {
local status, nvim_tree = pcall(require, "nvim-tree")
if not status then
vim.notify("没有找到 nvim-tree")
return
end
-- 列表操作快捷键
local list_keys = require('keybindings').nvimTreeList
nvim_tree.setup({
-- 不显示 git 状态图标
git = {
enable = false
}
}
enable = false,
},
-- project plugin 需要这样设置
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = true,
},
-- 隐藏 .文件 和 node_modules 文件夹
filters = {
dotfiles = true,
custom = { 'node_modules' },
},
view = {
-- 宽度
width = 40,
-- 也可以 'right'
side = 'left',
-- 隐藏根目录
hide_root_folder = false,
-- 自定义列表中快捷键
mappings = {
custom_only = false,
list = list_keys,
},
-- 不显示行数
number = false,
relativenumber = false,
-- 显示图标
signcolumn = 'yes',
},
actions = {
open_file = {
-- 首次打开大小适配
resize_window = true,
-- 打开文件时关闭
quit_on_open = true,
},
},
-- wsl install -g wsl-open
-- https://github.com/4U6U57/wsl-open/
system_open = {
cmd = 'wsl-open', -- mac 直接设置为 open
},
-- project plugin 需要这样设置
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = true,
},
})
-- 自动关闭
vim.cmd([[
autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif
]])

View File

@ -1,30 +1,16 @@
require'nvim-treesitter.configs'.setup {
local status, treesitter = pcall(require, "nvim-treesitter.configs")
if not status then
vim.notify("没有找到 nvim-treesitter")
return
end
treesitter.setup({
-- 安装 language parser
-- :TSInstallInfo 命令查看支持的语言
ensure_installed = {"html", "css", "lua", "javascript", "typescript", "tsx", "cpp", "c"},
-- 启用代码高亮功能
ensure_installed = { "cpp", "c", "json", "html", "css", "vim", "lua", "javascript", "typescript", "tsx" },
-- 启用代码高亮模块
highlight = {
enable = true,
additional_vim_regex_highlighting = false
additional_vim_regex_highlighting = false,
},
-- 启用增量选择
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<CR>',
node_incremental = '<CR>',
node_decremental = '<BS>',
scope_incremental = '<TAB>',
}
},
-- 启用基于Treesitter的代码格式化(=) . NOTE: This is an experimental feature.
indent = {
enable = true
}
}
-- 开启 Folding
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
-- 默认不要折叠
-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file
vim.wo.foldlevel = 99
})

View File

@ -0,0 +1,20 @@
local status, project = pcall(require, "project_nvim")
if not status then
vim.notify("没有找到 project_nvim")
return
end
-- nvim-tree 支持
vim.g.nvim_tree_respect_buf_cwd = 1
project.setup({
detection_methods = { "pattern" },
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", ".sln" },
})
local status, telescope = pcall(require, "telescope")
if not status then
vim.notify("没有找到 telescope")
return
end
pcall(telescope.load_extension, "projects")

View File

@ -0,0 +1,24 @@
local status, telescope = pcall(require, "telescope")
if not status then
vim.notify("没有找到 telescope")
return
end
telescope.setup({
defaults = {
-- 打开弹窗后进入的初始模式,默认为 insert也可以是 normal
initial_mode = "insert",
-- 窗口内快捷键
mappings = require("keybindings").telescopeList,
},
pickers = {
-- 内置 pickers 配置
find_files = {
-- 查找文件换皮肤,支持的参数有: dropdown, cursor, ivy
-- theme = "dropdown",
}
},
extensions = {
-- 扩展插件配置
},
})

View File

@ -1,32 +1,69 @@
return require('packer').startup(function()
-- Packer can manage itself
local packer = require("packer")
packer.startup({
function(use)
-- Packer 可以管理自己本身
use 'wbthomason/packer.nvim'
-- gruvbox theme
use {
"ellisonleao/gruvbox.nvim",
requires = {"rktjmp/lush.nvim"}
}
use 'shaunsingh/nord.nvim'
use 'glepnir/zephyr-nvim'
-- 你的插件列表...
-- nvim-tree (新增)
use {
'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons'
}
-- treesitter
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
-- lspconfig
use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'}
-- nvim-cmp
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/nvim-cmp'
-- vsnip
use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' }
use 'hrsh7th/vim-vsnip'
use 'rafamadriz/friendly-snippets'
-- lspkind
use 'onsails/lspkind-nvim'
end)
use({ "kyazdani42/nvim-tree.lua", requires = "kyazdani42/nvim-web-devicons" })
-- bufferline (新增)
use({ "akinsho/bufferline.nvim", requires = { "kyazdani42/nvim-web-devicons", "moll/vim-bbye" } })
-- lualine (新增)
use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons" } })
use("arkav/lualine-lsp-progress")
-- telescope (新增)
use { 'nvim-telescope/telescope.nvim', requires = { "nvim-lua/plenary.nvim" } }
-- dashboard-nvim (新增)
use("glepnir/dashboard-nvim")
-- project
use("ahmedkhalf/project.nvim")
-- treesitter (新增)
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
--------------------- LSP --------------------
use("williamboman/nvim-lsp-installer")
-- Lspconfig
use({ "neovim/nvim-lspconfig" })
--------------------- colorschemes --------------------
-- tokyonight
use("folke/tokyonight.nvim")
-- OceanicNext
use("mhartington/oceanic-next")
-- gruvbox
use({ "ellisonleao/gruvbox.nvim", requires = { "rktjmp/lush.nvim" } })
-- zephyr 暂时不推荐,详见上边解释
-- use("glepnir/zephyr-nvim")
-- nord
use("shaunsingh/nord.nvim")
-- onedark
use("ful1e5/onedark.nvim")
-- nightfox
use("EdenEast/nightfox.nvim")
-------------------------------------------------------
end,
config = {
display = {
open_fn = function()
return require("packer.util").float({ border = "single" })
end,
},
}
})
-- 每次保存 plugins.lua 自动安装插件
pcall(
vim.cmd,
[[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]]
)

View File

@ -49,8 +49,8 @@ local function save_profiles(threshold)
end
time([[Luarocks path setup]], true)
local package_path_str = "/Users/yuhangq/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/yuhangq/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/yuhangq/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/yuhangq/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/yuhangq/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
local package_path_str = "/Users/zxd/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/zxd/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/zxd/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/zxd/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/zxd/.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
@ -74,100 +74,110 @@ end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["cmp-buffer"] = {
["bufferline.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
url = "https://github.com/akinsho/bufferline.nvim"
},
["cmp-cmdline"] = {
["dashboard-nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
url = "https://github.com/hrsh7th/cmp-cmdline"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-path"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
["cmp-vsnip"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
url = "https://github.com/hrsh7th/cmp-vsnip"
},
["friendly-snippets"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/friendly-snippets",
url = "https://github.com/rafamadriz/friendly-snippets"
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/dashboard-nvim",
url = "https://github.com/glepnir/dashboard-nvim"
},
["gruvbox.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/gruvbox.nvim",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/gruvbox.nvim",
url = "https://github.com/ellisonleao/gruvbox.nvim"
},
["lspkind-nvim"] = {
["lualine-lsp-progress"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
url = "https://github.com/onsails/lspkind-nvim"
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/lualine-lsp-progress",
url = "https://github.com/arkav/lualine-lsp-progress"
},
["lualine.nvim"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["lush.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/lush.nvim",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/lush.nvim",
url = "https://github.com/rktjmp/lush.nvim"
},
["nightfox.nvim"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nightfox.nvim",
url = "https://github.com/EdenEast/nightfox.nvim"
},
["nord.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nord.nvim",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nord.nvim",
url = "https://github.com/shaunsingh/nord.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lsp-installer"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
url = "https://github.com/williamboman/nvim-lsp-installer"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/kyazdani42/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
},
["oceanic-next"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/oceanic-next",
url = "https://github.com/mhartington/oceanic-next"
},
["onedark.nvim"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/onedark.nvim",
url = "https://github.com/ful1e5/onedark.nvim"
},
["packer.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/packer.nvim",
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["vim-vsnip"] = {
["plenary.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/vim-vsnip",
url = "https://github.com/hrsh7th/vim-vsnip"
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["zephyr-nvim"] = {
["project.nvim"] = {
loaded = true,
path = "/Users/yuhangq/.local/share/nvim/site/pack/packer/start/zephyr-nvim",
url = "https://github.com/glepnir/zephyr-nvim"
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/project.nvim",
url = "https://github.com/ahmedkhalf/project.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["tokyonight.nvim"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
url = "https://github.com/folke/tokyonight.nvim"
},
["vim-bbye"] = {
loaded = true,
path = "/Users/zxd/.local/share/nvim/site/pack/packer/start/vim-bbye",
url = "https://github.com/moll/vim-bbye"
}
}

View File

@ -1,8 +0,0 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
printf("Hello World!");
for(int i=0; i<=10; i++) {
:
}
}