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

master
blob42 9 months ago
commit 5e660449fe

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

@ -1,6 +1,9 @@
-- n, v, i, t, c = mode name.s
local opt = vim.opt
local g = vim.g
local function termcodes(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
@ -97,11 +100,37 @@ M.general = { --{{{
["<leader>Y"] = { "<cmd> %y+ <CR>", "copy whole file" },
-- 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
["<BS>l"] = { "<cmd> set cul!<CR>", "toggle cursor line" },
["<BS>c"] = { "<cmd>cclose<CR><cmd>lclose<CR>", "close quickfix" },
["<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
["<leader>sne"] = {
@ -1122,9 +1160,20 @@ M.navigator = {
M.refactoring = {
plugin = true,
v = {
["<leader>rr"] = {":lua require'refactoring'.select_refactor()<CR>", "refactoring using telescope", opts = { expr = false }},
}
x = {
["<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 = {

@ -25,7 +25,7 @@ opt.showmode = false
opt.title = true
opt.clipboard = "unnamed"
opt.cul = true -- cursor line
opt.cul = false -- cursor line
-- opt.colorcolumn = "80"
opt.colorcolumn = '+0' -- make colorcolumn follow text width
opt.textwidth = 80
@ -77,7 +77,7 @@ opt.foldlevelstart = 1
opt.conceallevel=1 -- how to show text with :syn-conceal syntax
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.completeopt = "menu,menuone,noselect"
opt.wrap = false

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

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

@ -13,9 +13,17 @@ M.setup = function()
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"] = {
system_message_template = "You are a technical documentation assistant to a software developer. You will help improving project documentation.",
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}}",
language_instructions = {
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"
},
}

@ -1,5 +1,6 @@
local present, navigator = pcall(require, "navigator")
if not present then
return
end
@ -18,6 +19,8 @@ local get_current_gomod = function()
return mod_name
end
-- default config
-- "~/.local/share/nvim/site/pack/packer/opt/navigator.lua/lua/navigator.lua"
local config = {
debug = false,
transparency = 5,
@ -32,7 +35,8 @@ local config = {
{ 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 = '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
-- { 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' },
@ -97,16 +101,16 @@ local config = {
icons = {
icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon)
-- Code action
code_action_icon = ' ', -- "",
code_action_icon = '', -- "",
-- code lens
code_lens_action_icon = '',
-- Diagnostics
diagnostic_head = '', -- default diagnostic head on dialogs
diagnostic_err = '', -- severity 1
diagnostic_err = '', -- severity 1
diagnostic_warn = '', -- 2
diagnostic_info = '', -- 3
diagnostic_info = '', -- 3
diagnostic_hint = '', -- 4
-- used in the diagnostics summary window
@ -115,7 +119,7 @@ local config = {
diagnostic_head_severity_3 = 'i',
diagnostic_head_description = ' ',
diagnostic_virtual_text = '',
diagnostic_file = '🚑',
diagnostic_file = '',
-- Values
--
@ -143,7 +147,7 @@ local config = {
module = '',
flag = '',
},
treesitter_defult = '🌲',
treesitter_defult = '',
doc_symbols = '',
},
mason = true,
@ -162,6 +166,11 @@ local config = {
severity_sort = { reverse = false },
},
code_action = {
delay = 5000, -- 5 sec delay
virtual_text_icon = false,
},
diagnostic_scrollbar_sign = false,
display_diagnostic_qf = false,

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

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

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

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

@ -98,7 +98,11 @@ return {
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 ""
return errors .. warnings .. hints .. info
if vim.o.columns > 120 then
return errors .. warnings .. hints .. info
else
return ""
end
end,
LSP_progress = function()
@ -134,7 +138,7 @@ return {
if rawget(vim, "lsp") then
for _, client in ipairs(vim.lsp.get_active_clients()) do
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
@ -164,6 +168,25 @@ return {
text = '%l,%c%V%\\ %p%%'
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
}

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

@ -1,5 +1,7 @@
local autocmd = vim.api.nvim_create_autocmd
local api = vim.api
local opt = vim.opt
local g = vim.g
local M = {}
M["unload_lua_ns"] = function (prefix)
@ -86,6 +88,56 @@ M.lazy_load_module = function(patterns, plugin)
})
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

Loading…
Cancel
Save