REFACTOR: Heavy refactor of layout and ui and plugin optimizations
This commit is contained in:
@@ -1,28 +1,5 @@
|
||||
--- Options
|
||||
require('DarthMooMancer.plugins')
|
||||
require('DarthMooMancer.opts')
|
||||
require('DarthMooMancer.colors')
|
||||
require('DarthMooMancer.plugins')
|
||||
require('DarthMooMancer.keymaps')
|
||||
require('DarthMooMancer.ui')
|
||||
require('DarthMooMancer.lsp')
|
||||
require('DarthMooMancer.tools')
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = {
|
||||
'c',
|
||||
'cpp',
|
||||
'rust',
|
||||
'lua',
|
||||
'typescript',
|
||||
'javascript',
|
||||
'css',
|
||||
'html',
|
||||
'python',
|
||||
'go',
|
||||
'yaml',
|
||||
},
|
||||
callback = function()
|
||||
vim.treesitter.start()
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
require('kanso').setup({
|
||||
transparent = true,
|
||||
-- foreground = {
|
||||
-- dark = "saturated", -- Use default colors in dark mode
|
||||
-- },
|
||||
overrides = function(colors)
|
||||
local theme = colors.theme
|
||||
return {
|
||||
Normal = { bg = "none" },
|
||||
NormalFloat = { bg = "none" },
|
||||
FloatBorder = { bg = "none" },
|
||||
FloatTitle = { bg = "none" },
|
||||
TelescopeBorder = { fg = theme.ui.special, bg = "none" },
|
||||
TelescopePromptBorder = { fg = theme.ui.special, bg = "none" },
|
||||
TelescopeResultsBorder = { fg = theme.ui.special, bg = "none" },
|
||||
TelescopePreviewBorder = { fg = theme.ui.special, bg = "none" },
|
||||
NotifyBackground = { bg = "none" },
|
||||
NotifyBorder = { fg = theme.ui.special, bg = "none" },
|
||||
NotifyBody = { fg = theme.ui.fg, bg = "none" },
|
||||
NotifyTitle = { fg = theme.ui.special, bg = "none" },
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme('kanso-zen')
|
||||
@@ -11,36 +11,36 @@ vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
||||
vim.keymap.set('n', 'n', 'nzzzv')
|
||||
vim.keymap.set('n', 'N', 'Nzzzv')
|
||||
vim.keymap.set('x', '<leader>p', [["_dP]])
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader><leader>',
|
||||
builtin.find_files,
|
||||
{ desc = 'Telescope find files' }
|
||||
function() Snacks.picker.files() end
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fh',
|
||||
builtin.help_tags,
|
||||
{ desc = 'Telescope help tags' }
|
||||
function() Snacks.picker.help() end
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fg',
|
||||
builtin.live_grep,
|
||||
{ desc = 'Telescope live grep' }
|
||||
function() Snacks.picker.grep() end
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fm',
|
||||
builtin.man_pages,
|
||||
{ desc = 'Telescope man_pages' }
|
||||
function() Snacks.picker.man() end
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>xn',
|
||||
':Telescope notify<CR>',
|
||||
{ desc = 'Telescope notify' }
|
||||
function() Snacks.picker.notifications() end
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>uu',
|
||||
function() Snacks.picker.undo() end
|
||||
)
|
||||
|
||||
vim.keymap.set('n', '<leader>fs', vim.lsp.buf.document_symbol)
|
||||
@@ -48,7 +48,6 @@ vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition)
|
||||
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references)
|
||||
vim.keymap.set('n', '<leader>gR', vim.lsp.buf.rename)
|
||||
vim.keymap.set('n', '<leader>gc', vim.lsp.buf.code_action)
|
||||
vim.keymap.set('n', '<leader>uu', ':UndotreeToggle<CR>')
|
||||
vim.keymap.set('n', '<leader>[', '<c-w>H', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>]', '<c-w>K', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '[q', ':cprev<CR>zz', { desc = 'Previous Quickfix Item' })
|
||||
@@ -61,8 +60,4 @@ vim.keymap.set('n', '<C-j>', ':NvimTmuxNavigateDown<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<C-k>', ':NvimTmuxNavigateUp<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<C-l>', ':NvimTmuxNavigateRight<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<leader>xx', ':Trouble diagnostics toggle<cr>')
|
||||
vim.keymap.set('n', '<leader>zz', ':ZenMode<cr>')
|
||||
local dropbar_api = require("dropbar.api")
|
||||
vim.keymap.set("n", "<Leader>;", dropbar_api.pick, { desc = "Pick symbols in winbar" })
|
||||
vim.keymap.set("n", "[;", dropbar_api.goto_context_start, { desc = "Go to start of current context" })
|
||||
vim.keymap.set("n", "];", dropbar_api.select_next_context, { desc = "Select next context" })
|
||||
vim.keymap.set('n', '<leader>zz', function() Snacks.zen() end)
|
||||
|
||||
@@ -1,53 +1,3 @@
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'vtsls',
|
||||
'lua_ls',
|
||||
'pylsp',
|
||||
'gopls',
|
||||
'html',
|
||||
'cssls',
|
||||
'bashls',
|
||||
},
|
||||
automatic_enable = false,
|
||||
})
|
||||
|
||||
require('nvim-treesitter').install({
|
||||
'rust',
|
||||
'c',
|
||||
'cpp',
|
||||
'lua',
|
||||
'javascript',
|
||||
'go',
|
||||
'typescript',
|
||||
'css',
|
||||
'html',
|
||||
'python',
|
||||
'yaml',
|
||||
})
|
||||
|
||||
require('conform').setup({
|
||||
formatters_by_ft = {
|
||||
rust = { 'rustfmt', lsp_format = 'fallback' },
|
||||
lua = { 'stylua', lsp_format = 'fallback' },
|
||||
javascript = { 'prettier', stop_after_first = true },
|
||||
typescript = { 'prettier', stop_after_first = true },
|
||||
json = { 'prettier' },
|
||||
html = { 'prettier' },
|
||||
go = { 'goimports' },
|
||||
c = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
css = { 'csskit' },
|
||||
dart = { 'dart_format', lsp_format = 'fallback' },
|
||||
python = { 'autopep8' },
|
||||
['_'] = { 'trim_whitespace' },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 2000,
|
||||
lsp_format = 'fallback',
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
vim.lsp.config('lua_ls', {
|
||||
capabilities = capabilities,
|
||||
|
||||
@@ -2,29 +2,29 @@ vim.opt.termguicolors = true
|
||||
vim.g.mapleader = ' '
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.tabstop = 8 -- Number of spaces a <Tab> counts for
|
||||
vim.opt.shiftwidth = 8 -- Number of spaces for autoindent (>>, <<, etc.)
|
||||
vim.opt.softtabstop = 8 -- Number of spaces for <Tab> in insert mode (backspace deletes 4 spaces)
|
||||
vim.opt.tabstop = 8 -- Number of spaces a <Tab> counts for
|
||||
vim.opt.shiftwidth = 8 -- Number of spaces for autoindent (>>, <<, etc.)
|
||||
vim.opt.softtabstop = 8 -- Number of spaces for <Tab> in insert mode (backspace deletes 4 spaces)
|
||||
vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
callback = function(ev)
|
||||
local map = {
|
||||
rust = { ts = 4, sw = 4, sts = 4 },
|
||||
lua = { ts = 4, sw = 4, sts = 4 },
|
||||
python = { ts = 4, sw = 4, sts = 4 },
|
||||
dart = { ts = 2, sw = 2, sts = 2 },
|
||||
html = { ts = 2, sw = 2, sts = 2 },
|
||||
javascript = { ts = 2, sw = 2, sts = 2 },
|
||||
typescript = { ts = 2, sw = 2, sts = 2 },
|
||||
}
|
||||
local ft = map[ev.match]
|
||||
if ft then
|
||||
vim.bo[ev.buf].tabstop = ft.ts
|
||||
vim.bo[ev.buf].shiftwidth = ft.sw
|
||||
vim.bo[ev.buf].softtabstop = ft.sts
|
||||
vim.bo[ev.buf].expandtab = ft.et ~= nil and ft.et or true
|
||||
end
|
||||
end,
|
||||
callback = function(ev)
|
||||
local map = {
|
||||
rust = { ts = 4, sw = 4, sts = 4 },
|
||||
lua = { ts = 4, sw = 4, sts = 4 },
|
||||
python = { ts = 4, sw = 4, sts = 4 },
|
||||
dart = { ts = 2, sw = 2, sts = 2 },
|
||||
html = { ts = 2, sw = 2, sts = 2 },
|
||||
javascript = { ts = 2, sw = 2, sts = 2 },
|
||||
typescript = { ts = 2, sw = 2, sts = 2 },
|
||||
}
|
||||
local ft = map[ev.match]
|
||||
if ft then
|
||||
vim.bo[ev.buf].tabstop = ft.ts
|
||||
vim.bo[ev.buf].shiftwidth = ft.sw
|
||||
vim.bo[ev.buf].softtabstop = ft.sts
|
||||
vim.bo[ev.buf].expandtab = ft.et ~= nil and ft.et or true
|
||||
end
|
||||
end,
|
||||
})
|
||||
vim.opt.autoindent = true -- Copy indent from current line when starting a new line
|
||||
vim.opt.wrap = false
|
||||
@@ -39,27 +39,40 @@ vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_liststyle = 3
|
||||
vim.g.netrw_winsize = 25
|
||||
vim.opt.wrapscan = true -- begin search from top of the file when nothng is found
|
||||
vim.opt.cursorline = true -- enable cursorline
|
||||
vim.opt.wrapscan = true -- begin search from top of the file when nothng is found
|
||||
vim.opt.cursorline = true -- enable cursorline
|
||||
vim.opt.cursorlineopt = { 'screenline', 'number' } -- cursorline look
|
||||
vim.opt.foldmethod = 'indent'
|
||||
vim.opt.foldcolumn = '1'
|
||||
vim.opt.foldenable = false
|
||||
vim.opt.shortmess = 'aF' -- abbreviates messages and prevents file name being echoed when opened
|
||||
vim.opt.ignorecase = false -- ignore cases when searching
|
||||
vim.opt.smartcase = true -- However if we use a capital in search string we then consider case-sensitivity, ignorecase is disabled
|
||||
vim.opt.shortmess = 'aF' -- abbreviates messages and prevents file name being echoed when opened
|
||||
vim.opt.ignorecase = false -- ignore cases when searching
|
||||
vim.opt.smartcase = true -- However if we use a capital in search string we then consider case-sensitivity, ignorecase is disabled
|
||||
vim.opt.smartindent = false -- smarter indentation
|
||||
vim.opt.smarttab = true -- make tab behaviour smarter
|
||||
vim.opt.smarttab = true -- make tab behaviour smarter
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.showmode = false
|
||||
vim.opt.cmdheight = 0
|
||||
vim.opt.smoothscroll = true
|
||||
vim.opt.spell = true
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true, -- This is the magic line
|
||||
signs = true, -- Shows icons in the gutter
|
||||
underline = true,
|
||||
update_in_insert = false, -- Don't clutter the screen while typing
|
||||
severity_sort = true,
|
||||
virtual_text = true, -- This is the magic line
|
||||
signs = true, -- Shows icons in the gutter
|
||||
underline = true,
|
||||
update_in_insert = false, -- Don't clutter the screen while typing
|
||||
severity_sort = true,
|
||||
})
|
||||
vim.o.winborder = 'rounded'
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'text', 'plaintex' },
|
||||
callback = function()
|
||||
-- Enable visual soft-wrapping
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
vim.opt_local.breakindent = true
|
||||
|
||||
-- Remap j/k to visual lines only inside this buffer
|
||||
vim.keymap.set('n', 'j', 'gj', { buffer = true })
|
||||
vim.keymap.set('n', 'k', 'gk', { buffer = true })
|
||||
end,
|
||||
})
|
||||
vim.o.winborder = "rounded"
|
||||
|
||||
@@ -1,43 +1,12 @@
|
||||
vim.pack.add({
|
||||
-- Themes
|
||||
{ src = 'https://github.com/webhooked/kanso.nvim' },
|
||||
|
||||
-- The rest
|
||||
{ src = 'https://github.com/mbbill/undotree' },
|
||||
{
|
||||
src = 'https://github.com/nvim-mini/mini.pairs',
|
||||
version = vim.version.range('*'),
|
||||
},
|
||||
{
|
||||
src = 'https://github.com/nvim-mini/mini.hipatterns',
|
||||
version = vim.version.range('*'),
|
||||
},
|
||||
{ src = 'https://github.com/nvim-tree/nvim-web-devicons' },
|
||||
{ src = 'https://github.com/nvim-telescope/telescope.nvim' },
|
||||
{
|
||||
src = 'https://github.com/saghen/blink.cmp',
|
||||
version = vim.version.range('*'),
|
||||
},
|
||||
{ src = 'https://git.moomancer.xyz/DarthMooMancer/polydev.git' },
|
||||
{
|
||||
src = 'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
},
|
||||
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
|
||||
{ src = 'https://github.com/mason-org/mason.nvim' },
|
||||
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
|
||||
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
||||
{ src = 'https://github.com/stevearc/conform.nvim' },
|
||||
{ src = 'https://github.com/b0o/incline.nvim' },
|
||||
{ src = 'https://github.com/windwp/nvim-ts-autotag' },
|
||||
{ src = 'https://github.com/MunifTanjim/nui.nvim' },
|
||||
{ src = 'https://github.com/nvim-lua/plenary.nvim' },
|
||||
{ src = 'https://github.com/folke/noice.nvim' },
|
||||
-- { src = 'https://github.com/stevearc/dressing.nvim' },
|
||||
{ src = 'https://github.com/rcarriga/nvim-notify' },
|
||||
{ src = 'https://github.com/folke/trouble.nvim' },
|
||||
{ src = 'https://github.com/brianhuster/live-preview.nvim' },
|
||||
{ src = 'https://github.com/m4xshen/hardtime.nvim' },
|
||||
{ src = 'https://github.com/Bekaboo/dropbar.nvim' },
|
||||
{ src = 'https://github.com/folke/zen-mode.nvim' },
|
||||
})
|
||||
require('DarthMooMancer.plugins.utils')
|
||||
require('DarthMooMancer.plugins.blink-cmp')
|
||||
require('DarthMooMancer.plugins.kanso')
|
||||
require('DarthMooMancer.plugins.mini-nvim')
|
||||
require('DarthMooMancer.plugins.polydev')
|
||||
require('DarthMooMancer.plugins.treesitter')
|
||||
require('DarthMooMancer.plugins.incline')
|
||||
require('DarthMooMancer.plugins.mason')
|
||||
require('DarthMooMancer.plugins.noice')
|
||||
require('DarthMooMancer.plugins.snacks')
|
||||
require('DarthMooMancer.plugins.trouble')
|
||||
require('DarthMooMancer.plugins.conform')
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
vim.pack.add({
|
||||
{
|
||||
src = 'https://github.com/saghen/blink.cmp',
|
||||
version = vim.version.range('*'),
|
||||
}
|
||||
})
|
||||
|
||||
require('blink.cmp').setup({
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 100,
|
||||
window = {
|
||||
winhighlight = 'Normal:NormalFloat,FloatBorder:SnacksPickerBorder,CursorLine:Visual,Search:None',
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
draw = {
|
||||
columns = {
|
||||
{ "label", "label_description", gap = 1 },
|
||||
{ "kind_icon", "kind", gap = 1 },
|
||||
{ "source_name", gap = 1 },
|
||||
},
|
||||
},
|
||||
scrollbar = false,
|
||||
winhighlight =
|
||||
'Pmenu:NormalFloat,FloatBorder:SnacksPickerBorder,PmenuSel:Visual,CursorLine:Visual,Search:None',
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
vim.pack.add({ 'https://github.com/stevearc/conform.nvim' })
|
||||
|
||||
require('conform').setup({
|
||||
formatters_by_ft = {
|
||||
rust = { 'rustfmt', lsp_format = 'fallback' },
|
||||
lua = { 'stylua', lsp_format = 'fallback' },
|
||||
javascript = { 'prettier', stop_after_first = true },
|
||||
typescript = { 'prettier', stop_after_first = true },
|
||||
json = { 'prettier' },
|
||||
html = { 'prettier' },
|
||||
go = { 'goimports' },
|
||||
c = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
css = { 'csskit' },
|
||||
dart = { 'dart_format', lsp_format = 'fallback' },
|
||||
python = { 'autopep8' },
|
||||
['_'] = { 'trim_whitespace' },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 2000,
|
||||
lsp_format = 'fallback',
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,50 @@
|
||||
vim.pack.add({
|
||||
{ src = 'https://github.com/b0o/incline.nvim' },
|
||||
{ src = 'https://github.com/SmiteshP/nvim-navic' },
|
||||
})
|
||||
|
||||
local helpers = require('incline.helpers')
|
||||
local navic = require('nvim-navic')
|
||||
local devicons = require('nvim-web-devicons')
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserNavicAttach', { clear = true }),
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if client and client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, args.buf)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require('incline').setup({
|
||||
window = {
|
||||
padding = 0,
|
||||
margin = { horizontal = 0, vertical = 0 },
|
||||
},
|
||||
render = function(props)
|
||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
|
||||
if filename == '' then
|
||||
filename = '[No Name]'
|
||||
end
|
||||
local ft_icon, ft_color = devicons.get_icon_color(filename)
|
||||
local modified = vim.bo[props.buf].modified
|
||||
local res = {
|
||||
ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or '',
|
||||
' ',
|
||||
{ filename, gui = modified and 'bold,italic' or 'bold' },
|
||||
guibg = "none",
|
||||
}
|
||||
if props.focused then
|
||||
for _, item in ipairs(navic.get_data(props.buf) or {}) do
|
||||
table.insert(res, {
|
||||
{ ' > ', group = 'NavicSeparator' },
|
||||
{ item.icon, group = 'NavicIcons' .. item.type },
|
||||
{ item.name, group = 'NavicText' },
|
||||
})
|
||||
end
|
||||
end
|
||||
table.insert(res, ' ')
|
||||
return res
|
||||
end,
|
||||
})
|
||||
@@ -0,0 +1,19 @@
|
||||
vim.pack.add({'https://github.com/webhooked/kanso.nvim' })
|
||||
|
||||
require('kanso').setup({
|
||||
transparent = true,
|
||||
overrides = function(colors)
|
||||
local theme = colors.theme
|
||||
return {
|
||||
Normal = { bg = "none" },
|
||||
NormalFloat = { bg = "none" },
|
||||
FloatBorder = { bg = "none" },
|
||||
FloatTitle = { bg = "none" },
|
||||
SnacksPickerBorder = { fg = theme.ui.special, bg = "none" },
|
||||
SnacksPickerTitle = { fg = theme.ui.special, bg = "none" },
|
||||
SnacksInputBorder = { fg = theme.ui.special, bg = "none" },
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme('kanso-zen')
|
||||
@@ -0,0 +1,19 @@
|
||||
vim.pack.add({
|
||||
{ src = 'https://github.com/mason-org/mason.nvim' },
|
||||
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
|
||||
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
||||
})
|
||||
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'vtsls',
|
||||
'lua_ls',
|
||||
'pylsp',
|
||||
'gopls',
|
||||
'html',
|
||||
'cssls',
|
||||
'bashls',
|
||||
},
|
||||
automatic_enable = false,
|
||||
})
|
||||
@@ -0,0 +1,34 @@
|
||||
vim.pack.add({
|
||||
{
|
||||
src = 'https://github.com/nvim-mini/mini.nvim.git',
|
||||
version = vim.version.range('*')
|
||||
}
|
||||
})
|
||||
|
||||
local hipatterns = require('mini.hipatterns')
|
||||
hipatterns.setup({
|
||||
highlighters = {
|
||||
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
|
||||
fixme = {
|
||||
pattern = '%f[%w]()FIXME()%f[%W]',
|
||||
group = 'MiniHipatternsFixme',
|
||||
},
|
||||
hack = {
|
||||
pattern = '%f[%w]()HACK()%f[%W]',
|
||||
group = 'MiniHipatternsHack',
|
||||
},
|
||||
todo = {
|
||||
pattern = '%f[%w]()TODO()%f[%W]',
|
||||
group = 'MiniHipatternsTodo',
|
||||
},
|
||||
note = {
|
||||
pattern = '%f[%w]()NOTE()%f[%W]',
|
||||
group = 'MiniHipatternsNote',
|
||||
},
|
||||
|
||||
hex_color = hipatterns.gen_highlighter.hex_color(),
|
||||
},
|
||||
})
|
||||
|
||||
require('mini.pairs').setup()
|
||||
-- require('mini.icons').setup()
|
||||
@@ -0,0 +1,20 @@
|
||||
vim.pack.add({
|
||||
{ src = 'https://github.com/folke/noice.nvim' },
|
||||
{ src = 'https://github.com/MunifTanjim/nui.nvim' },
|
||||
})
|
||||
|
||||
require('noice').setup({
|
||||
lsp = {
|
||||
override = {
|
||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||
['vim.lsp.util.stylize_markdown'] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
vim.pack.add({'https://git.moomancer.xyz/DarthMooMancer/polydev.git' })
|
||||
|
||||
require('Polydev').setup()
|
||||
@@ -0,0 +1,31 @@
|
||||
vim.pack.add({ 'https://github.com/folke/snacks.nvim' })
|
||||
|
||||
require('snacks').setup({
|
||||
notifier = {
|
||||
enabled = true,
|
||||
},
|
||||
animate = { enabled = true },
|
||||
input = { enabled = true },
|
||||
picker = {
|
||||
enabled = true,
|
||||
prompt = ' ',
|
||||
|
||||
icons = {
|
||||
ui = {
|
||||
selected = ' ',
|
||||
},
|
||||
},
|
||||
|
||||
layout = {
|
||||
preview = false,
|
||||
},
|
||||
},
|
||||
zen = {
|
||||
enabled = true,
|
||||
toggles = {
|
||||
dim = false,
|
||||
diagnostics = true,
|
||||
inlay_hints = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,49 @@
|
||||
vim.pack.add({
|
||||
{
|
||||
src = 'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
},
|
||||
{ src = 'https://github.com/windwp/nvim-ts-autotag' },
|
||||
})
|
||||
|
||||
require('nvim-treesitter').install({
|
||||
'rust',
|
||||
'c',
|
||||
'cpp',
|
||||
'lua',
|
||||
'javascript',
|
||||
'go',
|
||||
'typescript',
|
||||
'css',
|
||||
'html',
|
||||
'python',
|
||||
'yaml',
|
||||
})
|
||||
|
||||
require('nvim-ts-autotag').setup({
|
||||
opts = {
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false, -- Auto close on trailing </
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = {
|
||||
'c',
|
||||
'cpp',
|
||||
'rust',
|
||||
'lua',
|
||||
'typescript',
|
||||
'javascript',
|
||||
'css',
|
||||
'html',
|
||||
'python',
|
||||
'go',
|
||||
'yaml',
|
||||
},
|
||||
callback = function()
|
||||
vim.treesitter.start()
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
})
|
||||
@@ -0,0 +1,2 @@
|
||||
vim.pack.add({ 'https://github.com/folke/trouble.nvim' })
|
||||
require('trouble').setup({})
|
||||
@@ -0,0 +1,13 @@
|
||||
vim.pack.add({
|
||||
{ src = 'https://github.com/nvim-tree/nvim-web-devicons' },
|
||||
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
|
||||
|
||||
{ src = 'https://github.com/brianhuster/live-preview.nvim' },
|
||||
{ src = 'https://github.com/m4xshen/hardtime.nvim' },
|
||||
})
|
||||
|
||||
require('nvim-tmux-navigation').setup({
|
||||
disable_when_zoomed = true, -- defaults to false
|
||||
})
|
||||
|
||||
require("hardtime").setup()
|
||||
@@ -1,87 +0,0 @@
|
||||
local hipatterns = require('mini.hipatterns')
|
||||
hipatterns.setup({
|
||||
highlighters = {
|
||||
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
|
||||
fixme = {
|
||||
pattern = '%f[%w]()FIXME()%f[%W]',
|
||||
group = 'MiniHipatternsFixme',
|
||||
},
|
||||
hack = {
|
||||
pattern = '%f[%w]()HACK()%f[%W]',
|
||||
group = 'MiniHipatternsHack',
|
||||
},
|
||||
todo = {
|
||||
pattern = '%f[%w]()TODO()%f[%W]',
|
||||
group = 'MiniHipatternsTodo',
|
||||
},
|
||||
note = {
|
||||
pattern = '%f[%w]()NOTE()%f[%W]',
|
||||
group = 'MiniHipatternsNote',
|
||||
},
|
||||
|
||||
hex_color = hipatterns.gen_highlighter.hex_color(),
|
||||
},
|
||||
})
|
||||
|
||||
require('mini.pairs').setup()
|
||||
require('nvim-tmux-navigation').setup({
|
||||
disable_when_zoomed = true, -- defaults to false
|
||||
})
|
||||
|
||||
-- require("zen-mode").toggle({
|
||||
-- })
|
||||
|
||||
require('blink.cmp').setup({
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 100,
|
||||
window = {
|
||||
winhighlight = 'Normal:NormalFloat,FloatBorder:TelescopeBorder,CursorLine:Visual,Search:None',
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
draw = {
|
||||
columns = {
|
||||
{ "label", "label_description", gap = 1 },
|
||||
{ "kind_icon", "kind", gap = 1 },
|
||||
{ "source_name", gap = 1 },
|
||||
},
|
||||
},
|
||||
scrollbar = false,
|
||||
winhighlight =
|
||||
'Pmenu:NormalFloat,FloatBorder:TelescopeBorder,PmenuSel:TelescopeSelection,CursorLine:TelescopeSelection,Search:None',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require('Polydev').setup()
|
||||
require('nvim-ts-autotag').setup({
|
||||
opts = {
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false, -- Auto close on trailing </
|
||||
},
|
||||
})
|
||||
|
||||
require('trouble').setup({})
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
prompt_prefix = " ", -- Changes the search icon/prompt prefix
|
||||
selection_caret = " ", -- Changes the arrow/caret next to the selected item
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = 'top',
|
||||
prompt_min_width = 40,
|
||||
prompt_max_width = 80,
|
||||
preview_width = 80,
|
||||
},
|
||||
},
|
||||
sorting_strategy = "ascending",
|
||||
preview = {
|
||||
hide_on_startup = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("hardtime").setup()
|
||||
@@ -1,328 +1,296 @@
|
||||
--- Derive a highlight from an existing scheme group.
|
||||
local function derive_hl(name, opts)
|
||||
local base = opts.base and vim.api.nvim_get_hl(0, { name = opts.base })
|
||||
or {}
|
||||
local fg = opts.fg and vim.api.nvim_get_hl(0, { name = opts.fg }) or {}
|
||||
local bg = opts.bg and vim.api.nvim_get_hl(0, { name = opts.bg }) or {}
|
||||
vim.api.nvim_set_hl(0, name, {
|
||||
fg = fg.fg or base.fg,
|
||||
bg = bg.bg or base.bg,
|
||||
bold = opts.bold,
|
||||
})
|
||||
local base = opts.base and vim.api.nvim_get_hl(0, { name = opts.base })
|
||||
or {}
|
||||
local fg = opts.fg and vim.api.nvim_get_hl(0, { name = opts.fg }) or {}
|
||||
local bg = opts.bg and vim.api.nvim_get_hl(0, { name = opts.bg }) or {}
|
||||
vim.api.nvim_set_hl(0, name, {
|
||||
fg = fg.fg or base.fg,
|
||||
bg = bg.bg or base.bg,
|
||||
bold = opts.bold,
|
||||
})
|
||||
end
|
||||
--- Derive a mode highlight where bg comes from a syntax group and fg contrasts.
|
||||
local function derive_mode_hl(name, color_group)
|
||||
local color = vim.api.nvim_get_hl(0, { name = color_group })
|
||||
local status_bg = vim.api.nvim_get_hl(0, { name = 'StatusLine' })
|
||||
vim.api.nvim_set_hl(0, name, {
|
||||
bg = color.fg,
|
||||
fg = status_bg.bg or '#191724',
|
||||
bold = true,
|
||||
})
|
||||
local color = vim.api.nvim_get_hl(0, { name = color_group })
|
||||
local status_bg = vim.api.nvim_get_hl(0, { name = 'StatusLine' })
|
||||
vim.api.nvim_set_hl(0, name, {
|
||||
bg = color.fg,
|
||||
fg = status_bg.bg or '#191724',
|
||||
bold = true,
|
||||
})
|
||||
end
|
||||
|
||||
--- (Re)build all statusline highlight groups from current scheme.
|
||||
local function setup_statusline_highlights()
|
||||
derive_mode_hl('StatusModeNormal', 'Type')
|
||||
derive_mode_hl('StatusModeInsert', 'String')
|
||||
derive_mode_hl('StatusModeVisual', 'Statement')
|
||||
derive_mode_hl('StatusModeCommand', 'PreProc')
|
||||
derive_mode_hl('StatusModeReplace', 'WarningMsg')
|
||||
derive_mode_hl('StatusModeTerminal', 'Special')
|
||||
derive_hl('StatusGit', { base = 'CursorLine', fg = 'LineNr' })
|
||||
derive_hl('StatusLsp', { base = 'StatusLine', fg = 'DiagnosticInfo' })
|
||||
derive_hl('StatusLspSpinner', { base = 'StatusLine', fg = 'Constant' })
|
||||
derive_hl(
|
||||
'StatusDiagError',
|
||||
{ base = 'StatusLine', fg = 'DiagnosticError' }
|
||||
)
|
||||
derive_hl('StatusDiagWarn', { base = 'StatusLine', fg = 'DiagnosticWarn' })
|
||||
derive_hl('StatusDiagHint', { base = 'StatusLine', fg = 'DiagnosticHint' })
|
||||
derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' })
|
||||
-- derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'OkMsg' })
|
||||
derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'MoreMsg' })
|
||||
derive_hl(
|
||||
'StatusGitRemoved',
|
||||
{ base = 'StatusLine', fg = 'DiagnosticError' }
|
||||
)
|
||||
derive_hl('StatusRecording', { base = 'StatusLine', fg = 'WarningMsg' })
|
||||
derive_mode_hl('StatusModeNormal', 'Type')
|
||||
derive_mode_hl('StatusModeInsert', 'String')
|
||||
derive_mode_hl('StatusModeVisual', 'Statement')
|
||||
derive_mode_hl('StatusModeCommand', 'PreProc')
|
||||
derive_mode_hl('StatusModeReplace', 'WarningMsg')
|
||||
derive_mode_hl('StatusModeTerminal', 'Special')
|
||||
derive_hl('StatusGit', { base = 'CursorLine', fg = 'LineNr' })
|
||||
derive_hl('StatusLsp', { base = 'StatusLine', fg = 'DiagnosticInfo' })
|
||||
derive_hl('StatusLspSpinner', { base = 'StatusLine', fg = 'Constant' })
|
||||
derive_hl(
|
||||
'StatusDiagError',
|
||||
{ base = 'StatusLine', fg = 'DiagnosticError' }
|
||||
)
|
||||
derive_hl('StatusDiagWarn', { base = 'StatusLine', fg = 'DiagnosticWarn' })
|
||||
derive_hl('StatusDiagHint', { base = 'StatusLine', fg = 'DiagnosticHint' })
|
||||
derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' })
|
||||
-- derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'OkMsg' })
|
||||
derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'MoreMsg' })
|
||||
derive_hl(
|
||||
'StatusGitRemoved',
|
||||
{ base = 'StatusLine', fg = 'DiagnosticError' }
|
||||
)
|
||||
derive_hl('StatusRecording', { base = 'StatusLine', fg = 'WarningMsg' })
|
||||
end
|
||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||
callback = setup_statusline_highlights,
|
||||
callback = setup_statusline_highlights,
|
||||
})
|
||||
setup_statusline_highlights()
|
||||
|
||||
--- Mode text mapping.
|
||||
local mode_map = {
|
||||
['n'] = ' NORM ',
|
||||
['i'] = ' INS ',
|
||||
['v'] = ' VIS ',
|
||||
['V'] = ' V-LINE ',
|
||||
[''] = ' V-BLK ',
|
||||
['R'] = ' REPL ',
|
||||
['c'] = ' CMD ',
|
||||
['t'] = ' TERM ',
|
||||
['n'] = ' NORM ',
|
||||
['i'] = ' INS ',
|
||||
['v'] = ' VIS ',
|
||||
['V'] = ' V-LINE ',
|
||||
[''] = ' V-BLK ',
|
||||
['R'] = ' REPL ',
|
||||
['c'] = ' CMD ',
|
||||
['t'] = ' TERM ',
|
||||
}
|
||||
local mode_hl_map = {
|
||||
['n'] = 'StatusModeNormal',
|
||||
['i'] = 'StatusModeInsert',
|
||||
['v'] = 'StatusModeVisual',
|
||||
['V'] = 'StatusModeVisual',
|
||||
[''] = 'StatusModeVisual',
|
||||
['R'] = 'StatusModeReplace',
|
||||
['c'] = 'StatusModeCommand',
|
||||
['t'] = 'StatusModeTerminal',
|
||||
['n'] = 'StatusModeNormal',
|
||||
['i'] = 'StatusModeInsert',
|
||||
['v'] = 'StatusModeVisual',
|
||||
['V'] = 'StatusModeVisual',
|
||||
[''] = 'StatusModeVisual',
|
||||
['R'] = 'StatusModeReplace',
|
||||
['c'] = 'StatusModeCommand',
|
||||
['t'] = 'StatusModeTerminal',
|
||||
}
|
||||
|
||||
--- Git branch (async, cached per buffer, refreshed every 5s)
|
||||
local function update_git_branch()
|
||||
if vim.bo.buftype ~= '' then
|
||||
return
|
||||
end
|
||||
vim.system(
|
||||
{ 'git', 'branch', '--show-current' },
|
||||
{ text = true },
|
||||
function(out)
|
||||
vim.b.git_branch = (out.code == 0 and out.stdout or ''):gsub(
|
||||
'%s+',
|
||||
''
|
||||
)
|
||||
end
|
||||
)
|
||||
if vim.bo.buftype ~= '' then
|
||||
return
|
||||
end
|
||||
vim.system(
|
||||
{ 'git', 'branch', '--show-current' },
|
||||
{ text = true },
|
||||
function(out)
|
||||
vim.b.git_branch = (out.code == 0 and out.stdout or ''):gsub(
|
||||
'%s+',
|
||||
''
|
||||
)
|
||||
end
|
||||
)
|
||||
end
|
||||
vim.uv.new_timer():start(5000, 5000, vim.schedule_wrap(update_git_branch))
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained' }, {
|
||||
callback = function()
|
||||
update_git_branch()
|
||||
end,
|
||||
callback = function()
|
||||
update_git_branch()
|
||||
end,
|
||||
})
|
||||
|
||||
--- LSP progress (Neovim 0.10+ built-in handler)
|
||||
local progress = {}
|
||||
local spinner_frames =
|
||||
{ '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷' }
|
||||
{ '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷' }
|
||||
|
||||
local frame = 0
|
||||
--- Clean stale progress messages periodically
|
||||
local progress_timer = vim.uv.new_timer()
|
||||
local function start_progress_timer()
|
||||
if not progress_timer:is_active() then
|
||||
progress_timer:start(0, 200, function()
|
||||
local now = vim.loop.now()
|
||||
for k, v in pairs(progress) do
|
||||
local ttl = v.done and 2000 or 10000
|
||||
if now - v.t > ttl then
|
||||
progress[k] = nil
|
||||
end
|
||||
end
|
||||
if next(progress) then
|
||||
frame = (frame % #spinner_frames) + 1
|
||||
vim.schedule(function()
|
||||
vim.cmd('redrawstatus')
|
||||
end)
|
||||
else
|
||||
progress_timer:stop()
|
||||
vim.schedule(function()
|
||||
vim.cmd('redrawstatus')
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if not progress_timer:is_active() then
|
||||
progress_timer:start(0, 200, function()
|
||||
local now = vim.loop.now()
|
||||
for k, v in pairs(progress) do
|
||||
local ttl = v.done and 2000 or 10000
|
||||
if now - v.t > ttl then
|
||||
progress[k] = nil
|
||||
end
|
||||
end
|
||||
if next(progress) then
|
||||
frame = (frame % #spinner_frames) + 1
|
||||
vim.schedule(function()
|
||||
vim.cmd('redrawstatus')
|
||||
end)
|
||||
else
|
||||
progress_timer:stop()
|
||||
vim.schedule(function()
|
||||
vim.cmd('redrawstatus')
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspProgress', {
|
||||
callback = function(ev)
|
||||
local d = ev.data
|
||||
if not d then
|
||||
return
|
||||
end
|
||||
local params = d.params
|
||||
if not params or not params.token then
|
||||
return
|
||||
end
|
||||
local key = d.client_id .. ':' .. tostring(params.token)
|
||||
local value = params.value or {}
|
||||
if value.kind == 'begin' then
|
||||
progress[key] = {
|
||||
msg = (value.message or 'working...'):gsub('%%', '%%%%'),
|
||||
t = vim.loop.now(),
|
||||
}
|
||||
start_progress_timer()
|
||||
elseif value.kind == 'report' then
|
||||
local msg_parts = {}
|
||||
if value.message then
|
||||
msg_parts[#msg_parts + 1] = value.message
|
||||
end
|
||||
if value.percentage ~= nil then
|
||||
msg_parts[#msg_parts + 1] = '(' .. value.percentage .. '%%)'
|
||||
end
|
||||
progress[key] = {
|
||||
msg = table.concat(msg_parts, ' '),
|
||||
t = vim.loop.now(),
|
||||
}
|
||||
elseif value.kind == 'end' then
|
||||
if progress[key] then
|
||||
progress[key].done = true
|
||||
end
|
||||
vim.cmd('redrawstatus')
|
||||
end
|
||||
end,
|
||||
callback = function(ev)
|
||||
local d = ev.data
|
||||
if not d then
|
||||
return
|
||||
end
|
||||
local params = d.params
|
||||
if not params or not params.token then
|
||||
return
|
||||
end
|
||||
local key = d.client_id .. ':' .. tostring(params.token)
|
||||
local value = params.value or {}
|
||||
if value.kind == 'begin' then
|
||||
progress[key] = {
|
||||
msg = (value.message or 'working...'):gsub('%%', '%%%%'),
|
||||
t = vim.loop.now(),
|
||||
}
|
||||
start_progress_timer()
|
||||
elseif value.kind == 'report' then
|
||||
local msg_parts = {}
|
||||
if value.message then
|
||||
msg_parts[#msg_parts + 1] = value.message
|
||||
end
|
||||
if value.percentage ~= nil then
|
||||
msg_parts[#msg_parts + 1] = '(' .. value.percentage .. '%%)'
|
||||
end
|
||||
progress[key] = {
|
||||
msg = table.concat(msg_parts, ' '),
|
||||
t = vim.loop.now(),
|
||||
}
|
||||
elseif value.kind == 'end' then
|
||||
if progress[key] then
|
||||
progress[key].done = true
|
||||
end
|
||||
vim.cmd('redrawstatus')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, {
|
||||
callback = function(args)
|
||||
local names = {}
|
||||
for _, c in ipairs(vim.lsp.get_clients({ bufnr = args.buf })) do
|
||||
table.insert(names, c.name)
|
||||
end
|
||||
vim.b[args.buf].lsp_names = #names > 0
|
||||
and (' ● ' .. table.concat(names, ', ') .. ' ')
|
||||
or ''
|
||||
end,
|
||||
callback = function(args)
|
||||
local names = {}
|
||||
for _, c in ipairs(vim.lsp.get_clients({ bufnr = args.buf })) do
|
||||
table.insert(names, c.name)
|
||||
end
|
||||
vim.b[args.buf].lsp_names = #names > 0
|
||||
and (' ● ' .. table.concat(names, ', ') .. ' ')
|
||||
or ''
|
||||
end,
|
||||
})
|
||||
|
||||
local function lsp_section()
|
||||
local client_ids = {}
|
||||
for _, c in
|
||||
ipairs(vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() }))
|
||||
do
|
||||
client_ids[c.id] = true
|
||||
end
|
||||
local latest = nil
|
||||
for key, p in pairs(progress) do
|
||||
local cid = tonumber(key:match('^(%d+):'))
|
||||
if cid and client_ids[cid] then
|
||||
if not latest or p.t > latest.t then
|
||||
latest = p
|
||||
end
|
||||
end
|
||||
end
|
||||
if latest and (not latest.done or (vim.loop.now() - latest.t < 2000)) then
|
||||
return '%#StatusLspSpinner# ○ ' .. latest.msg .. ' %*'
|
||||
end
|
||||
return '%#StatusLsp#' .. (vim.b.lsp_names or '') .. '%*'
|
||||
local client_ids = {}
|
||||
for _, c in
|
||||
ipairs(vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() }))
|
||||
do
|
||||
client_ids[c.id] = true
|
||||
end
|
||||
local latest = nil
|
||||
for key, p in pairs(progress) do
|
||||
local cid = tonumber(key:match('^(%d+):'))
|
||||
if cid and client_ids[cid] then
|
||||
if not latest or p.t > latest.t then
|
||||
latest = p
|
||||
end
|
||||
end
|
||||
end
|
||||
if latest and (not latest.done or (vim.loop.now() - latest.t < 2000)) then
|
||||
return '%#StatusLspSpinner# ○ ' .. latest.msg .. ' %*'
|
||||
end
|
||||
return '%#StatusLsp#' .. (vim.b.lsp_names or '') .. '%*'
|
||||
end
|
||||
|
||||
local diag_cache = {}
|
||||
local function build_diag_string(counts)
|
||||
local parts = {}
|
||||
if counts[1] and counts[1] > 0 then
|
||||
table.insert(parts, '%#StatusDiagError# E' .. counts[1] .. ' %*')
|
||||
end
|
||||
if counts[2] and counts[2] > 0 then
|
||||
table.insert(parts, '%#StatusDiagWarn# W' .. counts[2] .. ' %*')
|
||||
end
|
||||
if counts[4] and counts[4] > 0 then
|
||||
table.insert(parts, '%#StatusDiagHint# H' .. counts[4] .. ' %*')
|
||||
end
|
||||
return table.concat(parts)
|
||||
local parts = {}
|
||||
if counts[1] and counts[1] > 0 then
|
||||
table.insert(parts, '%#StatusDiagError# E' .. counts[1] .. ' %*')
|
||||
end
|
||||
if counts[2] and counts[2] > 0 then
|
||||
table.insert(parts, '%#StatusDiagWarn# W' .. counts[2] .. ' %*')
|
||||
end
|
||||
if counts[4] and counts[4] > 0 then
|
||||
table.insert(parts, '%#StatusDiagHint# H' .. counts[4] .. ' %*')
|
||||
end
|
||||
return table.concat(parts)
|
||||
end
|
||||
|
||||
local function update_diag_cache(ev)
|
||||
diag_cache[ev.buf] = build_diag_string(vim.diagnostic.count(ev.buf))
|
||||
diag_cache[ev.buf] = build_diag_string(vim.diagnostic.count(ev.buf))
|
||||
end
|
||||
vim.api.nvim_create_autocmd(
|
||||
'DiagnosticChanged',
|
||||
{ callback = update_diag_cache }
|
||||
'DiagnosticChanged',
|
||||
{ callback = update_diag_cache }
|
||||
)
|
||||
|
||||
local function update_git_diff()
|
||||
if vim.bo.buftype ~= '' then
|
||||
return
|
||||
end
|
||||
local file = vim.fn.expand('%:p')
|
||||
if file == '' then
|
||||
return
|
||||
end
|
||||
vim.system(
|
||||
{ 'git', 'diff', '--numstat', 'HEAD', '--', file },
|
||||
{ text = true },
|
||||
function(out)
|
||||
if out.code ~= 0 or out.stdout == '' then
|
||||
vim.b.git_diff = nil
|
||||
return
|
||||
end
|
||||
local added, removed = out.stdout:match('(%d+)%s+(%d+)')
|
||||
vim.b.git_diff = {
|
||||
added = tonumber(added) or 0,
|
||||
removed = tonumber(removed) or 0,
|
||||
}
|
||||
end
|
||||
)
|
||||
if vim.bo.buftype ~= '' then
|
||||
return
|
||||
end
|
||||
local file = vim.fn.expand('%:p')
|
||||
if file == '' then
|
||||
return
|
||||
end
|
||||
vim.system(
|
||||
{ 'git', 'diff', '--numstat', 'HEAD', '--', file },
|
||||
{ text = true },
|
||||
function(out)
|
||||
if out.code ~= 0 or out.stdout == '' then
|
||||
vim.b.git_diff = nil
|
||||
return
|
||||
end
|
||||
local added, removed = out.stdout:match('(%d+)%s+(%d+)')
|
||||
vim.b.git_diff = {
|
||||
added = tonumber(added) or 0,
|
||||
removed = tonumber(removed) or 0,
|
||||
}
|
||||
end
|
||||
)
|
||||
end
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'BufWritePost' }, {
|
||||
callback = update_git_diff,
|
||||
callback = update_git_diff,
|
||||
})
|
||||
|
||||
function _G.__statusline()
|
||||
local m = vim.fn.mode()
|
||||
local mode_hl = mode_hl_map[m] or 'StatusModeNormal'
|
||||
local git = vim.b.git_branch or ''
|
||||
local cur_buf = vim.api.nvim_get_current_buf()
|
||||
local parts = {
|
||||
'%#' .. mode_hl .. '#' .. (mode_map[m] or ' ?? ') .. '%*',
|
||||
git ~= '' and ('%#StatusGit# ' .. git .. ' %*') or '',
|
||||
}
|
||||
local diff = vim.b.git_diff
|
||||
if diff and (diff.added > 0 or diff.removed > 0) then
|
||||
if diff.added > 0 then
|
||||
table.insert(parts, '%#StatusGitAdded# +' .. diff.added .. ' %*')
|
||||
end
|
||||
if diff.removed > 0 then
|
||||
table.insert(
|
||||
parts,
|
||||
'%#StatusGitRemoved# -' .. diff.removed .. ' %*'
|
||||
)
|
||||
end
|
||||
end
|
||||
table.insert(parts, lsp_section())
|
||||
table.insert(parts, '%=')
|
||||
local recording = vim.fn.reg_recording()
|
||||
if recording ~= '' then
|
||||
table.insert(
|
||||
parts,
|
||||
'%#StatusRecording# ● Rec @' .. recording .. ' %*'
|
||||
)
|
||||
end
|
||||
table.insert(
|
||||
parts,
|
||||
diag_cache[cur_buf] or build_diag_string(vim.diagnostic.count(cur_buf))
|
||||
)
|
||||
table.insert(parts, '%#StatusCursor# %l:%-2c %*')
|
||||
table.insert(parts, '%#' .. mode_hl .. '# %p%% %*')
|
||||
return table.concat(parts)
|
||||
local m = vim.fn.mode()
|
||||
local mode_hl = mode_hl_map[m] or 'StatusModeNormal'
|
||||
local git = vim.b.git_branch or ''
|
||||
local cur_buf = vim.api.nvim_get_current_buf()
|
||||
local parts = {
|
||||
'%#' .. mode_hl .. '#' .. (mode_map[m] or ' ?? ') .. '%*',
|
||||
git ~= '' and ('%#StatusGit# ' .. git .. ' %*') or '',
|
||||
}
|
||||
local diff = vim.b.git_diff
|
||||
if diff and (diff.added > 0 or diff.removed > 0) then
|
||||
if diff.added > 0 then
|
||||
table.insert(parts, '%#StatusGitAdded# +' .. diff.added .. ' %*')
|
||||
end
|
||||
if diff.removed > 0 then
|
||||
table.insert(
|
||||
parts,
|
||||
'%#StatusGitRemoved# -' .. diff.removed .. ' %*'
|
||||
)
|
||||
end
|
||||
end
|
||||
table.insert(parts, lsp_section())
|
||||
table.insert(parts, '%=')
|
||||
local recording = vim.fn.reg_recording()
|
||||
if recording ~= '' then
|
||||
table.insert(
|
||||
parts,
|
||||
'%#StatusRecording# ● Rec @' .. recording .. ' %*'
|
||||
)
|
||||
end
|
||||
table.insert(
|
||||
parts,
|
||||
diag_cache[cur_buf] or build_diag_string(vim.diagnostic.count(cur_buf))
|
||||
)
|
||||
table.insert(parts, '%#StatusCursor# %l:%-2c %*')
|
||||
table.insert(parts, '%#' .. mode_hl .. '# %p%% %*')
|
||||
return table.concat(parts)
|
||||
end
|
||||
|
||||
vim.o.statusline = '%!v:lua.__statusline()'
|
||||
|
||||
require('incline').setup({
|
||||
window = { margin = { vertical = 0, horizontal = 1 } },
|
||||
hide = { cursorline = true },
|
||||
render = function(props)
|
||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
||||
if vim.bo[props.buf].modified then
|
||||
filename = "[+] " .. filename
|
||||
end
|
||||
|
||||
local icon, color = require("nvim-web-devicons").get_icon_color(filename)
|
||||
return { { icon, guifg = color }, { " " }, { filename } }
|
||||
end,
|
||||
})
|
||||
require('noice').setup({
|
||||
lsp = {
|
||||
override = {
|
||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||
['vim.lsp.util.stylize_markdown'] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
})
|
||||
require('notify').setup({
|
||||
background_colour = '#000000',
|
||||
})
|
||||
|
||||
@@ -9,12 +9,8 @@
|
||||
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
||||
"src": "https://github.com/stevearc/conform.nvim"
|
||||
},
|
||||
"dropbar.nvim": {
|
||||
"rev": "808ba31cde89aec8833e9789f5e04557cd31c9e1",
|
||||
"src": "https://github.com/Bekaboo/dropbar.nvim"
|
||||
},
|
||||
"hardtime.nvim": {
|
||||
"rev": "5165840fe680eab46de1fc6dbff48f148fdcf018",
|
||||
"rev": "721a75b9a0c2eb1fb811d34507708ee315cb04eb",
|
||||
"src": "https://github.com/m4xshen/hardtime.nvim"
|
||||
},
|
||||
"incline.nvim": {
|
||||
@@ -30,21 +26,16 @@
|
||||
"src": "https://github.com/brianhuster/live-preview.nvim"
|
||||
},
|
||||
"mason-lspconfig.nvim": {
|
||||
"rev": "b5576cd62899a1a478d0e67ef3d378ee55dba82d",
|
||||
"rev": "b3298993d55fa194279b5eb9dbfb3a43da65cadf",
|
||||
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||
},
|
||||
"mason.nvim": {
|
||||
"rev": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d",
|
||||
"src": "https://github.com/mason-org/mason.nvim"
|
||||
},
|
||||
"mini.hipatterns": {
|
||||
"rev": "607d604e650cdf21d71f863d040c496a1d0cb320",
|
||||
"src": "https://github.com/nvim-mini/mini.hipatterns",
|
||||
"version": ">=0.0.0"
|
||||
},
|
||||
"mini.pairs": {
|
||||
"rev": "4a014143fcb4e9df26198ccb3ecff3b9e77a048c",
|
||||
"src": "https://github.com/nvim-mini/mini.pairs",
|
||||
"mini.nvim": {
|
||||
"rev": "1345d191bb3da9c7b0e977f4387c5761f9bff68d",
|
||||
"src": "https://github.com/nvim-mini/mini.nvim.git",
|
||||
"version": ">=0.0.0"
|
||||
},
|
||||
"noice.nvim": {
|
||||
@@ -56,52 +47,40 @@
|
||||
"src": "https://github.com/MunifTanjim/nui.nvim"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"rev": "84b6b6c3f13cb34a6c8a0354b0da4c67d8ccf867",
|
||||
"rev": "3e8d598d3b5f8338a41699c436e5fa11d2666cf0",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"nvim-notify": {
|
||||
"rev": "8701bece920b38ea289b457f902e2ad184131a5d",
|
||||
"src": "https://github.com/rcarriga/nvim-notify"
|
||||
"nvim-navic": {
|
||||
"rev": "455808fd0fae06e6d70fadfd61432275db8f34ce",
|
||||
"src": "https://github.com/SmiteshP/nvim-navic"
|
||||
},
|
||||
"nvim-tmux-navigation": {
|
||||
"rev": "4898c98702954439233fdaf764c39636681e2861",
|
||||
"src": "https://github.com/alexghergh/nvim-tmux-navigation"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "5cb0114e6242625db56dd6440e945ed1ece10bc7",
|
||||
"rev": "910fdf6f49e9dee7e7257c7d11a76b040fdfb9de",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"nvim-ts-autotag": {
|
||||
"rev": "88c1453db4ba7dd24131086fe51fdf74e587d275",
|
||||
"rev": "d7220b55e16ed3c04e88086256def5d282429493",
|
||||
"src": "https://github.com/windwp/nvim-ts-autotag"
|
||||
},
|
||||
"nvim-web-devicons": {
|
||||
"rev": "5f032a85be210cd1c6ac98861eb3b187ff3bd5eb",
|
||||
"rev": "58447c1fca354bbf184425e4a8d01deecbd6f3c4",
|
||||
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
"plenary.nvim": {
|
||||
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
|
||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
"polydev": {
|
||||
"rev": "2b30e36fade3272081f7166bc0ec614b0b7da1c9",
|
||||
"src": "https://git.moomancer.xyz/DarthMooMancer/polydev.git"
|
||||
},
|
||||
"telescope.nvim": {
|
||||
"rev": "40aedd8a68c78a656a10a8d62d80c54af59420fb",
|
||||
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||
"snacks.nvim": {
|
||||
"rev": "882c996cf28183f4d63640de0b4c02ec886d01f2",
|
||||
"src": "https://github.com/folke/snacks.nvim"
|
||||
},
|
||||
"trouble.nvim": {
|
||||
"rev": "bd67efe408d4816e25e8491cc5ad4088e708a69a",
|
||||
"src": "https://github.com/folke/trouble.nvim"
|
||||
},
|
||||
"undotree": {
|
||||
"rev": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d",
|
||||
"src": "https://github.com/mbbill/undotree"
|
||||
},
|
||||
"zen-mode.nvim": {
|
||||
"rev": "8564ce6d29ec7554eb9df578efa882d33b3c23a7",
|
||||
"src": "https://github.com/folke/zen-mode.nvim"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user