gitsigns
This commit is contained in:
+13
-5
@@ -3,16 +3,24 @@ require("bufferline").setup ({
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local s = " "
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == "error" and " "
|
||||
or (e == "warning" and " " or " ")
|
||||
s = s .. n .. sym
|
||||
if diagnostics_dict then
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == "error" and " "
|
||||
or (e == "warning" and " " or " ")
|
||||
s = sym .. n
|
||||
end
|
||||
return s
|
||||
end
|
||||
return s
|
||||
return ""
|
||||
end,
|
||||
show_close_icon = false,
|
||||
show_buffer_close_icons = false,
|
||||
always_show_bufferline = true,
|
||||
tab_size = 1,
|
||||
indicator = {
|
||||
style = "icon",
|
||||
icon = "▎",
|
||||
},
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
local M = {}
|
||||
|
||||
local icons = require("assets.icons").icons.kinds
|
||||
|
||||
local devicons = {
|
||||
default_icon = { icon = "", name = "Default" },
|
||||
js = { icon = "", name = "js" },
|
||||
ts = { icon = "", name = "ts" },
|
||||
lock = { icon = "", name = "lock" },
|
||||
["robots.txt"] = { icon = "", name = "robots" },
|
||||
}
|
||||
|
||||
M.components = {
|
||||
kind_icon = {
|
||||
text = function(ctx)
|
||||
local icon = (icons[ctx.kind] or "")
|
||||
|
||||
return icon .. " "
|
||||
end,
|
||||
},
|
||||
|
||||
kind = {
|
||||
highlight = function(ctx)
|
||||
return ctx.kind
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
local opts = {
|
||||
'saghen/blink.cmp',
|
||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||
|
||||
|
||||
version = '1.*',
|
||||
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = 'enter',
|
||||
["<Tab>"] = { "select_next", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "fallback" },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
|
||||
completion = {
|
||||
documentation = { auto_show = true, auto_show_delay_ms = 50 },
|
||||
keyword = { range = "full" },
|
||||
accept = { auto_brackets = { enabled = false }},
|
||||
ghost_text = { enabled = true },
|
||||
list = {
|
||||
selection = {
|
||||
preselect = true,
|
||||
auto_insert = false,
|
||||
}
|
||||
},
|
||||
|
||||
menu = {
|
||||
scrollbar = false,
|
||||
border = "single",
|
||||
draw = {
|
||||
padding = 1,
|
||||
columns = {{ "kind_icon" }, { "label" }, { "kind" }},
|
||||
components = M.components,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
},
|
||||
|
||||
snippets = {
|
||||
preset = 'default',
|
||||
},
|
||||
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||
},
|
||||
opts_extend = { "sources.default" }
|
||||
}
|
||||
|
||||
return opts
|
||||
@@ -0,0 +1,71 @@
|
||||
---@diagnostic disable: redundant-parameter
|
||||
require("catppuccin").setup({
|
||||
flavour = "auto",
|
||||
background = {
|
||||
light = "latte",
|
||||
dark = "mocha",
|
||||
},
|
||||
transparent_background = false,
|
||||
float = {
|
||||
transparent = false,
|
||||
solid = false,
|
||||
},
|
||||
show_end_of_buffer = false,
|
||||
term_colors = false,
|
||||
dim_inactive = {
|
||||
enabled = false,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
no_italic = false,
|
||||
no_bold = false,
|
||||
no_underline = false,
|
||||
styles = {
|
||||
comments = { "italic" },
|
||||
conditionals = { "italic" },
|
||||
loops = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
numbers = {},
|
||||
booleans = {},
|
||||
properties = {},
|
||||
types = {},
|
||||
operators = {},
|
||||
-- miscs = {},
|
||||
},
|
||||
lsp_styles = {
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
ok = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "underline" },
|
||||
hints = { "underline" },
|
||||
warnings = { "underline" },
|
||||
information = { "underline" },
|
||||
ok = { "underline" },
|
||||
},
|
||||
inlay_hints = {
|
||||
background = true,
|
||||
},
|
||||
},
|
||||
color_overrides = {},
|
||||
custom_highlights = {},
|
||||
default_integrations = true,
|
||||
auto_integrations = false,
|
||||
integrations = {
|
||||
cmp = true,
|
||||
gitsigns = true,
|
||||
nvimtree = true,
|
||||
notify = false,
|
||||
mini = {
|
||||
enabled = true,
|
||||
indentscope_color = "",
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,51 @@
|
||||
local icons = require("assets.icons").icons
|
||||
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = icons.git.added },
|
||||
change = { text = icons.git.modified },
|
||||
delete = { text = icons.git.removed },
|
||||
topdelete = { text = icons.git.removed },
|
||||
changedelete = { text = icons.git.modified },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = icons.git.added },
|
||||
change = { text = icons.git.modified },
|
||||
delete = { text = icons.git.removed },
|
||||
topdelete = { text = icons.git.removed },
|
||||
changedelete = { text = icons.git.modified },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
follow_files = true
|
||||
},
|
||||
auto_attach = true,
|
||||
attach_to_untracked = false,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
use_focus = true,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
require("kanagawa").setup({
|
||||
compile = true,
|
||||
undercurl = true,
|
||||
commentStyle = { italic = true },
|
||||
functionStyle = {},
|
||||
keywordStyle = { italic = true},
|
||||
statementStyle = { bold = true },
|
||||
typeStyle = {},
|
||||
transparent = false,
|
||||
dimInactive = false,
|
||||
terminalColors = true,
|
||||
colors = {
|
||||
palette = {},
|
||||
theme = { wave = {}, lotus = {}, dragon = {}, all = {} },
|
||||
},
|
||||
overrides = function(colors)
|
||||
return {}
|
||||
end,
|
||||
theme = "dragon",
|
||||
background = {
|
||||
dark = "dragon",
|
||||
light = "lotus"
|
||||
},
|
||||
})
|
||||
+62
-62
@@ -12,13 +12,13 @@ local function flatten_to_array(t)
|
||||
_flatten(t)
|
||||
return res
|
||||
end
|
||||
local cmp = require("cmp")
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
-- local cmp = require("cmp")
|
||||
-- local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities()
|
||||
vim.lsp.protocol.make_client_capabilities()
|
||||
-- cmp_lsp.default_capabilities()
|
||||
)
|
||||
|
||||
local cmp_kinds = {
|
||||
@@ -113,64 +113,64 @@ require("mason-lspconfig").setup({
|
||||
}
|
||||
})
|
||||
|
||||
cmp.setup {
|
||||
preselect = 'None',
|
||||
formatting = {
|
||||
fields = { 'kind', 'abbr' },
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = cmp_kinds[vim_item.kind] or ''
|
||||
if entry.completion_item.detail then
|
||||
vim_item.menu = entry.completion_item.detail
|
||||
end
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = "menu,menuone" },
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
}),
|
||||
}
|
||||
-- cmp.setup {
|
||||
-- preselect = 'None',
|
||||
-- formatting = {
|
||||
-- fields = { 'kind', 'abbr' },
|
||||
-- format = function(entry, vim_item)
|
||||
-- vim_item.kind = cmp_kinds[vim_item.kind] or ''
|
||||
-- if entry.completion_item.detail then
|
||||
-- vim_item.menu = entry.completion_item.detail
|
||||
-- end
|
||||
-- return vim_item
|
||||
-- end,
|
||||
-- },
|
||||
-- completion = { completeopt = "menu,menuone" },
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require("luasnip").lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
--
|
||||
-- mapping = {
|
||||
-- ["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
-- ["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
-- ["<C-Space>"] = cmp.mapping.complete(),
|
||||
-- ["<C-e>"] = cmp.mapping.close(),
|
||||
-- ["<CR>"] = cmp.mapping.confirm {
|
||||
-- behavior = cmp.ConfirmBehavior.Insert,
|
||||
-- select = true,
|
||||
-- },
|
||||
-- ["<Tab>"] = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
-- elseif require("luasnip").expand_or_jumpable() then
|
||||
-- require("luasnip").expand_or_jump()
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { "i", "s" }),
|
||||
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_prev_item()
|
||||
-- elseif require("luasnip").jumpable(-1) then
|
||||
-- require("luasnip").jump(-1)
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { "i", "s" }),
|
||||
-- },
|
||||
--
|
||||
-- sources = cmp.config.sources({
|
||||
-- { name = "path" },
|
||||
-- { name = "nvim_lsp" },
|
||||
-- { name = "luasnip" },
|
||||
-- { name = "buffer" },
|
||||
-- { name = "nvim_lua" },
|
||||
-- }),
|
||||
-- }
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- update_in_insert = true,
|
||||
|
||||
+24
-14
@@ -1,5 +1,7 @@
|
||||
local fn = vim.fn
|
||||
|
||||
local icons = require("assets.icons").icons
|
||||
|
||||
local get_active_lsp = function()
|
||||
local msg = ""
|
||||
local buf_ft = vim.api.nvim_get_option_value("filetype", {})
|
||||
@@ -40,18 +42,14 @@ local function ime_state()
|
||||
end
|
||||
|
||||
local diff = function()
|
||||
local git_status = vim.b.gitsigns_status_dict
|
||||
if git_status == nil then
|
||||
return
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
|
||||
local modify_num = git_status.changed
|
||||
local remove_num = git_status.removed
|
||||
local add_num = git_status.added
|
||||
|
||||
local info = { added = add_num, modified = modify_num, removed = remove_num }
|
||||
-- vim.print(info)
|
||||
return info
|
||||
end
|
||||
|
||||
local virtual_env = function()
|
||||
@@ -119,11 +117,16 @@ require("lualine").setup {
|
||||
{
|
||||
"filename",
|
||||
symbols = {
|
||||
readonly = "[]",
|
||||
readonly = "[ ]",
|
||||
},
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = icons.git.added,
|
||||
modified = icons.git.modified,
|
||||
removed = icons.git.removed,
|
||||
},
|
||||
source = diff,
|
||||
},
|
||||
{
|
||||
@@ -151,7 +154,12 @@ require("lualine").setup {
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warn,
|
||||
info = icons.diagnostics.Info,
|
||||
hint = icons.diagnostics.Hint
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
@@ -167,7 +175,9 @@ require("lualine").setup {
|
||||
"filetype",
|
||||
},
|
||||
lualine_z = {
|
||||
"progress",
|
||||
{
|
||||
"location",
|
||||
},
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
require("monokai-pro").setup({
|
||||
transparent_background = false,
|
||||
terminal_colors = true,
|
||||
devicons = true,
|
||||
styles = {
|
||||
comment = { italic = true },
|
||||
keyword = { italic = true },
|
||||
type = { italic = true },
|
||||
storageclass = { italic = true },
|
||||
structure = { italic = true },
|
||||
parameter = { italic = true },
|
||||
annotation = { italic = true },
|
||||
tag_attribute = { italic = true },
|
||||
},
|
||||
filter = "pro",
|
||||
|
||||
day_night = {
|
||||
enable = false,
|
||||
day_filter = "pro",
|
||||
night_filter = "spectrum",
|
||||
},
|
||||
inc_search = "background",
|
||||
background_clear = {
|
||||
},
|
||||
plugins = {
|
||||
bufferline = {
|
||||
underline_selected = false,
|
||||
underline_visible = false,
|
||||
},
|
||||
indent_blankline = {
|
||||
context_highlight = "default",
|
||||
context_start_underline = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -60,7 +60,7 @@ return {
|
||||
notifier = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
scroll = { enabled = true },
|
||||
scroll = { enabled = false },
|
||||
statuscolumn = { enabled = true },
|
||||
words = { enabled = true },
|
||||
terminal = {
|
||||
|
||||
Reference in New Issue
Block a user