This commit is contained in:
js0ny 2025-01-13 12:18:21 +00:00
commit 9eb09bade7
45 changed files with 1212 additions and 770 deletions

View file

@ -1,14 +1,14 @@
-- alpha-nvim.lua
return {
{
'goolord/alpha-nvim',
"goolord/alpha-nvim",
dependencies = {
-- 'echasnovski/mini.icons',
-- 'nvim-lua/plenary.nvim'
},
config = function ()
local alpha = require'alpha'
local dashboard = require'alpha.themes.dashboard'
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ",
"================= =============== =============== ======== ========",
@ -34,11 +34,11 @@ return {
dashboard.section.buttons.val.leader = "SPC"
dashboard.section.buttons.val = {
-- leader = "SPC",
dashboard.button('p', '󰈞 查找项目', ':Telescope projects<CR>'),
dashboard.button('h', ' 历史文件', ':Telescope oldfiles<CR>'),
dashboard.button('l', ' 加载会话', ':SessionSearch<CR>'),
dashboard.button('c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim<CR>'),
dashboard.button('SPC q', '󱊷 退出', ':qa<CR>'),
dashboard.button("p", "󰈞 查找项目", ":Telescope projects<CR>"),
dashboard.button("h", " 历史文件", ":Telescope oldfiles<CR>"),
dashboard.button("l", " 加载会话", ":SessionSearch<CR>"),
dashboard.button("c", " 转到设置", ":Telescope find_files cwd=~/.config/nvim<CR>"),
dashboard.button("SPC q", "󱊷 退出", ":qa<CR>"),
}
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " "
@ -47,6 +47,6 @@ return {
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
alpha.setup(dashboard.config)
end
};
end,
},
}

View file

@ -1,15 +1,15 @@
---@diagnostic disable: undefined-doc-name
return {
{
'rmagatti/auto-session',
"rmagatti/auto-session",
lazy = false,
---enables autocomplete for opts
---@module "auto-session"
---@type AutoSession.Config
opts = {
suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' },
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
-- log_level = 'debug',
}
}
},
},
}

View file

@ -1,17 +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,
"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

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
-- This will provide type hinting with LuaLS
---@module "conform"
---@type conform.setupOpts
opts = {
-- Define your formatters
formatters_by_ft = {
lua = { "stylua" },
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_format = "fallback" }
end,
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
},
init = function()
-- If you want the formatexpr, here is the place to set it
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View file

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

View file

@ -1,6 +1,6 @@
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
local lualine = require("lualine")
-- Color table for highlights
-- stylua: ignore
@ -20,14 +20,14 @@ local colors = {
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
local filepath = vim.fn.expand("%:p:h")
local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
@ -36,11 +36,11 @@ local conditions = {
local config = {
options = {
disabled_filetypes = {
statusline = { "NvimTree", "alpha" }
statusline = { "NvimTree", "alpha" },
},
-- Disable sections and component separators
component_separators = '',
section_separators = '',
component_separators = "",
section_separators = "",
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
@ -80,18 +80,18 @@ local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
ins_left({
function()
return ''
return ""
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
})
ins_left {
ins_left({
-- mode component
function()
return ''
return ""
end,
color = function()
-- auto change color according to neovims mode
@ -99,13 +99,13 @@ ins_left {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
[""] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
[""] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
@ -113,14 +113,14 @@ ins_left {
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
["r?"] = colors.cyan,
["!"] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
})
-- ins_left {
-- -- filesize component
@ -134,42 +134,39 @@ ins_left {
-- color = { fg = colors.magenta, gui = 'bold' },
-- }
-- ins_left { 'location' }
ins_right { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_right({ "progress", color = { fg = colors.fg, gui = "bold" } })
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '' },
ins_left({
"diagnostics",
sources = { "nvim_diagnostic" },
symbols = { error = "", warn = "", info = "" },
diagnostics_color = {
error = { fg = colors.red },
warn = { fg = colors.yellow },
info = { fg = colors.cyan },
},
}
})
ins_left {
ins_left({
function()
return vim.bo.filetype
end,
color = { fg = colors.blue, gui = 'bold' },
}
color = { fg = colors.blue, gui = "bold" },
})
ins_left {
ins_left({
function()
return vim.bo.shiftwidth .. " space"
end,
}
})
ins_left {
ins_left({
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 })
local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 })
local clients = vim.lsp.get_clients()
if next(clients) == nil then
return msg
@ -182,59 +179,58 @@ ins_left {
end
return msg
end,
icon = '',
color = { fg = '#ffffff', gui = 'bold' },
}
icon = "",
color = { fg = "#ffffff", gui = "bold" },
})
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
ins_left({
function()
return '%='
return "%="
end,
}
})
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
ins_right({
"o:encoding", -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
color = { fg = colors.green, gui = "bold" },
})
ins_right {
'fileformat',
ins_right({
"fileformat",
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
color = { fg = colors.green, gui = "bold" },
})
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right({
"branch",
icon = "",
color = { fg = colors.violet, gui = "bold" },
})
ins_right {
'diff',
ins_right({
"diff",
-- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = '󰝤 ', removed = '' },
symbols = { added = "", modified = "󰝤 ", removed = "" },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
})
ins_right {
ins_right({
function()
return ''
return ""
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
})
-- Now don't forget to initialize lualine
lualine.setup(config)

View file

@ -15,16 +15,16 @@ return {
shift_width = 1,
heading_1 = {
style = "label",
hl = "MarkviewH1"
}
hl = "MarkviewH1",
},
},
code_blocks = {
style = "language",
language_direction = "right",
hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo"
}
info_hl = "MarkviewCodeInfo",
},
})
end
}
end,
},
}

View file

@ -1,9 +1,9 @@
local function set_keymaps(keymaps_cmp)
local mappings = {}
for _, map in ipairs(keymaps_cmp) do
mappings[map.keys] = map.cmd
end
return mappings
for _, map in ipairs(keymaps_cmp) do
mappings[map.keys] = map.cmd
end
return mappings
end
return {

View file

@ -1,6 +1,6 @@
local function my_on_attach(bufnr)
-- local keymaps = require("config.keymaps")
local api = require "nvim-tree.api"
local api = require("nvim-tree.api")
local default_mode = { "n" }
local keymaps = require("keymaps")
@ -8,7 +8,6 @@ local function my_on_attach(bufnr)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local function set_keymaps(maps)
for _, map in ipairs(maps) do
local mode = map.mode or default_mode
@ -28,10 +27,26 @@ return {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup {
require("nvim-tree").setup({
on_attach = my_on_attach,
sync_root_with_cwd = true,
respect_buf_cwd = true,
}
end
disable_netrw = true,
renderer = {
icons = {
glyphs = {
git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29
unmerged = "",
renamed = "",
deleted = "",
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
},
},
},
},
})
end,
}

View file

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

View file

@ -1,6 +1,6 @@
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
version = "*", -- recommended, use latest release instead of latest commit
lazy = false,
ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
@ -26,11 +26,11 @@ return {
},
completion = {
nvim_cmp = true,
min_chars = 2
min_chars = 2,
},
ui = {
enable = false
}
enable = false,
},
-- see below for full list of options 👇
},
}

View file

@ -1,15 +1,15 @@
return {
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup({
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "Makefile", "package.json" },
sync_root_with_cwd = true,
silent_chdir = true,
scope_chdir = "global",
})
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup({
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "Makefile", "package.json" },
sync_root_with_cwd = true,
silent_chdir = true,
scope_chdir = "global",
})
require("telescope").load_extension("projects")
end,
dependencies = { "nvim-telescope/telescope.nvim" },
require("telescope").load_extension("projects")
end,
dependencies = { "nvim-telescope/telescope.nvim" },
}

View file

@ -1,8 +1,19 @@
return {
"nvim-telescope/telescope.nvim",
config = function ()
require("telescope").setup {
config = function()
require("telescope").setup({
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = {
n = {
["n"] = "move_selection_next",
@ -11,11 +22,11 @@ return {
["r"] = "preview_scrolling_down",
["a"] = "preview_scrolling_left",
["s"] = "preview_scrolling_right",
}
}
}
}
["q"] = require("telescope.actions").close,
},
},
},
})
end,
dependencies = { "nvim-lua/plenary.nvim" },
}

View file

@ -7,33 +7,32 @@ return {
show_file_path = true,
show_symbols = true,
colors = {
path = '#9c1d91',
file_name = '',
symbols = '',
path = "#9c1d91",
file_name = "",
symbols = "",
},
icons = {
file_icon_default = '',
seperator = '>',
editor_state = '',
lock_icon = '',
file_icon_default = "",
seperator = ">",
editor_state = "",
lock_icon = "",
},
exclude_filetype = {
'help',
'startify',
'dashboard',
'packer',
'neogitstatus',
'NvimTree',
'Trouble',
'alpha',
'lir',
'Outline',
'spectre_panel',
'toggleterm',
'qf',
}
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"alpha",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"qf",
},
})
end,
},
}