Merge branch 'master' of gitea.srvlan:blob42/my-nvim-lua

master
blob42 10 months ago
commit 5e660449fe

@ -20,7 +20,12 @@ local highlights = {
St_file_sep_rev = { St_file_sep_rev = {
fg = colors.statusline_bg, fg = colors.statusline_bg,
bg = colors.lightbg, bg = colors.lightbg,
} },
DiagnosticUnderlineError = {
fg = c.change_hex_lightness(colors["red"], 5),
underline = true,
},
} }
function set_hl() function set_hl()

@ -1,6 +1,9 @@
-- n, v, i, t, c = mode name.s -- n, v, i, t, c = mode name.s
local opt = vim.opt
local g = vim.g
local function termcodes(str) local function termcodes(str)
return vim.api.nvim_replace_termcodes(str, true, true, true) return vim.api.nvim_replace_termcodes(str, true, true, true)
end end
@ -97,11 +100,37 @@ M.general = { --{{{
["<leader>Y"] = { "<cmd> %y+ <CR>", "copy whole file" }, ["<leader>Y"] = { "<cmd> %y+ <CR>", "copy whole file" },
-- line numbers -- line numbers
["<BS>n"] = { "<cmd> set nu!<CR><cmd> set rnu!<CR>", "toggle line number" }, ["<BS>N"] = { "<cmd> set nu!<CR><cmd> set rnu!<CR>", "toggle line number" },
["<BS>ts"] = {function()
if g.sign_column_enbaled then
opt.signcolumn="no"
g.sign_column_enbaled = false
else
opt.signcolumn="yes"
g.sign_column_enbaled = true
end
end, "toggle sign column" },
["<BS>z"] = { function()
require("spike.utils").zenmode()
end, "silent mode (no distraction)" },
["<BS>Z"] = { function()
require("spike.utils").zenmode(true)
end, "maximum zen" },
["<BS>qz"] = { function()
require("spike.utils").exitzen()
end, "exit zen" },
["<BS>zz"] = { function()
require("spike.utils").togglezen()
end, "toggle zen" },
-- option toggle cursor line -- option toggle cursor line
["<BS>l"] = { "<cmd> set cul!<CR>", "toggle cursor line" }, ["<BS>l"] = { "<cmd> set cul!<CR>", "toggle cursor line" },
["<BS>c"] = { "<cmd>cclose<CR><cmd>lclose<CR>", "close quickfix" }, ["<BS>c"] = { "<cmd>cclose<CR><cmd>lclose<CR>", "close quickfix" },
["<BS>d"] = { "<cmd>DelayTrainToggle<CR>", "disable delay train" }, ["<BS>d"] = { "<cmd>DelayTrainToggle<CR>", "disable delay train" },
@ -143,6 +172,15 @@ M.general = { --{{{
}, },
["<leader>tT"] = {
function()
require("base46").toggle_transparency()
end,
"toggle transparency",
},
-- luasnip edit snippets -- luasnip edit snippets
["<leader>sne"] = { ["<leader>sne"] = {
@ -1122,9 +1160,20 @@ M.navigator = {
M.refactoring = { M.refactoring = {
plugin = true, plugin = true,
v = { x = {
["<leader>rr"] = {":lua require'refactoring'.select_refactor()<CR>", "refactoring using telescope", opts = { expr = false }}, ["<leader>rr"] = {
} function()
require('telescope').extensions.refactoring.refactors()
end,
"refactoring using telescope", opts = { expr = false }},
},
n = {
["<leader>rr"] = {
function()
require('telescope').extensions.refactoring.refactors()
end,
"refactoring using telescope", opts = { expr = false }},
},
} }
M.null_ls = { M.null_ls = {

@ -25,7 +25,7 @@ opt.showmode = false
opt.title = true opt.title = true
opt.clipboard = "unnamed" opt.clipboard = "unnamed"
opt.cul = true -- cursor line opt.cul = false -- cursor line
-- opt.colorcolumn = "80" -- opt.colorcolumn = "80"
opt.colorcolumn = '+0' -- make colorcolumn follow text width opt.colorcolumn = '+0' -- make colorcolumn follow text width
opt.textwidth = 80 opt.textwidth = 80
@ -77,7 +77,7 @@ opt.foldlevelstart = 1
opt.conceallevel=1 -- how to show text with :syn-conceal syntax opt.conceallevel=1 -- how to show text with :syn-conceal syntax
opt.list = true -- show tabs,trailing spaces and non-breakable spaces opt.list = true -- show tabs,trailing spaces and non-breakable spaces
opt.listchars = "tab: ,trail:,extends:#,nbsp:⋅,eol:" -- Highlight problematic whitespace opt.listchars = "tab: ,trail:,extends:#,nbsp:⋅,eol:" -- Highlight problematic whitespace
opt.diffopt:append("vertical") opt.diffopt:append("vertical")
opt.completeopt = "menu,menuone,noselect" opt.completeopt = "menu,menuone,noselect"
opt.wrap = false opt.wrap = false

@ -18,9 +18,9 @@ local highlights = require "custom.highlights"
M.ui = { M.ui = {
-- theme = "gruvbox_material", -- theme = "gruvbox_material",
-- theme = "ayu-dark", -- theme = "ayu-dark",
theme = "catppuccin", theme = "chadracula",
theme_toggle = { "gruvbox_material", "gruvbox_light" }, theme_toggle = { "catppuccin", "chadracula"},
transparency = true, -- transparency = true,
hl_override = highlights.override, hl_override = highlights.override,
hl_add = highlights.add, hl_add = highlights.add,
-- hl_override = { -- hl_override = {
@ -31,9 +31,9 @@ M.ui = {
myicons = { myicons = {
lsp = { lsp = {
diagnostic_head = '', -- default diagnostic head on dialogs diagnostic_head = '', -- default diagnostic head on dialogs
diagnostic_err = '', -- severity 1 diagnostic_err = '', -- severity 1
diagnostic_warn = '', -- 2 diagnostic_warn = '', -- 2
diagnostic_info = '', -- 3 diagnostic_info = '', -- 3
diagnostic_hint = '', -- 4 diagnostic_hint = '', -- 4
} }
}, },

@ -37,6 +37,9 @@ M.override = {
St_LspInfo = { St_LspInfo = {
fg = "white" fg = "white"
}, },
St_LspStatus = {
fg = "sun"
},
LineNr = { LineNr = {
fg = "#5f4468" fg = "#5f4468"
}, },
@ -65,10 +68,11 @@ M.add = {
fg = "white", fg = "white",
italic = true, italic = true,
}, },
DiagnosticUnderlineError = { -- Definied in custom theme parameters (after/plugin/theme.lua)
fg = "black", -- DiagnosticUnderlineError = {
bg = "pink", -- fg = "red",
}, -- underline = true,
-- },
-- Code Lens related colors -- Code Lens related colors
LspCodeLens = { LspCodeLens = {
fg = "vibrant_green", fg = "vibrant_green",

@ -13,9 +13,17 @@ M.setup = function()
python = "Use pytest framework." python = "Use pytest framework."
} }
}, },
["code4"] = {
system_message_template = "You are a Programming pair Assistant AI. You are helpful with improving and optimizing source code using the best idiomatic practicies.",
model = "gpt-4",
user_message_template = "I have the following {{language}} code: ```{{filetype}}\n{{text_selection}}```\n{{command_args}}. {{language_instructions}} Think step by step then only return the code snippet and nothing else."
},
["docu4"] = { ["docu4"] = {
system_message_template = "You are a technical documentation assistant to a software developer. You will help improving project documentation.", language_instructions = {
user_message_template = "Improve the following text: ```{{text_selection}}```\n. Use a professional. Write as if you are writing a python project documentation for a Github repo. {{command_args}}", python = "Use docstings to document the code. This project uses Sphinx. Use the google style python docstrings. Add sphinx directives if needed."
},
system_message_template = "You are a technical documentation assistant to a software developer. Help the user write clean detailed and easy to read project documentation.",
user_message_template = "Create or improve the documentation for: ```{{text_selection}}```\n. Use a professional tone. {{language_instructions}} {{command_args}}",
model = "gpt-4" model = "gpt-4"
}, },
} }

@ -1,5 +1,6 @@
local present, navigator = pcall(require, "navigator") local present, navigator = pcall(require, "navigator")
if not present then if not present then
return return
end end
@ -18,6 +19,8 @@ local get_current_gomod = function()
return mod_name return mod_name
end end
-- default config
-- "~/.local/share/nvim/site/pack/packer/opt/navigator.lua/lua/navigator.lua"
local config = { local config = {
debug = false, debug = false,
transparency = 5, transparency = 5,
@ -32,7 +35,8 @@ local config = {
{ key = 'gW', func = require('navigator.workspace').workspace_symbol_live, desc = 'lsp workspace_symbol_live' }, { key = 'gW', func = require('navigator.workspace').workspace_symbol_live, desc = 'lsp workspace_symbol_live' },
{ key = '<c-]>', func = require('navigator.definition').definition, desc = 'lsp definition' }, { key = '<c-]>', func = require('navigator.definition').definition, desc = 'lsp definition' },
{ key = 'gd', func = require('navigator.definition').definition, desc = 'lsp definition' }, { key = 'gd', func = require('navigator.definition').definition, desc = 'lsp definition' },
{ key = 'gp', func = require('navigator.definition').definition_preview, desc = 'lsp definition_preview' }, { key = 'gp', func = require('navigator.definition').definition_preview, desc = 'lsp definition preview' },
{ key = 'gP', func = require('navigator.definition').type_definition_preview, desc = 'lsp type definition preview' },
-- handled by main mappings -- handled by main mappings
-- { key = '<Leader>gt', func = require('navigator.treesitter').buf_ts, desc = 'lsp buf_ts' }, -- { key = '<Leader>gt', func = require('navigator.treesitter').buf_ts, desc = 'lsp buf_ts' },
-- { key = '<Leader>gT', func = require('navigator.treesitter').bufs_ts, desc = 'lsp bufs_ts' }, -- { key = '<Leader>gT', func = require('navigator.treesitter').bufs_ts, desc = 'lsp bufs_ts' },
@ -97,16 +101,16 @@ local config = {
icons = { icons = {
icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon) icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon)
-- Code action -- Code action
code_action_icon = ' ', -- "", code_action_icon = '', -- "",
-- code lens -- code lens
code_lens_action_icon = '', code_lens_action_icon = '',
-- Diagnostics -- Diagnostics
diagnostic_head = '', -- default diagnostic head on dialogs diagnostic_head = '', -- default diagnostic head on dialogs
diagnostic_err = '', -- severity 1 diagnostic_err = '', -- severity 1
diagnostic_warn = '', -- 2 diagnostic_warn = '', -- 2
diagnostic_info = '', -- 3 diagnostic_info = '', -- 3
diagnostic_hint = '', -- 4 diagnostic_hint = '', -- 4
-- used in the diagnostics summary window -- used in the diagnostics summary window
@ -115,7 +119,7 @@ local config = {
diagnostic_head_severity_3 = 'i', diagnostic_head_severity_3 = 'i',
diagnostic_head_description = ' ', diagnostic_head_description = ' ',
diagnostic_virtual_text = '', diagnostic_virtual_text = '',
diagnostic_file = '🚑', diagnostic_file = '',
-- Values -- Values
-- --
@ -143,7 +147,7 @@ local config = {
module = '', module = '',
flag = '', flag = '',
}, },
treesitter_defult = '🌲', treesitter_defult = '',
doc_symbols = '', doc_symbols = '',
}, },
mason = true, mason = true,
@ -162,6 +166,11 @@ local config = {
severity_sort = { reverse = false }, severity_sort = { reverse = false },
}, },
code_action = {
delay = 5000, -- 5 sec delay
virtual_text_icon = false,
},
diagnostic_scrollbar_sign = false, diagnostic_scrollbar_sign = false,
display_diagnostic_qf = false, display_diagnostic_qf = false,

@ -22,6 +22,8 @@ local config = {
c = true, c = true,
java = true, java = true,
}, },
printf_statements = {},
print_var_statements = {},
} }
M.setup = function() M.setup = function()

@ -16,6 +16,7 @@ local config = {
WIP = { color = "default"}, WIP = { color = "default"},
NOTE = { alt = { "TIP", "INFO", "TRICK", "RELEASE"}}, NOTE = { alt = { "TIP", "INFO", "TRICK", "RELEASE"}},
DEBUG = {}, DEBUG = {},
REVIEW = { color = "info" }
}, },
colors = { colors = {
-- info = {"#2563EB"}, -- info = {"#2563EB"},

@ -48,10 +48,10 @@ return {
-- } -- }
-- }, -- },
-- --
rainbow = { -- rainbow = {
enable = true, -- enable = true,
extended_mode = true, -- extended_mode = true,
}, -- },
textobjects = { textobjects = {
enable = true, enable = true,

@ -132,6 +132,7 @@ return {
-- Code Refactoring -- Code Refactoring
["ThePrimeagen/refactoring.nvim"] = { ["ThePrimeagen/refactoring.nvim"] = {
module = {"refactoring"},
setup = function() setup = function()
require("core.utils").load_mappings "refactoring" require("core.utils").load_mappings "refactoring"
end, end,

@ -98,7 +98,11 @@ return {
hints = (hints and hints > 0) and ("%#St_lspHints#" .. myicons.lsp.diagnostic_hint .. " " .. hints .. " ") or "" hints = (hints and hints > 0) and ("%#St_lspHints#" .. myicons.lsp.diagnostic_hint .. " " .. hints .. " ") or ""
info = (info and info > 0) and ("%#St_lspInfo#" .. myicons.lsp.diagnostic_info .. " " .. info .. " ") or "" info = (info and info > 0) and ("%#St_lspInfo#" .. myicons.lsp.diagnostic_info .. " " .. info .. " ") or ""
return errors .. warnings .. hints .. info if vim.o.columns > 120 then
return errors .. warnings .. hints .. info
else
return ""
end
end, end,
LSP_progress = function() LSP_progress = function()
@ -134,7 +138,7 @@ return {
if rawget(vim, "lsp") then if rawget(vim, "lsp") then
for _, client in ipairs(vim.lsp.get_active_clients()) do for _, client in ipairs(vim.lsp.get_active_clients()) do
if client.attached_buffers[vim.api.nvim_get_current_buf()] then if client.attached_buffers[vim.api.nvim_get_current_buf()] then
lsp_status = (vim.o.columns > 100 and "%#St_LspStatus#" .. "[" .. client.name .. "] ") or " " lsp_status = (vim.o.columns > 100 and "%#St_LspStatus#" .. "[" .. client.name .. "]") or "%#St_LspStatus#" .. " "
end end
end end
end end
@ -164,6 +168,25 @@ return {
text = '%l,%c%V%\\ %p%%' text = '%l,%c%V%\\ %p%%'
return "%#St_pos_text#" .. " " .. text .. " " return "%#St_pos_text#" .. " " .. text .. " "
end,
git = function()
if not vim.b.gitsigns_head or vim.b.gitsigns_git_status then
return ""
end
local git_status = vim.b.gitsigns_status_dict
local added = (git_status.added and git_status.added ~= 0) and ("" .. git_status.added) or ""
local changed = (git_status.changed and git_status.changed ~= 0) and ("" .. git_status.changed) or ""
local removed = (git_status.removed and git_status.removed ~= 0) and ("" .. git_status.removed) or ""
local branch_name = "" .. git_status.head .. " "
if vim.o.columns > 120 then
return "%#St_gitIcons#" .. branch_name .. added .. changed .. removed
else
return ""
end
end end
} }

@ -56,6 +56,8 @@ local config = {
S = { S = {
rhs = function() rhs = function()
daputils.disconnect_dap() daputils.disconnect_dap()
M.layer:exit()
vim.cmd("redrawstatus")
end, end,
desc = '[dap] stop' desc = '[dap] stop'
}, },

@ -1,5 +1,7 @@
local autocmd = vim.api.nvim_create_autocmd local autocmd = vim.api.nvim_create_autocmd
local api = vim.api local api = vim.api
local opt = vim.opt
local g = vim.g
local M = {} local M = {}
M["unload_lua_ns"] = function (prefix) M["unload_lua_ns"] = function (prefix)
@ -86,6 +88,56 @@ M.lazy_load_module = function(patterns, plugin)
}) })
end end
M.togglezen = function()
if g.zenmode then
M.exitzen()
else
M.zenmode(true)
end
end
--- disable all clutter from UI
---@param full? boolean maximum zen
M.zenmode = function(full)
opt.colorcolumn= '0'
g.indent_blankline_show_current_context = false
local ok, indent = pcall(require, "indent_blankline")
if ok then
indent.refresh()
end
opt.listchars:remove("eol")
opt.listchars:append("tab: ")
vim.cmd("TSDisable highlight")
if full then
opt.signcolumn = 'no'
opt.number = false
opt.relativenumber = false
-- opt.listchars:append("tab: ")
-- opt.listchars:remove("eol")
opt.fillchars:append("eob: ")
opt.cmdheight = 0
end
g.zenmode = true
end
--- cancel zenmode
M.exitzen = function()
opt.colorcolumn= '+0'
opt.signcolumn = 'yes'
g.indent_blankline_show_current_context = true
local ok, indent = pcall(require, "indent_blankline")
if ok then
indent.refresh()
end
opt.listchars:append("eol:")
opt.listchars:append("tab: ")
opt.number = true
opt.relativenumber = true
opt.fillchars:append("eob:")
opt.cmdheight = 1
g.zenmode = false
vim.cmd("TSEnable highlight")
end
return M return M

Loading…
Cancel
Save