mirror of
https://git.sr.ht/~coasteen/dotfiles
synced 2025-11-04 14:47:38 +01:00
new nvim line
This commit is contained in:
parent
761b9be034
commit
c50cc229b3
8 changed files with 149 additions and 92 deletions
|
|
@ -1,6 +1,5 @@
|
|||
require("plugins/lazy")
|
||||
require("plugins/lsp")
|
||||
require("plugins/lualine")
|
||||
require("plugins/nvim-tree")
|
||||
require("plugins/telescope")
|
||||
require("plugins/treesitter")
|
||||
|
|
@ -8,3 +7,4 @@ require("plugins/treesitter")
|
|||
require("config")
|
||||
require("plugins/render-markdown")
|
||||
require("plugins/monokai-pro")
|
||||
require("status_line").setup()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
|
||||
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
||||
"comfy-line-numbers.nvim": { "branch": "main", "commit": "31e2f9287b4491ad72defb9e0185eb2739983799" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "202d8e92b3a74ac88eb3a7f1e40fb59b4c2a6535" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "d50e40b3bf9324128e71b0b7e589765ce89466d2" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
|
|
@ -31,5 +31,6 @@
|
|||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"twilight.nvim": { "branch": "main", "commit": "664e752f4a219801265cc3fc18782b457b58c1e1" },
|
||||
"typst-preview.nvim": { "branch": "master", "commit": "e544812bba84b4f7976590f2b6c0dfbd099e1893" },
|
||||
"vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" },
|
||||
"vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,5 +99,6 @@ return {
|
|||
},
|
||||
},
|
||||
"nguyenvukhang/nvim-toggler",
|
||||
"alvan/vim-closetag",
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@ local fmt = require("null-ls")
|
|||
local cmp = require("cmp")
|
||||
|
||||
require("nvim-autopairs").setup({})
|
||||
require("lsp_signature").setup({
|
||||
hint_enable = false,
|
||||
})
|
||||
require("lsp_signature").setup({ hint_enable = false })
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
fmt.setup({
|
||||
sources = {
|
||||
|
|
@ -27,6 +26,7 @@ fmt.setup({
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
|
|
@ -40,112 +40,78 @@ cmp.setup({
|
|||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered() },
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" },
|
||||
{
|
||||
name = "spell",
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
{ name = "spell" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
}),
|
||||
})
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "git" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
lsp.html.setup({
|
||||
cmd = { "vscode-html-language-server", "--stdio" },
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
configurationSection = { "html", "css", "javascript" },
|
||||
embeddedLanguages = { css = true, javascript = true },
|
||||
provideFormatter = true,
|
||||
},
|
||||
settings = {
|
||||
html = {
|
||||
format = {
|
||||
wrapLineLength = 120,
|
||||
wrapAttributes = "auto",
|
||||
contentUnformatted = "pre,code,textarea",
|
||||
},
|
||||
hover = { documentation = true, references = true },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
lsp.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = { css = { validate = true }, scss = { validate = true }, less = { validate = true } },
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
lsp.rust_analyzer.setup({
|
||||
settings = {
|
||||
["rust-analyzer"] = {},
|
||||
},
|
||||
lsp.ts_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end,
|
||||
})
|
||||
|
||||
lsp.rust_analyzer.setup({ capabilities = capabilities })
|
||||
|
||||
local clangd_capabilities = vim.deepcopy(capabilities)
|
||||
clangd_capabilities["offsetEncoding"] = "utf-8"
|
||||
|
||||
lsp.clangd.setup({
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--function-arg-placeholders=0",
|
||||
"-j=12",
|
||||
"--clang-tidy",
|
||||
},
|
||||
cmd = { "clangd", "--background-index", "--function-arg-placeholders=0", "-j=12", "--clang-tidy" },
|
||||
capabilities = clangd_capabilities,
|
||||
init_options = {
|
||||
documentFormatting = true,
|
||||
},
|
||||
init_options = { documentFormatting = true },
|
||||
})
|
||||
|
||||
lsp.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.asm_lsp.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.zls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.jdtls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.tinymist.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.pyright.setup({ capabilities = capabilities })
|
||||
lsp.gopls.setup({ capabilities = capabilities })
|
||||
lsp.asm_lsp.setup({ capabilities = capabilities })
|
||||
lsp.zls.setup({ capabilities = capabilities })
|
||||
lsp.jdtls.setup({ capabilities = capabilities })
|
||||
lsp.tinymist.setup({ capabilities = capabilities })
|
||||
|
||||
lsp.lua_ls.setup({
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
||||
client.config.settings = vim.tbl_deep_extend("force", client.config.settings, {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
runtime = { version = "LuaJIT" },
|
||||
workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME } },
|
||||
},
|
||||
})
|
||||
|
||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||
end
|
||||
return true
|
||||
|
|
|
|||
101
config/nvim/lua/status_line/init.lua
Normal file
101
config/nvim/lua/status_line/init.lua
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
colors = {
|
||||
foreground = "#f8f8f2",
|
||||
wine = "#7f2f4d",
|
||||
red = "#d75a6c",
|
||||
green = "#8ab661",
|
||||
yellow = "#e0b763",
|
||||
orange = "#d87f3e",
|
||||
magenta = "#682776",
|
||||
cyan = "#36b5b5",
|
||||
bg_darken = "#1e1e1e",
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.cmd("hi StatusBackground guifg=" .. colors.foreground .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi Moden guifg=" .. colors.foreground .. " guibg=" .. colors.wine .. " gui=bold")
|
||||
vim.cmd("hi Modei guifg=" .. colors.foreground .. " guibg=" .. colors.green .. " gui=bold")
|
||||
vim.cmd("hi Modev guifg=" .. colors.foreground .. " guibg=" .. colors.yellow .. " gui=bold")
|
||||
vim.cmd("hi Modet guifg=" .. colors.foreground .. " guibg=" .. colors.orange .. " gui=bold")
|
||||
vim.cmd("hi Modec guifg=" .. colors.foreground .. " guibg=" .. colors.magenta .. " gui=bold")
|
||||
vim.cmd("hi Moder guifg=" .. colors.foreground .. " guibg=" .. colors.red .. " gui=bold")
|
||||
vim.cmd("hi Filetype guifg=" .. colors.cyan .. " guibg=" .. colors.bg_darken .. " gui=bold")
|
||||
vim.cmd("hi Position guifg=" .. colors.yellow .. " guibg=" .. colors.bg_darken .. " gui=bold")
|
||||
vim.cmd("hi GitBranch guifg=" .. colors.orange .. " guibg=" .. colors.bg_darken .. " gui=bold")
|
||||
vim.cmd("hi GitDiff guifg=" .. colors.green .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi GitDiffDel guifg=" .. colors.red .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi Separator guifg=" .. colors.foreground .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPError guifg=" .. colors.red .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPWarn guifg=" .. colors.yellow .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPInfo guifg=" .. colors.cyan .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPOk guifg=" .. colors.green .. " guibg=" .. colors.bg_darken)
|
||||
|
||||
vim.o.statusline = table.concat({
|
||||
"%{%v:lua.themeStatuslineMode()%} ",
|
||||
"%f ",
|
||||
"%{%v:lua.themeGitBranch()%} ",
|
||||
"%{%v:lua.themeGitDiff()%} ",
|
||||
"%{%v:lua.themeLSP()%} ",
|
||||
"%=",
|
||||
"%{%v:lua.themeStatuslineFiletype()%} ",
|
||||
"%{%v:lua.themeStatuslinePosition()%}",
|
||||
})
|
||||
end
|
||||
|
||||
function themeStatuslineMode()
|
||||
local mode = vim.fn.mode()
|
||||
local mode_highlight = "Mode" .. mode:sub(1, 1)
|
||||
return string.format("%%#%s# %s %%#StatusBackground#", mode_highlight, mode:upper())
|
||||
end
|
||||
|
||||
function themeStatuslineFiletype()
|
||||
return string.format("%%#Filetype# %s %%#Separator#│%%#StatusBackground#", vim.bo.filetype)
|
||||
end
|
||||
|
||||
function themeStatuslinePosition()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return string.format("%%#Position# %03d:%02d ", row, col)
|
||||
end
|
||||
|
||||
function themeGitBranch()
|
||||
local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD 2>/dev/null")[1] or ""
|
||||
if branch ~= "" then
|
||||
return string.format("%%#GitBranch# %s %%#Separator#│%%#StatusBackground#", branch)
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function themeGitDiff()
|
||||
local diff = vim.fn.systemlist("git diff --shortstat 2>/dev/null")[1] or ""
|
||||
local added, removed = diff:match("(%d+) insertions?"), diff:match("(%d+) deletions?")
|
||||
added = added or "0"
|
||||
removed = removed or "0"
|
||||
if diff ~= "" then
|
||||
return string.format("%%#GitDiff#+%s %%#GitDiffDel#-%s %%#StatusBackground#", added, removed)
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function themeLSP()
|
||||
local errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
|
||||
local warns = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
|
||||
local info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
|
||||
local hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
|
||||
local str = ""
|
||||
if errors > 0 then
|
||||
str = str .. string.format("%%#LSPError#E:%d ", errors)
|
||||
end
|
||||
if warns > 0 then
|
||||
str = str .. string.format("%%#LSPWarn#W:%d ", warns)
|
||||
end
|
||||
if info > 0 then
|
||||
str = str .. string.format("%%#LSPInfo#I:%d ", info)
|
||||
end
|
||||
if hints > 0 then
|
||||
str = str .. string.format("%%#LSPOk#H:%d ", hints)
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
return M
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -10,7 +10,6 @@
|
|||
"modules-center": [
|
||||
],
|
||||
"modules-right": [
|
||||
"network",
|
||||
"clock",
|
||||
// "battery",
|
||||
"pulseaudio"
|
||||
|
|
@ -69,17 +68,6 @@
|
|||
},
|
||||
"niri/workspaces": {
|
||||
"format": "●",
|
||||
"persistent-workspaces": {
|
||||
"1": 1,
|
||||
"2": 2,
|
||||
"3": 3,
|
||||
"4": 4,
|
||||
"5": 5,
|
||||
"6": 6,
|
||||
"7": 7,
|
||||
"8": 8,
|
||||
"9": 9
|
||||
},
|
||||
},
|
||||
"niri/window": {
|
||||
"icon": false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue