refractor(nvim): Separate config files

This commit is contained in:
js0ny 2024-11-28 23:03:44 +00:00
parent 5455e68b8c
commit 2a76a6fbe4
24 changed files with 326 additions and 157 deletions

View file

@ -37,7 +37,8 @@ return {
dashboard.button('c', ' 新建文件', ':enew<CR>'),
dashboard.button('SPC f f', '󰈞 查找文件', ':Telescope find_files<CR>'),
dashboard.button('SPC f h', ' 历史文件', ':Telescope oldfiles<CR>'),
dashboard.button('SPC s l', ' 加载会话', ':SessionSearch<CR>'), -- 加载会话
dashboard.button('SPC s l', ' 加载会话', ':SessionSearch<CR>'),
dashboard.button('SPC f c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim<CR>'),
dashboard.button('SPC q', '󱊷 退出', ':qa<CR>'),
}
local handle = io.popen('fortune')

View file

@ -0,0 +1,17 @@
return {
"akinsho/bufferline.nvim",
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
config = function()
require("bufferline").setup({
options = {
numbers = "ordinal", -- 显示 buffer 序号
close_command = "bdelete! %d", -- 关闭 buffer 的命令
right_mouse_command = "bdelete! %d", -- 右键关闭
offsets = {
{ filetype = "NvimTree", text = "资源管理器", text_align = "center" },
},
separator_style = "thin",
},
})
end,
}

View file

@ -1,4 +1,4 @@
return {
"neovim/nvim-lspconfig",
lazy = false
"neovim/nvim-lspconfig",
lazy = false
}

View file

@ -91,7 +91,7 @@ ins_left {
ins_left {
-- mode component
function()
return ''
return ''
end,
color = function()
-- auto change color according to neovims mode

View file

@ -20,7 +20,11 @@ return {
local cmp = require("cmp")
local lspconfig = require("lspconfig")
local capabitilies = require("cmp_nvim_lsp").default_capabilities()
local servers = require("config.servers")
local servers = require("config.servers").servers
local servers_config = require("config.servers").server_config
local default_server_config = {
capabilities = capabitilies,
}
cmp.setup({
snippet = {
@ -41,7 +45,7 @@ return {
}
),
})
local keymaps = require("config.keymaps")
local keymaps = require("keymaps")
local keymaps_cmp = keymaps.cmp_nvim_keymaps(cmp.mapping)
local function set_keymaps()
@ -63,9 +67,9 @@ return {
})
for _, server in ipairs(servers) do
lspconfig[server].setup({
capabilities = capabitilies,
})
local config = servers_config[server] or {}
config = vim.tbl_extend("force", default_server_config, config)
lspconfig[server].setup(config)
end
end,
}

View file

@ -2,7 +2,7 @@ local function my_on_attach(bufnr)
-- local keymaps = require("config.keymaps")
local api = require "nvim-tree.api"
local default_mode = { "n" }
local keymaps = require("config.keymaps")
local keymaps = require("keymaps")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
@ -16,7 +16,7 @@ local function my_on_attach(bufnr)
end
end
local raw_keymaps = keymaps.nvim_tree_keymaps(api, opts)
local raw_keymaps = require("keymaps.nvim-tree").plugin(api, opts)
set_keymaps(raw_keymaps)
end
@ -32,10 +32,6 @@ return {
on_attach = my_on_attach,
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_cwd = true,
},
}
end
}

View file

@ -0,0 +1,11 @@
return {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "markdown", "markdown_inline" },
highlight = { enable = true },
indent = { enable = true },
})
end,
}

View file

@ -0,0 +1,33 @@
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
-- -- refer to `:h file-pattern` for more examples
-- "BufReadPre path/to/my-vault/*.md",
-- "BufNewFile path/to/my-vault/*.md",
-- },
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- see below for full list of optional dependencies 👇
},
opts = {
workspaces = {
{
name = "personal",
path = "/mnt/c/Users/citoy/Obsidian",
},
},
completion = {
nvim_cmp = true,
min_chars = 2
}
-- see below for full list of options 👇
},
}

View file

@ -0,0 +1,39 @@
return {
{
"fgheng/winbar.nvim",
config = function()
require("winbar").setup({
enabled = true,
show_file_path = true,
show_symbols = true,
colors = {
path = '',
file_name = '',
symbols = '',
},
icons = {
file_icon_default = '',
seperator = '>',
editor_state = '',
lock_icon = '',
},
exclude_filetype = {
'help',
'startify',
'dashboard',
'packer',
'neogitstatus',
'NvimTree',
'Trouble',
'alpha',
'lir',
'Outline',
'spectre_panel',
'toggleterm',
'qf',
}
})
end,
},
}