lots of changes

This commit is contained in:
Zacharias-Brohn
2025-02-15 17:20:09 +01:00
parent f41c99a565
commit d3465ff5cd
9 changed files with 144 additions and 223 deletions
+27 -49
View File
@@ -1,52 +1,30 @@
require("barbar").setup ({
animation = true,
auto_hide = false,
tabpages = true,
clickable = true,
exclude_ft = { "NvimTree" },
focus_on_close = 'left',
highlight_alternate = false,
highlight_inactive_file_icons = true,
highlight_visible = true,
icons = {
buffer_index = false,
buffer_number = false,
button = '',
diagnostics = {
[vim.diagnostic.severity.ERROR] = {enabled = true, icon = ''},
[vim.diagnostic.severity.WARN] = {enabled = false},
[vim.diagnostic.severity.INFO] = {enabled = false},
[vim.diagnostic.severity.HINT] = {enabled = true},
},
gitsigns = {
added = {enabled = true, icon = '+'},
changed = {enabled = true, icon = '~'},
deleted = {enabled = true, icon = '-'},
},
filetype = {
custom_colors = false,
enabled = true,
},
separator = {left = '', right = ''},
separator_at_end = true,
modified = {button = ''},
pinned = {button = '', filename = true},
preset = 'default',
alternate = {filetype = {enabled = true}},
current = {buffer_index = false},
inactive = {button = '×', filetype = {enabled = true}, separator = {left = '', right = ''} },
visible = {modified = {buffer_number = false}},
},
insert_at_end = true,
maximum_padding = 1,
minimum_padding = 1,
maximum_length = 15,
minimum_length = 15,
sidebar_filetypes = {
NvimTree = true,
undotree = {
text = "undotree",
align = "center",
require("bufferline").setup ({
options = {
diagnostics = "nvim_lsp",
always_show_bufferline = true,
diagnostics_indicator = function(_, _, diag)
local icons = LazyVim.config.icons.diagnostics
local ret = (diag.error and icons.Error .. diag.error .. " " or "")
.. (diag.warning and icons.Warn .. diag.warning or "")
return vim.trim(ret)
end,
offsets = {
{
filetype = "neo-tree",
text = "Neo-tree",
highlight = "Directory",
text_align = "left",
},
{
filetype = "snacks_layout_box",
},
},
vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete" }, {
callback = function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
end,
})
},
})
+24 -95
View File
@@ -1,5 +1,18 @@
local fn = vim.fn
local function get_coc_lsp_client()
local clients = vim.g.coc_service_initialized and vim.fn['CocAction']('services') or {}
for _, client in pairs(clients) do
if client['state'] == 'running' then
local client_name = client['id']
-- Remove 'languageserver.' prefix if it exists
client_name = client_name:gsub('^languageserver%.', '')
return client_name
end
end
return ''
end
local function spell()
if vim.o.spell then
return string.format("[SPELL]")
@@ -11,12 +24,7 @@ end
--- show indicator for Chinese IME
local function ime_state()
if vim.g.is_mac then
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
-- We can use `xkbswitch -g` on the command line to get current mode.
-- mode for macOS builtin pinyin IME: com.apple.inputmethod.SCIM.ITABC
-- mode for Rime: im.rime.inputmethod.Squirrel.Rime
local res = fn.match(layout, [[\v(Squirrel\.Rime|SCIM.ITABC)]])
if res ~= -1 then
return "[CN]"
@@ -26,62 +34,6 @@ local function ime_state()
return ""
end
local function trailing_space()
if not vim.o.modifiable then
return ""
end
local line_num = nil
for i = 1, fn.line("$") do
local linetext = fn.getline(i)
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
local idx = fn.match(linetext, [[\v\s+$]])
if idx ~= -1 then
line_num = i
break
end
end
local msg = ""
if line_num ~= nil then
msg = string.format("[%d]trailing", line_num)
end
return msg
end
local function mixed_indent()
if not vim.o.modifiable then
return ""
end
local space_pat = [[\v^ +]]
local tab_pat = [[\v^\t+]]
local space_indent = fn.search(space_pat, "nwc")
local tab_indent = fn.search(tab_pat, "nwc")
local mixed = (space_indent > 0 and tab_indent > 0)
local mixed_same_line
if not mixed then
mixed_same_line = fn.search([[\v^(\t+ | +\t)]], "nwc")
mixed = mixed_same_line > 0
end
if not mixed then
return ""
end
if mixed_same_line ~= nil and mixed_same_line > 0 then
return "MI:" .. mixed_same_line
end
local space_indent_cnt = fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total
local tab_indent_cnt = fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total
if space_indent_cnt > tab_indent_cnt then
return "MI:" .. tab_indent
else
return "MI:" .. space_indent
end
end
local diff = function()
local git_status = vim.b.gitsigns_status_dict
if git_status == nil then
@@ -118,36 +70,21 @@ local virtual_env = function()
end
end
local get_active_lsp = function()
local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_get_option_value("filetype", {})
local clients = vim.lsp.get_clients { bufnr = 0 }
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
---@diagnostic disable-next-line: undefined-field
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end
require("lualine").setup {
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = "",
globalstatus = true,
component_separators = '',
section_separators = { left = '', right = '' },
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = {
"mode",
{
"mode",
},
},
lualine_b = {
{
@@ -157,6 +94,7 @@ require("lualine").setup {
return string.sub(name, 1, 20)
end,
color = { gui = "italic,bold" },
separator = { right = "" },
},
{
virtual_env,
@@ -189,7 +127,7 @@ require("lualine").setup {
color = { fg = "black", bg = "#f46868" },
},
{
get_active_lsp,
get_coc_lsp_client,
icon = " LSP:",
},
{
@@ -203,23 +141,14 @@ require("lualine").setup {
{
"fileformat",
symbols = {
unix = "unix",
dos = "win",
mac = "mac",
unix = "",
dos = "",
mac = "",
},
},
"filetype",
},
lualine_z = {
{
trailing_space,
color = "WarningMsg",
},
{
mixed_indent,
color = "WarningMsg",
},
"location",
"progress",
},
},
+1 -39
View File
@@ -1,40 +1,2 @@
-- Lua
require('onedark').setup {
-- Main options --
style = 'light', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
transparent = false, -- Show/hide background
term_colors = true, -- Change terminal color as per the selected theme style
ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
-- toggle theme style ---
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between
-- Change code style ---
-- Options are italic, bold, underline, none
-- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
code_style = {
comments = 'italic',
keywords = 'none',
functions = 'none',
strings = 'none',
variables = 'none'
},
-- Lualine options --
lualine = {
transparent = false, -- lualine center bar transparency
},
-- Custom Highlights --
colors = {}, -- Override default colors
highlights = {}, -- Override highlight groups
-- Plugins Config --
diagnostics = {
darker = true, -- darker colors for diagnostic
undercurl = true, -- use undercurl instead of underline for diagnostics
background = true, -- use background color for virtual text
},
}
require('onedarkpro').setup({})
+3 -9
View File
@@ -6,12 +6,6 @@ vim.g.mapleader = " "
vim.g.gruvbox_material_background = "medium"
vim.g.coq_settings = { keymap = { recommended = false } }
vim.g.gruvbox_material_foreground = "original"
-- if time >= 10 and time < 20 then
-- vim.g.lightline = {
-- colorscheme = "one",
-- }
-- else
-- vim.g.lightline = {
-- colorscheme = "gruvbox",
-- }
-- end
vim.api.nvim_set_hl(0, 'GitGutterAdd', { fg = '#009900', ctermfg = 2 })
vim.api.nvim_set_hl(0, 'GitGutterChange', { fg = '#bbbb00', ctermfg = 3 })
vim.api.nvim_set_hl(0, 'GitGutterDelete', { fg = '#ff2222', ctermfg = 1 })
+5 -4
View File
@@ -1,7 +1,7 @@
local map = vim.keymap.set
map("n", "<Tab>", ":BufferNext<CR>")
map("n", "<S-Tab>", ":BufferPrevious<CR>")
map("n", "<Tab>", "<Cmd>BufferLineCycleNext<CR>")
map("n", "<S-Tab>", "<Cmd>BufferLineCyclePrev<CR>")
map("n", ";", ":", { desc = "CMD enter command mode" })
@@ -21,10 +21,11 @@ map("i", "<A-c>", vim.cmd.CopilotChatToggle)
map("v", "<A-c>", vim.cmd.CopilotChatToggle)
map('n', '<leader>e', vim.cmd.NvimTreeToggle)
-- map('n', '<leader>e', function() Snacks.explorer() end)
map('n', '<leader>u', require('undotree').toggle, { noremap = true, silent = true })
map("n", "<A-->", ":BufferClose<CR>")
map("n", "<SA-->", ":BufferRestore<CR>")
map("n", "<A-->", ":bdelete<CR>")
-- map("n", "<SA-->", ":BufferRestore<CR>")
map("n", "<C-a>", "ggVG", { noremap = true, silent = true })
+65 -16
View File
@@ -16,11 +16,11 @@ return {
"neoclide/coc.nvim",
branch = 'release',
},
-- {
-- "sainnhe/gruvbox-material",
-- },
{
"sainnhe/gruvbox-material",
},
{
"navarasu/onedark.nvim",
"olimorris/onedarkpro.nvim",
config = function()
require("config.themelight")
end,
@@ -48,8 +48,8 @@ return {
end,
},
{
"romgrk/barbar.nvim",
init = function() vim.g.barbar_auto_setup = false end,
"akinsho/bufferline.nvim",
event = "VeryLazy",
config = function()
require("config.barbar")
end,
@@ -73,15 +73,15 @@ return {
require("config.undotree")
end,
},
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config
config = function()
require("config.indent-blankline")
end,
},
-- {
-- "lukas-reineke/indent-blankline.nvim",
-- main = "ibl",
-- ---@module "ibl"
-- ---@type ibl.config
-- config = function()
-- require("config.indent-blankline")
-- end,
-- },
{
"hiphish/rainbow-delimiters.nvim",
},
@@ -124,7 +124,56 @@ return {
{
"mfussenegger/nvim-dap",
config = function()
require "config.dap"
require("config.dap")
end,
},
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
animate = {
enabled = true,
fps = 144,
easing = "inExpo",
duration = 20,
},
bigfile = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
dashboard = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
explorer = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
indent = {
enabled = true,
scope = {
enabled = false,
underline = true,
},
chunk = {
enabled = true,
char = {
corner_top = "",
corner_bottom = "",
vertical = "",
arrow = "",
},
},
animate = {
easing = "linear",
duration = 10,
}
},
input = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
picker = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
notifier = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
quickfile = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
scope = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
scroll = { enabled = true, animate = { easing = "linear", duration = 5 } },
statuscolumn = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
words = { enabled = true, animate = { easing = "inExpo", duration = 20 } },
},
},
{
"notken12/base46-colors",
},
}