Nvim: improve blink and inlay hints, add heirline
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
return {
|
return { {
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
-- optional: provides snippets for the snippet source
|
-- optional: provides snippets for the snippet source
|
||||||
dependencies = 'rafamadriz/friendly-snippets',
|
dependencies = {
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
'xzbdmw/colorful-menu.nvim'
|
||||||
|
},
|
||||||
|
|
||||||
-- use a release tag to download pre-built binaries
|
-- use a release tag to download pre-built binaries
|
||||||
version = '*',
|
version = '*',
|
||||||
@@ -34,6 +37,100 @@ return {
|
|||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
completion = {
|
||||||
|
menu = {
|
||||||
|
draw = {
|
||||||
|
columns = { { "kind_icon" }, { "label", gap = 1 } },
|
||||||
|
components = {
|
||||||
|
label = {
|
||||||
|
text = function(ctx)
|
||||||
|
return require("colorful-menu").blink_components_text(ctx)
|
||||||
|
end,
|
||||||
|
highlight = function(ctx)
|
||||||
|
return require("colorful-menu").blink_components_highlight(ctx)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
opts_extend = { "sources.default" }
|
opts_extend = { "sources.default" }
|
||||||
}
|
}, {
|
||||||
|
"xzbdmw/colorful-menu.nvim",
|
||||||
|
config = function()
|
||||||
|
-- You don't need to set these options.
|
||||||
|
require("colorful-menu").setup({
|
||||||
|
ls = {
|
||||||
|
lua_ls = {
|
||||||
|
-- Maybe you want to dim arguments a bit.
|
||||||
|
arguments_hl = "@comment",
|
||||||
|
},
|
||||||
|
gopls = {
|
||||||
|
-- By default, we render variable/function's type in the right most side,
|
||||||
|
-- to make them not to crowd together with the original label.
|
||||||
|
|
||||||
|
-- when true:
|
||||||
|
-- foo *Foo
|
||||||
|
-- ast "go/ast"
|
||||||
|
|
||||||
|
-- when false:
|
||||||
|
-- foo *Foo
|
||||||
|
-- ast "go/ast"
|
||||||
|
align_type_to_right = true,
|
||||||
|
-- When true, label for field and variable will format like "foo: Foo"
|
||||||
|
-- instead of go's original syntax "foo Foo". If align_type_to_right is
|
||||||
|
-- true, this option has no effect.
|
||||||
|
add_colon_before_type = false,
|
||||||
|
},
|
||||||
|
-- for lsp_config or typescript-tools
|
||||||
|
ts_ls = {
|
||||||
|
extra_info_hl = "@comment",
|
||||||
|
},
|
||||||
|
vtsls = {
|
||||||
|
extra_info_hl = "@comment",
|
||||||
|
},
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
-- Such as (as Iterator), (use std::io).
|
||||||
|
extra_info_hl = "@comment",
|
||||||
|
-- Similar to the same setting of gopls.
|
||||||
|
align_type_to_right = true,
|
||||||
|
},
|
||||||
|
clangd = {
|
||||||
|
-- Such as "From <stdio.h>".
|
||||||
|
extra_info_hl = "@comment",
|
||||||
|
-- Similar to the same setting of gopls.
|
||||||
|
align_type_to_right = true,
|
||||||
|
-- the hl group of leading dot of "•std::filesystem::permissions(..)"
|
||||||
|
import_dot_hl = "@comment",
|
||||||
|
},
|
||||||
|
zls = {
|
||||||
|
-- Similar to the same setting of gopls.
|
||||||
|
align_type_to_right = true,
|
||||||
|
},
|
||||||
|
roslyn = {
|
||||||
|
extra_info_hl = "@comment",
|
||||||
|
},
|
||||||
|
-- The same applies to pyright/pylance
|
||||||
|
basedpyright = {
|
||||||
|
-- It is usually import path such as "os"
|
||||||
|
extra_info_hl = "@comment",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- If true, try to highlight "not supported" languages.
|
||||||
|
fallback = true,
|
||||||
|
},
|
||||||
|
-- If the built-in logic fails to find a suitable highlight group,
|
||||||
|
-- this highlight is applied to the label.
|
||||||
|
fallback_highlight = "@variable",
|
||||||
|
-- If provided, the plugin truncates the final displayed text to
|
||||||
|
-- this width (measured in display cells). Any highlights that extend
|
||||||
|
-- beyond the truncation point are ignored. When set to a float
|
||||||
|
-- between 0 and 1, it'll be treated as percentage of the width of
|
||||||
|
-- the window: math.floor(max_width * vim.api.nvim_win_get_width(0))
|
||||||
|
-- Default 60.
|
||||||
|
max_width = 60,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
} }
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ return {
|
|||||||
|
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 999,
|
priority = 999,
|
||||||
|
dependencies = {
|
||||||
|
'Iron-E/nvim-highlite'
|
||||||
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require('themify').setup({
|
require('themify').setup({
|
||||||
activity = true,
|
activity = true,
|
||||||
@@ -39,6 +41,7 @@ return {
|
|||||||
'aktersnurra/no-clown-fiesta.nvim',
|
'aktersnurra/no-clown-fiesta.nvim',
|
||||||
'kdheepak/monochrome.nvim',
|
'kdheepak/monochrome.nvim',
|
||||||
'ficcdaf/ashen.nvim',
|
'ficcdaf/ashen.nvim',
|
||||||
|
'm15a/nvim-srcerite',
|
||||||
'default'
|
'default'
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
return {
|
|
||||||
'nvimdev/epo.nvim',
|
|
||||||
config = function()
|
|
||||||
-- the default completetopt set by epo
|
|
||||||
vim.opt.completeopt = "menu,menuone,noselect,popup"
|
|
||||||
|
|
||||||
-- use default settings
|
|
||||||
require('epo').setup({
|
|
||||||
fuzzy = true,
|
|
||||||
signature_border = 'rounded',
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
@@ -5,13 +5,13 @@ return {
|
|||||||
use_default_keymaps = false,
|
use_default_keymaps = false,
|
||||||
max_join_length = 1000,
|
max_join_length = 1000,
|
||||||
})
|
})
|
||||||
-- -- For default preset
|
-- For default preset
|
||||||
-- vim.keymap.set('n', '<leader>jt', require('treesj').toggle)
|
vim.keymap.set('n', '<leader>jt', require('treesj').toggle)
|
||||||
-- -- For extending default preset with `recursive = true`
|
-- For extending default preset with `recursive = true`
|
||||||
-- vim.keymap.set('n', '<leader>jT', function()
|
vim.keymap.set('n', '<leader>jT', function()
|
||||||
-- require('treesj').toggle({ split = { recursive = true } })
|
require('treesj').toggle({ split = { recursive = true } })
|
||||||
-- end)
|
end)
|
||||||
end,
|
end,
|
||||||
-- it is loading very long or is it treesitter?
|
-- it is loading very long or is it treesitter?
|
||||||
enabled = false
|
enabled = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,558 +1,378 @@
|
|||||||
-- -- progress data
|
|
||||||
-- local clients = {}
|
|
||||||
-- local progress = { '⠋', '⠙', '⠸', '⢰', '⣠', '⣄', '⡆', '⠇' }
|
|
||||||
--
|
|
||||||
-- -- check for lsp progress data
|
|
||||||
-- local function is_lsp_loading(client) return client and clients[client] and clients[client].percentage < 100 end
|
|
||||||
--
|
|
||||||
-- -- update lsp progress
|
|
||||||
-- local function update_lsp_progress()
|
|
||||||
-- local messages = vim.lsp.util.get_progress_messages()
|
|
||||||
-- for _, message in ipairs(messages) do
|
|
||||||
-- if not message.name then goto continue end
|
|
||||||
--
|
|
||||||
-- local client_name = message.name
|
|
||||||
--
|
|
||||||
-- if not clients[client_name] then clients[client_name] = { percentage = 0, progress_index = 0 } end
|
|
||||||
--
|
|
||||||
-- if message.done then
|
|
||||||
-- clients[client_name].percentage = 100
|
|
||||||
-- else
|
|
||||||
-- if message.percentage then clients[client_name].percentage = message.percentage end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- if clients[client_name].percentage % 5 == 0 or clients[client_name].progress_index == 0 then
|
|
||||||
-- vim.opt.statusline = vim.opt.statusline
|
|
||||||
-- clients[client_name].progress_index = clients[client_name].progress_index + 1
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- if clients[client_name].progress_index > #progress then clients[client_name].progress_index = 1 end
|
|
||||||
--
|
|
||||||
-- ::continue::
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- -- get lsp client name for buffer
|
|
||||||
-- local function get_lsp_client_name()
|
|
||||||
-- local active_clients = vim.lsp.get_clients({ bufnr = 0 })
|
|
||||||
-- local client_name
|
|
||||||
--
|
|
||||||
-- if #active_clients > 0 then client_name = active_clients[1].name end
|
|
||||||
-- return client_name
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- -- configure feline
|
|
||||||
-- local function config(_, opts)
|
|
||||||
-- --local colorscheme = vim.g.colors_name
|
|
||||||
-- local colorscheme = 'nightfox'
|
|
||||||
-- local palette = require('nightfox.palette').load(colorscheme)
|
|
||||||
-- local feline = require('feline')
|
|
||||||
-- local vi_mode = require('feline.providers.vi_mode')
|
|
||||||
-- local file = require('feline.providers.file')
|
|
||||||
-- local separators = require('feline.defaults').statusline.separators.default_value
|
|
||||||
-- local lsp = require('feline.providers.lsp')
|
|
||||||
--
|
|
||||||
-- local theme = {
|
|
||||||
-- fg = palette.fg1,
|
|
||||||
-- bg = palette.bg1,
|
|
||||||
-- black = palette.black.base,
|
|
||||||
-- skyblue = palette.blue.bright,
|
|
||||||
-- cyan = palette.cyan.base,
|
|
||||||
-- green = palette.green.base,
|
|
||||||
-- oceanblue = palette.blue.base,
|
|
||||||
-- magenta = palette.magenta.base,
|
|
||||||
-- orange = palette.orange.base,
|
|
||||||
-- red = palette.red.base,
|
|
||||||
-- violet = palette.magenta.bright,
|
|
||||||
-- white = palette.white.base,
|
|
||||||
-- yellow = palette.yellow.base,
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- local c = {
|
|
||||||
--
|
|
||||||
-- -- local function git_diff(type)
|
|
||||||
-- -- ---@diagnostic disable-next-line: undefined-field
|
|
||||||
-- -- local gsd = vim.b.gitsigns_status_dict
|
|
||||||
-- -- if gsd and gsd[type] and gsd[type] > 0 then return tostring(gsd[type]) end
|
|
||||||
-- -- return nil
|
|
||||||
-- -- end
|
|
||||||
--
|
|
||||||
-- -- left
|
|
||||||
-- vim_status = {
|
|
||||||
-- provider = function()
|
|
||||||
-- local s
|
|
||||||
-- if require('lazy.status').has_updates() then
|
|
||||||
-- s = require('lazy.status').updates()
|
|
||||||
-- else
|
|
||||||
-- s = ''
|
|
||||||
-- end
|
|
||||||
-- s = string.format(' %s ', s)
|
|
||||||
-- return s
|
|
||||||
-- end,
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.blue.base },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_right,
|
|
||||||
-- hl = { fg = palette.blue.base, bg = palette.bg0 },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- file_name = {
|
|
||||||
-- provider = {
|
|
||||||
-- name = 'file_info',
|
|
||||||
-- opts = { colored_icon = false },
|
|
||||||
-- },
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.white.base },
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = string.format('%s ', separators.slant_right),
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.white.base },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- git_branch = {
|
|
||||||
-- provider = function()
|
|
||||||
-- local git = require('feline.providers.git')
|
|
||||||
-- local branch, icon = git.git_branch()
|
|
||||||
-- local s
|
|
||||||
-- if #branch > 0 then
|
|
||||||
-- s = string.format(' %s%s ', icon, branch)
|
|
||||||
-- else
|
|
||||||
-- s = string.format(' %s ', 'Untracked')
|
|
||||||
-- end
|
|
||||||
-- return s
|
|
||||||
-- end,
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.fg3 },
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = string.format('%s%s', separators.block, separators.slant_right),
|
|
||||||
-- hl = { fg = palette.white.base, bg = palette.fg3 },
|
|
||||||
-- },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_right,
|
|
||||||
-- hl = { fg = palette.fg3, bg = palette.bg0 },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local status = git_diff('added')
|
|
||||||
-- -- local s
|
|
||||||
-- -- if status then
|
|
||||||
-- -- s = string.format(' %s %s ', '', status)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.green.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.green.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local status = git_diff('changed')
|
|
||||||
-- -- local s
|
|
||||||
-- -- if status then
|
|
||||||
-- -- s = string.format(' %s %s ', '', status)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.yellow.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.green.base, bg = palette.yellow.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local status = git_diff('removed')
|
|
||||||
-- -- local s
|
|
||||||
-- -- if status then
|
|
||||||
-- -- s = string.format(' %s %s ', '', status)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.red.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.yellow.base, bg = palette.red.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- right_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.red.base, bg = palette.bg0 },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- lsp = {
|
|
||||||
-- provider = function()
|
|
||||||
-- if not lsp.is_lsp_attached() then return ' LSP ' end
|
|
||||||
--
|
|
||||||
-- local client_name = get_lsp_client_name()
|
|
||||||
-- if is_lsp_loading(client_name) then
|
|
||||||
-- return string.format(' %s LSP ', progress[clients[client_name].progress_index])
|
|
||||||
-- else
|
|
||||||
-- return ' LSP '
|
|
||||||
-- end
|
|
||||||
-- end,
|
|
||||||
-- hl = function()
|
|
||||||
-- if not lsp.is_lsp_attached() then return { fg = palette.bg0, bg = palette.fg3 } end
|
|
||||||
--
|
|
||||||
-- local client_name = get_lsp_client_name()
|
|
||||||
-- if is_lsp_loading(client_name) then return { fg = palette.bg0, bg = palette.yellow.base } end
|
|
||||||
--
|
|
||||||
-- return { fg = palette.bg0, bg = palette.green.base }
|
|
||||||
-- end,
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_right,
|
|
||||||
-- hl = function()
|
|
||||||
-- if not lsp.is_lsp_attached() then return { fg = palette.bg0, bg = palette.fg3 } end
|
|
||||||
--
|
|
||||||
-- local client_name = get_lsp_client_name()
|
|
||||||
-- if is_lsp_loading(client_name) then return { fg = palette.bg0, bg = palette.yellow.base } end
|
|
||||||
--
|
|
||||||
-- return { fg = palette.bg0, bg = palette.green.base }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_right,
|
|
||||||
-- hl = function()
|
|
||||||
-- if not lsp.is_lsp_attached() then return { fg = palette.fg3, bg = 'none' } end
|
|
||||||
--
|
|
||||||
-- local client_name = get_lsp_client_name()
|
|
||||||
-- if is_lsp_loading(client_name) then return { fg = palette.yellow.base, bg = 'none' } end
|
|
||||||
--
|
|
||||||
-- return { fg = palette.green.base, bg = 'none' }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local s
|
|
||||||
-- -- local count = vim.tbl_count(vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }))
|
|
||||||
-- -- if count > 0 then
|
|
||||||
-- -- s = string.format(' %s %d ', '', count)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.red.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.red.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local s
|
|
||||||
-- -- local count = vim.tbl_count(vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }))
|
|
||||||
-- -- if count > 0 then
|
|
||||||
-- -- s = string.format(' %s %d ', '', count)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.magenta.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.red.base, bg = palette.magenta.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local s
|
|
||||||
-- -- local count = vim.tbl_count(vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }))
|
|
||||||
-- -- if count > 0 then
|
|
||||||
-- -- s = string.format(' %s %d ', '', count)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.blue.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.magenta.base, bg = palette.blue.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- -- table.insert(components.active[left], {
|
|
||||||
-- -- provider = function()
|
|
||||||
-- -- local s
|
|
||||||
-- -- local count = vim.tbl_count(vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }))
|
|
||||||
-- -- if count > 0 then
|
|
||||||
-- -- s = string.format(' %s %d ', '', count)
|
|
||||||
-- -- else
|
|
||||||
-- -- s = ''
|
|
||||||
-- -- end
|
|
||||||
-- -- return s
|
|
||||||
-- -- end,
|
|
||||||
-- -- hl = { fg = palette.bg0, bg = palette.orange.base },
|
|
||||||
-- -- left_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.blue.base, bg = palette.orange.base },
|
|
||||||
-- -- },
|
|
||||||
-- -- right_sep = {
|
|
||||||
-- -- always_visible = true,
|
|
||||||
-- -- str = separators.slant_right,
|
|
||||||
-- -- hl = { fg = palette.orange.base, bg = 'none' },
|
|
||||||
-- -- },
|
|
||||||
-- -- })
|
|
||||||
--
|
|
||||||
-- -- right
|
|
||||||
-- vi_mode = {
|
|
||||||
-- provider = function() return string.format(' %s ', vi_mode.get_vim_mode()) end,
|
|
||||||
-- hl = function() return { fg = palette.bg0, bg = vi_mode.get_mode_color() } end,
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_left,
|
|
||||||
-- hl = function() return { fg = vi_mode.get_mode_color(), bg = 'none' } end,
|
|
||||||
-- },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_left,
|
|
||||||
-- hl = function() return { fg = palette.bg0, bg = vi_mode.get_mode_color() } end,
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- macro = {
|
|
||||||
-- provider = function()
|
|
||||||
-- local s
|
|
||||||
-- local recording_register = vim.fn.reg_recording()
|
|
||||||
-- if #recording_register == 0 then
|
|
||||||
-- s = ''
|
|
||||||
-- else
|
|
||||||
-- s = string.format(' Recording @%s ', recording_register)
|
|
||||||
-- end
|
|
||||||
-- return s
|
|
||||||
-- end,
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.fg3 },
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_left,
|
|
||||||
-- hl = function() return { fg = palette.fg3, bg = palette.bg0 } end,
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- search_count = {
|
|
||||||
-- provider = function()
|
|
||||||
-- if vim.v.hlsearch == 0 then return '' end
|
|
||||||
--
|
|
||||||
-- local ok, result = pcall(vim.fn.searchcount, { maxcount = 999, timeout = 250 })
|
|
||||||
-- if not ok then return '' end
|
|
||||||
-- if next(result) == nil then return '' end
|
|
||||||
--
|
|
||||||
-- local denominator = math.min(result.total, result.maxcount)
|
|
||||||
-- return string.format(' [%d/%d] ', result.current, denominator)
|
|
||||||
-- end,
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.white.base },
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_left,
|
|
||||||
-- hl = function() return { fg = palette.white.base, bg = palette.fg3 } end,
|
|
||||||
-- },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = separators.slant_left,
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.white.base },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- cursor_position = {
|
|
||||||
-- provider = {
|
|
||||||
-- name = 'position',
|
|
||||||
-- opts = { padding = true },
|
|
||||||
-- },
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.blue.base },
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = string.format('%s%s', separators.slant_left, separators.block),
|
|
||||||
-- hl = function() return { fg = palette.blue.base, bg = palette.bg0 } end,
|
|
||||||
-- },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = ' ',
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.blue.base },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- scroll_bar = {
|
|
||||||
-- provider = {
|
|
||||||
-- name = 'scroll_bar',
|
|
||||||
-- opts = { reverse = true },
|
|
||||||
-- },
|
|
||||||
-- hl = { fg = palette.blue.dim, bg = palette.blue.base },
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- -- inactive statusline
|
|
||||||
-- in_file_info = {
|
|
||||||
-- provider = function()
|
|
||||||
-- if vim.api.nvim_buf_get_name(0) ~= '' then
|
|
||||||
-- return file.file_info({}, { colored_icon = false })
|
|
||||||
-- else
|
|
||||||
-- return file.file_type({}, { colored_icon = false, case = 'lowercase' })
|
|
||||||
-- end
|
|
||||||
-- end,
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.blue.base },
|
|
||||||
-- left_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = string.format('%s%s', separators.slant_left, separators.block),
|
|
||||||
-- hl = { fg = palette.blue.base, bg = 'none' },
|
|
||||||
-- },
|
|
||||||
-- right_sep = {
|
|
||||||
-- always_visible = true,
|
|
||||||
-- str = ' ',
|
|
||||||
-- hl = { fg = palette.bg0, bg = palette.blue.base },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- local active = {
|
|
||||||
-- { -- left
|
|
||||||
-- c.vim_status,
|
|
||||||
-- c.file_name,
|
|
||||||
-- c.git_branch,
|
|
||||||
-- c.lsp,
|
|
||||||
-- },
|
|
||||||
-- { -- right
|
|
||||||
-- c.vi_mode,
|
|
||||||
-- c.macro,
|
|
||||||
-- c.search_count,
|
|
||||||
-- c.cursor_position,
|
|
||||||
-- c.scroll_bar,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- local inactive = {
|
|
||||||
-- { -- left
|
|
||||||
-- },
|
|
||||||
-- { -- right
|
|
||||||
-- c.in_file_info,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- opts.components = { active = active, inactive = inactive }
|
|
||||||
--
|
|
||||||
-- feline.setup(opts)
|
|
||||||
-- feline.use_theme(theme)
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- return {
|
|
||||||
-- 'freddiehaddad/feline.nvim',
|
|
||||||
-- config = config,
|
|
||||||
-- dependencies = { 'EdenEast/nightfox.nvim', 'lewis6991/gitsigns.nvim', 'nvim-tree/nvim-web-devicons' },
|
|
||||||
-- init = function()
|
|
||||||
-- -- use a global statusline
|
|
||||||
-- -- vim.opt.laststatus = 3
|
|
||||||
--
|
|
||||||
-- -- update statusbar when there's a plugin update
|
|
||||||
-- vim.api.nvim_create_autocmd('User', {
|
|
||||||
-- pattern = 'LazyCheck',
|
|
||||||
-- callback = function() vim.opt.statusline = vim.opt.statusline end,
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- -- update statusbar with LSP progress
|
|
||||||
-- vim.api.nvim_create_autocmd('User', {
|
|
||||||
-- pattern = 'LspProgressUpdate',
|
|
||||||
-- callback = function() update_lsp_progress() end,
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- -- hide the mode
|
|
||||||
-- vim.opt.showmode = false
|
|
||||||
--
|
|
||||||
-- -- hide search count on command line
|
|
||||||
-- vim.opt.shortmess:append({ S = true })
|
|
||||||
-- end,
|
|
||||||
-- opts = {
|
|
||||||
-- force_inactive = { filetypes = { '^dapui_*', '^help$', '^neotest*', '^NvimTree$', '^qf$' } },
|
|
||||||
-- disable = { filetypes = { '^alpha$' } },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Calls `require('slimline').setup({})`
|
"rebelot/heirline.nvim",
|
||||||
"sschleemilch/slimline.nvim",
|
config = function()
|
||||||
opts = {
|
local conditions = require("heirline.conditions")
|
||||||
bold = false, -- makes primary parts and mode bold
|
local heirline = require('heirline')
|
||||||
verbose_mode = false, -- Mode as single letter or as a word
|
|
||||||
style = 'bg', -- or "fg". Whether highlights should be applied to bg or fg of components
|
local utils = require("heirline.utils")
|
||||||
mode_follow_style = true, -- Whether the mode color components should follow the style option
|
|
||||||
components = { -- Choose components and their location
|
local Space = { provider = " " }
|
||||||
left = {
|
local colors = {
|
||||||
"mode",
|
bright_bg = utils.get_highlight("Folded").bg,
|
||||||
"path",
|
bright_fg = utils.get_highlight("Folded").fg,
|
||||||
"git"
|
red = utils.get_highlight("DiagnosticError").fg,
|
||||||
|
-- dark_red = utils.get_highlight("DiffDelete").bg,
|
||||||
|
green = utils.get_highlight("String").fg,
|
||||||
|
blue = utils.get_highlight("Function").fg,
|
||||||
|
gray = utils.get_highlight("NonText").fg,
|
||||||
|
orange = utils.get_highlight("Constant").fg,
|
||||||
|
purple = utils.get_highlight("Statement").fg,
|
||||||
|
cyan = utils.get_highlight("Special").fg,
|
||||||
|
diag_warn = utils.get_highlight("DiagnosticWarn").fg,
|
||||||
|
diag_error = utils.get_highlight("DiagnosticError").fg,
|
||||||
|
diag_hint = utils.get_highlight("DiagnosticHint").fg,
|
||||||
|
diag_info = utils.get_highlight("DiagnosticInfo").fg,
|
||||||
|
-- git_del = utils.get_highlight("diffDeleted").fg,
|
||||||
|
-- git_add = utils.get_highlight("diffAdded").fg,
|
||||||
|
-- git_change = utils.get_highlight("diffChanged").fg,
|
||||||
|
}
|
||||||
|
|
||||||
|
heirline.load_colors(colors)
|
||||||
|
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
local ViMode = {
|
||||||
|
-- get vim current mode, this information will be required by the provider
|
||||||
|
-- and the highlight functions, so we compute it only once per component
|
||||||
|
-- evaluation and store it as a component attribute
|
||||||
|
init = function(self)
|
||||||
|
self.mode = vim.fn.mode(1) -- :h mode()
|
||||||
|
|
||||||
|
-- execute this only once, this is required if you want the ViMode
|
||||||
|
-- component to be updated on operator pending mode
|
||||||
|
if not self.once then
|
||||||
|
vim.api.nvim_create_autocmd("ModeChanged", {
|
||||||
|
pattern = "*:*o",
|
||||||
|
command = 'redrawstatus'
|
||||||
|
})
|
||||||
|
self.once = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- Now we define some dictionaries to map the output of mode() to the
|
||||||
|
-- corresponding string and color. We can put these into `static` to compute
|
||||||
|
-- them at initialisation time.
|
||||||
|
static = {
|
||||||
|
mode_names = { -- change the strings if you like it vvvvverbose!
|
||||||
|
n = "N",
|
||||||
|
no = "N?",
|
||||||
|
nov = "N?",
|
||||||
|
noV = "N?",
|
||||||
|
["no\22"] = "N?",
|
||||||
|
niI = "Ni",
|
||||||
|
niR = "Nr",
|
||||||
|
niV = "Nv",
|
||||||
|
nt = "Nt",
|
||||||
|
v = "V",
|
||||||
|
vs = "Vs",
|
||||||
|
V = "V_",
|
||||||
|
Vs = "Vs",
|
||||||
|
["\22"] = "^V",
|
||||||
|
["\22s"] = "^V",
|
||||||
|
s = "S",
|
||||||
|
S = "S_",
|
||||||
|
["\19"] = "^S",
|
||||||
|
i = "I",
|
||||||
|
ic = "Ic",
|
||||||
|
ix = "Ix",
|
||||||
|
R = "R",
|
||||||
|
Rc = "Rc",
|
||||||
|
Rx = "Rx",
|
||||||
|
Rv = "Rv",
|
||||||
|
Rvc = "Rv",
|
||||||
|
Rvx = "Rv",
|
||||||
|
c = "C",
|
||||||
|
cv = "Ex",
|
||||||
|
r = "...",
|
||||||
|
rm = "M",
|
||||||
|
["r?"] = "?",
|
||||||
|
["!"] = "!",
|
||||||
|
t = "T",
|
||||||
},
|
},
|
||||||
center = {},
|
mode_colors = {
|
||||||
right = {
|
n = "red",
|
||||||
"diagnostics",
|
i = "green",
|
||||||
"filetype_lsp",
|
v = "cyan",
|
||||||
"progress"
|
V = "cyan",
|
||||||
|
["\22"] = "cyan",
|
||||||
|
c = "orange",
|
||||||
|
s = "purple",
|
||||||
|
S = "purple",
|
||||||
|
["\19"] = "purple",
|
||||||
|
R = "orange",
|
||||||
|
r = "orange",
|
||||||
|
["!"] = "red",
|
||||||
|
t = "red",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
spaces = {
|
-- We can now access the value of mode() that, by now, would have been
|
||||||
components = ' ', -- string between components
|
-- computed by `init()` and use it to index our strings dictionary.
|
||||||
left = ' ', -- string at the start of the line
|
-- note how `static` fields become just regular attributes once the
|
||||||
right = ' ', -- string at the end of the line
|
-- component is instantiated.
|
||||||
},
|
-- To be extra meticulous, we can also add some vim statusline syntax to
|
||||||
sep = {
|
-- control the padding and make sure our string is always at least 2
|
||||||
hide = {
|
-- characters long. Plus a nice Icon.
|
||||||
first = false, -- hides the first separator
|
provider = function(self)
|
||||||
last = false, -- hides the last separator
|
return "%1(" .. self.mode_names[self.mode] .. "%)"
|
||||||
},
|
end,
|
||||||
left = '', -- left separator of components
|
-- Same goes for the highlight. Now the foreground will change according to the current mode.
|
||||||
right = '', -- right separator of components
|
hl = function(self)
|
||||||
},
|
local mode = self.mode:sub(1, 1) -- get only the first mode character
|
||||||
hl = {
|
return { fg = self.mode_colors[mode], bold = true, }
|
||||||
modes = {
|
end,
|
||||||
normal = 'Type', -- highlight base of modes
|
-- Re-evaluate the component only on ModeChanged event!
|
||||||
insert = 'Function',
|
-- This is not required in any way, but it's there, and it's a small
|
||||||
pending = 'Boolean',
|
-- performance improvement.
|
||||||
visual = 'Keyword',
|
update = {
|
||||||
command = 'String',
|
"ModeChanged",
|
||||||
},
|
|
||||||
base = 'Comment', -- highlight of everything in in between components
|
|
||||||
primary = 'Normal', -- highlight of primary parts (e.g. filename)
|
|
||||||
secondary = 'Comment', -- highlight of secondary parts (e.g. filepath)
|
|
||||||
},
|
|
||||||
icons = {
|
|
||||||
diagnostics = {
|
|
||||||
ERROR = ' ',
|
|
||||||
WARN = ' ',
|
|
||||||
HINT = ' ',
|
|
||||||
INFO = ' ',
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
branch = '',
|
|
||||||
},
|
|
||||||
folder = ' ',
|
|
||||||
lines = ' ',
|
|
||||||
recording = ' ',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
local FileNameBlock = {
|
||||||
|
-- let's first set up some attributes needed by this component and it's children
|
||||||
|
init = function(self)
|
||||||
|
self.filename = vim.api.nvim_buf_get_name(0)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
-- We can now define some children separately and add them later
|
||||||
|
|
||||||
|
local FileIcon = {
|
||||||
|
init = function(self)
|
||||||
|
local filename = self.filename
|
||||||
|
local extension = vim.fn.fnamemodify(filename, ":e")
|
||||||
|
self.icon, self.icon_color = require("nvim-web-devicons").get_icon_color(filename, extension,
|
||||||
|
{ default = true })
|
||||||
|
end,
|
||||||
|
provider = function(self)
|
||||||
|
return self.icon and (self.icon .. " ")
|
||||||
|
end,
|
||||||
|
hl = function(self)
|
||||||
|
return { fg = self.icon_color }
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
local FileName = {
|
||||||
|
provider = function(self)
|
||||||
|
-- first, trim the pattern relative to the current directory. For other
|
||||||
|
-- options, see :h filename-modifiers
|
||||||
|
local filename = vim.fn.fnamemodify(self.filename, ":.")
|
||||||
|
if filename == "" then return "[No Name]" end
|
||||||
|
-- now, if the filename would occupy more than 1/4th of the available
|
||||||
|
-- space, we trim the file path to its initials
|
||||||
|
-- See Flexible Components section below for dynamic truncation
|
||||||
|
if not conditions.width_percent_below(#filename, 0.5) then
|
||||||
|
filename = vim.fn.pathshorten(filename)
|
||||||
|
end
|
||||||
|
return filename
|
||||||
|
end,
|
||||||
|
hl = { fg = utils.get_highlight("Directory").fg },
|
||||||
|
}
|
||||||
|
|
||||||
|
local FileFlags = {
|
||||||
|
{
|
||||||
|
condition = function()
|
||||||
|
return vim.bo.modified
|
||||||
|
end,
|
||||||
|
provider = "[+]",
|
||||||
|
hl = { fg = "green" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition = function()
|
||||||
|
return not vim.bo.modifiable or vim.bo.readonly
|
||||||
|
end,
|
||||||
|
provider = "",
|
||||||
|
hl = { fg = "orange" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Now, let's say that we want the filename color to change if the buffer is
|
||||||
|
-- modified. Of course, we could do that directly using the FileName.hl field,
|
||||||
|
-- but we'll see how easy it is to alter existing components using a "modifier"
|
||||||
|
-- component
|
||||||
|
|
||||||
|
local FileNameModifier = {
|
||||||
|
hl = function()
|
||||||
|
if vim.bo.modified then
|
||||||
|
-- use `force` because we need to override the child's hl foreground
|
||||||
|
return { fg = "cyan", bold = true, force = true }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- let's add the children to our FileNameBlock component
|
||||||
|
FileNameBlock = utils.insert(FileNameBlock,
|
||||||
|
FileIcon,
|
||||||
|
utils.insert(FileNameModifier, FileName), -- a new table where FileName is a child of FileNameModifier
|
||||||
|
FileFlags,
|
||||||
|
{ provider = '%<' } -- this means that the statusline is cut here when there's not enough space
|
||||||
|
)
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
-- We're getting minimalists here!
|
||||||
|
local Ruler = {
|
||||||
|
-- %l = current line number
|
||||||
|
-- %L = number of lines in the buffer
|
||||||
|
-- %c = column number
|
||||||
|
-- %P = percentage through file of displayed window
|
||||||
|
provider = "%7(%l/%3L%):%2c %P",
|
||||||
|
}
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
|
||||||
|
local LSPActive = {
|
||||||
|
condition = conditions.lsp_attached,
|
||||||
|
update = { 'LspAttach', 'LspDetach' },
|
||||||
|
|
||||||
|
-- You can keep it simple,
|
||||||
|
-- provider = " [LSP]",
|
||||||
|
|
||||||
|
-- Or complicate things a bit and get the servers names
|
||||||
|
provider = function()
|
||||||
|
local names = {}
|
||||||
|
for i, server in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
|
||||||
|
table.insert(names, server.name)
|
||||||
|
end
|
||||||
|
return " " .. table.concat(names, ",")
|
||||||
|
end,
|
||||||
|
hl = { fg = "green", bold = true },
|
||||||
|
}
|
||||||
|
local LSPMessages = {
|
||||||
|
provider = vim.lsp.status(),
|
||||||
|
hl = { fg = "gray" },
|
||||||
|
}
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
local Diagnostics = {
|
||||||
|
|
||||||
|
condition = conditions.has_diagnostics,
|
||||||
|
|
||||||
|
static = {
|
||||||
|
-- these require something...
|
||||||
|
error_icon = "✘",
|
||||||
|
warn_icon = "",
|
||||||
|
info_icon = "◉",
|
||||||
|
hint_icon = "",
|
||||||
|
},
|
||||||
|
|
||||||
|
init = function(self)
|
||||||
|
self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
|
||||||
|
self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
|
||||||
|
self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
|
||||||
|
self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
|
||||||
|
end,
|
||||||
|
|
||||||
|
update = { "DiagnosticChanged", "BufEnter" },
|
||||||
|
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
-- 0 is just another output, we can decide to print it or not!
|
||||||
|
return self.errors > 0 and (self.error_icon .. self.errors .. " ")
|
||||||
|
end,
|
||||||
|
hl = { fg = "diag_error" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
return self.warnings > 0 and (self.warn_icon .. self.warnings .. " ")
|
||||||
|
end,
|
||||||
|
hl = { fg = "diag_warn" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
return self.info > 0 and (self.info_icon .. self.info .. " ")
|
||||||
|
end,
|
||||||
|
hl = { fg = "diag_info" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
return self.hints > 0 and (self.hint_icon .. self.hints)
|
||||||
|
end,
|
||||||
|
hl = { fg = "diag_hint" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
local DAPMessages = {
|
||||||
|
condition = function()
|
||||||
|
local session = require("dap").session()
|
||||||
|
return session ~= nil
|
||||||
|
end,
|
||||||
|
provider = function()
|
||||||
|
return " " .. require("dap").status()
|
||||||
|
end,
|
||||||
|
hl = "Debug"
|
||||||
|
-- see Click-it! section for clickable actions
|
||||||
|
}
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
local WorkDir = {
|
||||||
|
provider = function()
|
||||||
|
local icon = (vim.fn.haslocaldir(0) == 1 and "l" or "g") .. " " .. " "
|
||||||
|
local cwd = vim.fn.getcwd(0)
|
||||||
|
cwd = vim.fn.fnamemodify(cwd, ":~")
|
||||||
|
if not conditions.width_percent_below(#cwd, 0.25) then
|
||||||
|
cwd = vim.fn.pathshorten(cwd)
|
||||||
|
end
|
||||||
|
local trail = cwd:sub(-1) == '/' and '' or "/"
|
||||||
|
return icon .. cwd .. trail
|
||||||
|
end,
|
||||||
|
hl = { fg = "blue", bold = true },
|
||||||
|
}
|
||||||
|
-- --------------------------------------------------------------
|
||||||
|
local Align = { provider = "%=" }
|
||||||
|
-- ViMode = utils.surround({ "", "" }, "bright_bg", { ViMode })
|
||||||
|
|
||||||
|
local DefaultStatusline = {
|
||||||
|
ViMode, Space, FileNameBlock, Space, Align,
|
||||||
|
Align, DAPMessages,
|
||||||
|
LSPActive, Space, Diagnostics, Space, LSPMessages, Space, Ruler
|
||||||
|
}
|
||||||
|
|
||||||
|
local FileType = {
|
||||||
|
provider = function()
|
||||||
|
return string.upper(vim.bo.filetype)
|
||||||
|
end,
|
||||||
|
hl = { fg = utils.get_highlight("Type").fg, bold = true },
|
||||||
|
}
|
||||||
|
--
|
||||||
|
local InactiveStatusline = {
|
||||||
|
condition = conditions.is_not_active,
|
||||||
|
FileNameBlock,
|
||||||
|
Align,
|
||||||
|
}
|
||||||
|
|
||||||
|
local SpecialStatusline = {
|
||||||
|
condition = function()
|
||||||
|
return conditions.buffer_matches({
|
||||||
|
buftype = { "nofile", "prompt", "help", "quickfix" },
|
||||||
|
filetype = { "^git.*", "fugitive" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
|
FileType,
|
||||||
|
Space,
|
||||||
|
Align
|
||||||
|
}
|
||||||
|
local StatusLine = {
|
||||||
|
|
||||||
|
hl = function()
|
||||||
|
if conditions.is_active() then
|
||||||
|
return "StatusLine"
|
||||||
|
else
|
||||||
|
return "StatusLineNC"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- the first statusline with no condition, or which condition returns true is used.
|
||||||
|
-- think of it as a switch case with breaks to stop fallthrough.
|
||||||
|
fallthrough = false,
|
||||||
|
|
||||||
|
SpecialStatusline,
|
||||||
|
InactiveStatusline,
|
||||||
|
DefaultStatusline,
|
||||||
|
}
|
||||||
|
|
||||||
|
local Winbar = { { provider = "»" }, Space }
|
||||||
|
local TabLine = {}
|
||||||
|
-- local StatusColumn = {}
|
||||||
|
|
||||||
|
heirline.setup({
|
||||||
|
statusline = StatusLine,
|
||||||
|
-- winbar = Winbar,
|
||||||
|
tabline = TabLine,
|
||||||
|
-- statuscolumn = StatusColumn
|
||||||
|
})
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,37 +11,6 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require('lspconfig')
|
||||||
require('clangd_extensions').setup({
|
require('clangd_extensions').setup({
|
||||||
inlay_hints = {
|
|
||||||
inline = false,
|
|
||||||
-- Options other than `highlight' and `priority' only work
|
|
||||||
-- if `inline' is disabled
|
|
||||||
-- Only show inlay hints for the current line
|
|
||||||
only_current_line = true,
|
|
||||||
-- Event which triggers a refresh of the inlay hints.
|
|
||||||
-- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but
|
|
||||||
-- not that this may cause higher CPU usage.
|
|
||||||
-- This option is only respected when only_current_line and
|
|
||||||
-- autoSetHints both are true.
|
|
||||||
only_current_line_autocmd = { "CursorMoved", "CursorMovedI" },
|
|
||||||
-- whether to show parameter hints with the inlay hints or not
|
|
||||||
show_parameter_hints = true,
|
|
||||||
-- prefix for parameter hints
|
|
||||||
parameter_hints_prefix = "←",
|
|
||||||
-- prefix for all the other hints (type, chaining)
|
|
||||||
other_hints_prefix = "→",
|
|
||||||
-- whether to align to the length of the longest line in the file
|
|
||||||
max_len_align = true,
|
|
||||||
-- padding from the left if max_len_align is true
|
|
||||||
max_len_align_padding = 1,
|
|
||||||
-- whether to align to the extreme right or not
|
|
||||||
right_align = false,
|
|
||||||
-- padding from the right if right_align is true
|
|
||||||
right_align_padding = 7,
|
|
||||||
-- The color of the hints
|
|
||||||
highlight = "Comment",
|
|
||||||
-- The highlight group priority for extmark
|
|
||||||
priority = 100,
|
|
||||||
},
|
|
||||||
ast = {
|
ast = {
|
||||||
-- These are unicode, should be available in any font
|
-- These are unicode, should be available in any font
|
||||||
role_icons = {
|
role_icons = {
|
||||||
@@ -78,6 +47,8 @@ return {
|
|||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||||
vim.keymap.set('n', '<leader>E', vim.diagnostic.setloclist)
|
vim.keymap.set('n', '<leader>E', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
vim.lsp.inlay_hint.enable(true)
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
@@ -106,8 +77,6 @@ return {
|
|||||||
-- floating_window_off_x = 10,
|
-- floating_window_off_x = 10,
|
||||||
-- floating_window_off_y = 0,
|
-- floating_window_off_y = 0,
|
||||||
-- })
|
-- })
|
||||||
require("clangd_extensions.inlay_hints").setup_autocmd()
|
|
||||||
require("clangd_extensions.inlay_hints").set_inlay_hints()
|
|
||||||
require("better-diagnostic-virtual-text.api").setup_buf(ev.buf, {
|
require("better-diagnostic-virtual-text.api").setup_buf(ev.buf, {
|
||||||
ui = {
|
ui = {
|
||||||
wrap_line_after = false, -- wrap the line after this length to avoid the virtual text is too long
|
wrap_line_after = false, -- wrap the line after this length to avoid the virtual text is too long
|
||||||
@@ -123,7 +92,14 @@ return {
|
|||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
underline = false,
|
underline = false,
|
||||||
signs = true,
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.HINT] = "",
|
||||||
|
[vim.diagnostic.severity.ERROR] = "✘",
|
||||||
|
[vim.diagnostic.severity.INFO] = "◉",
|
||||||
|
[vim.diagnostic.severity.WARN] = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
virtual_text = true,
|
virtual_text = true,
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
severity_sort = true
|
severity_sort = true
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ return {
|
|||||||
end, { noremap = true })
|
end, { noremap = true })
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
|
enabled = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,22 +4,52 @@ return {
|
|||||||
'debugloop/telescope-undo.nvim',
|
'debugloop/telescope-undo.nvim',
|
||||||
'molecule-man/telescope-menufacture',
|
'molecule-man/telescope-menufacture',
|
||||||
'nvim-telescope/telescope-symbols.nvim',
|
'nvim-telescope/telescope-symbols.nvim',
|
||||||
{
|
|
||||||
{
|
{
|
||||||
"isak102/telescope-git-file-history.nvim",
|
"isak102/telescope-git-file-history.nvim",
|
||||||
dependencies = { "tpope/vim-fugitive" }
|
dependencies = { "tpope/vim-fugitive" }
|
||||||
}
|
},
|
||||||
}
|
"zongben/navimark.nvim",
|
||||||
},
|
},
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
--cmd = ":Telescope",
|
--cmd = ":Telescope",
|
||||||
config = function()
|
config = function()
|
||||||
|
require('navimark').setup({
|
||||||
|
--set "" to disable keymapping
|
||||||
|
keymap = {
|
||||||
|
base = {
|
||||||
|
mark_toggle = "<leader>mt",
|
||||||
|
mark_add = "<leader>ma",
|
||||||
|
mark_remove = "<leader>mr",
|
||||||
|
goto_next_mark = "]m",
|
||||||
|
goto_prev_mark = "[m",
|
||||||
|
open_mark_picker = "<leader>fm",
|
||||||
|
},
|
||||||
|
telescope = {
|
||||||
|
n = {
|
||||||
|
delete_mark = "d",
|
||||||
|
clear_marks = "c",
|
||||||
|
new_stack = "n",
|
||||||
|
next_stack = "<Tab>",
|
||||||
|
prev_stack = "<S-Tab>",
|
||||||
|
rename_stack = "r",
|
||||||
|
delete_stack = "D",
|
||||||
|
open_all_marked_files = "<C-o>", -- open all marked files in current stack
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sign = {
|
||||||
|
text = "",
|
||||||
|
color = "#FF0000",
|
||||||
|
},
|
||||||
|
--set to true to persist marks
|
||||||
|
persist = false,
|
||||||
|
})
|
||||||
-- require('telescope').load_extension('ultisnips')
|
-- require('telescope').load_extension('ultisnips')
|
||||||
require('telescope').setup {
|
require('telescope').setup {
|
||||||
extensions = {
|
extensions = {
|
||||||
menufacture = {
|
menufacture = {
|
||||||
mappings = {
|
mappings = {
|
||||||
main_menu = { [{'i', 'n'}] = '<C-o>' }
|
main_menu = { [{ 'i', 'n' }] = '<C-o>' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ return {
|
|||||||
modules = {},
|
modules = {},
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = function(lang, buf)
|
-- disable = function(lang, buf)
|
||||||
local max_filesize = 100 * 1024 -- 100 KB
|
-- local max_filesize = 100 * 1024 -- 100 KB
|
||||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
-- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
if ok and stats and stats.size > max_filesize then
|
-- if ok and stats and stats.size > max_filesize then
|
||||||
return true
|
-- return true
|
||||||
end
|
-- end
|
||||||
end,
|
-- end,
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
indent = {
|
indent = {
|
||||||
|
|||||||
Reference in New Issue
Block a user