Merge branch 'master' into mobile-synx

This commit is contained in:
Christoph J. Scherr 2024-05-29 11:58:29 +02:00
commit e608db2e58
17 changed files with 1137 additions and 183 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ coc-settings.json
lazy-lock.json
after
**/.DS_Store
lua/custom/secret

View File

@ -71,42 +71,6 @@ autocmd("FileType", {
end,
})
-- reload some chadrc options on-save
autocmd("BufWritePost", {
pattern = vim.tbl_map(function(path)
return vim.fs.normalize(vim.loop.fs_realpath(path))
end, vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)),
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
callback = function(opts)
local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]]
local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim"
local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".")
require("plenary.reload").reload_module "base46"
require("plenary.reload").reload_module(module)
require("plenary.reload").reload_module "custom.chadrc"
config = require("core.utils").load_config()
vim.g.nvchad_theme = config.ui.theme
vim.g.transparency = config.ui.transparency
-- statusline
require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme)
vim.opt.statusline = "%!v:lua.require('nvchad.statusline." .. config.ui.statusline.theme .. "').run()"
-- tabufline
if config.ui.tabufline.enabled then
require("plenary.reload").reload_module "nvchad.tabufline.modules"
vim.opt.tabline = "%!v:lua.require('nvchad.tabufline.modules').run()"
end
require("base46").load_all_highlights()
-- vim.cmd("redraw!")
end,
})
-------------------------------------- commands ------------------------------------------
local new_cmd = vim.api.nvim_create_user_command

View File

@ -5,8 +5,8 @@ local M = {}
local highlights = require "custom.highlights"
M.ui = {
theme = "chadracula",
theme_toggle = { "kanagawa", "chadracula" },
theme = "oceanic-next",
theme_toggle = { "oceanic-next", "ayu_light" },
hl_override = highlights.override,
hl_add = highlights.add,
@ -64,7 +64,8 @@ local get_info = function()
},
{ " Mappings", "<space>ch", "NvCheatsheet" },
{ " Git", "<space>gg", "LazyGit" },
{ " Files", "<F5>", "NvimTreeToggle" },
{ " Files", "<F5>", "NvimTreeToggle" },
{ " Change Directory", ";cd", "Telescope zoxide list" },
{ " Terminal", "<A-i>", "ToggleTerm direction=float" },
}
return buf

View File

@ -9,6 +9,11 @@ local options = {
html = { "prettier" },
sh = { "shfmt" },
toml = { "taplo" },
rust = { "rustfmt" },
tex = { "latexindent" },
latex = { "latexindent" },
},
-- adding same formatter for multiple filetypes can look too much work for some

View File

@ -2,6 +2,7 @@ local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
local lspsettings = require "custom.configs.lspsettings"
-- if you just want default config for the servers then put them in a table
local servers = {
@ -10,9 +11,11 @@ local servers = {
"tsserver",
"clangd",
"pyright",
"rust_analyzer",
"bashls",
"cmake",
"yamlls",
"texlab",
"csharp_ls",
}
for _, lsp in ipairs(servers) do
@ -21,3 +24,13 @@ for _, lsp in ipairs(servers) do
capabilities = capabilities,
}
end
local server_with_settings = {
-- "textlsp",
"ltex",
"rust_analyzer",
}
for _, lsp in ipairs(server_with_settings) do
lspconfig[lsp].setup(lspsettings[lsp])
end

View File

@ -0,0 +1,195 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local M = {}
M.rust_analyzer = {
on_attach = on_attach,
capabilities = capabilities,
settings = {
["rust-analyzer"] = {
check = {
command = "clippy",
},
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}
M.ltex = {
on_attach = on_attach,
capabilities = capabilities,
use_spellfile = false,
settings = {
ltex = {
checkFrequency = "save", -- shut up while i'm just editing, see <https://github.com/folke/noice.nvim/issues/166>
-- specific language (such as en-GB or de-DE is recommended, but I
-- want multilingual)
language = "auto",
enabled = {
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
-- "html",
-- "xhtml",
},
additionalRules = {
enablePickyRules = true,
-- thats cool, but often adds diagnostics in
-- places where a german might confuse words that are similar
-- between english and german REGARDLESS of context. I seem to use the
-- english words only in the proper contexts, so leaving this on
-- just adds annoying hints like 'Hinweis: "list/NN.*" (English) bedeutet "Liste",
-- "Verzeichnis" (German). Meinten Sie vielleicht 'cunning', 'trick'?'
-- everytime I use the word "list". I liked that this makes the hints be
-- in german regardless of the language I'm working in through...
--motherTongue = "de",
},
-- load token and additional languagetool items later
},
},
}
M.textlsp = {
on_attach = on_attach,
capabilities = capabilities,
filetypes = {
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
settings = {
textLSP = {
analysers = {
languagetool = {
enabled = true,
check_text = {
on_open = true,
on_save = true,
on_change = false,
},
},
gramformer = {
-- gramformer dependency needs to be installed manually
enabled = true,
gpu = false,
check_text = {
on_open = false,
on_save = true,
on_change = false,
},
},
hf_checker = {
enabled = false,
gpu = false,
quantize = 32,
model = "pszemraj/flan-t5-large-grammar-synthesis",
min_length = 40,
check_text = {
on_open = false,
on_save = true,
on_change = false,
},
},
hf_instruction_checker = {
enabled = true,
gpu = false,
quantize = 32,
model = "grammarly/coedit-large",
min_length = 40,
check_text = {
on_open = false,
on_save = true,
on_change = false,
},
},
hf_completion = {
enabled = true,
gpu = false,
quantize = 32,
model = "bert-base-multilingual-cased",
topk = 5,
},
-- openai = {
-- enabled = false,
-- api_key = "<MY_API_KEY>",
-- check_text = {
-- on_open = false,
-- on_save = false,
-- on_change = false,
-- },
-- model = "gpt-3.5-turbo",
-- max_token = 16,
-- },
-- grammarbot = {
-- enabled = false,
-- api_key = "<MY_API_KEY>",
-- -- longer texts are split, this parameter sets the maximum number of splits per analysis
-- input_max_requests = 1,
-- check_text = {
-- on_open = false,
-- on_save = false,
-- on_change = false,
-- },
-- },
},
documents = {
-- org = {
-- org_todo_keywords = {
-- "TODO",
-- "IN_PROGRESS",
-- "DONE",
-- },
-- },
txt = {
parse = true,
},
},
},
},
}
-- load secrets
-- the secret module should just return a string with the token
local available, token = require("custom.utils").try_require "custom.secret.languagetool_token"
if available then
M.ltex.languageToolOrg = {
apiKey = token,
username = "accounts@cscherr.de",
languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/",
}
M.ltex.languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/"
end
return M

View File

@ -30,38 +30,25 @@ M.treesitter = {
M.mason = {
ensure_installed = {
-- general purpose
"purpose",
-- lua stuff
"lua-language-server",
"stylua",
-- web dev stuff
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
"prettier",
-- c/cpp stuff
"clangd",
"clang-format",
"cmake-language-server",
-- rust
"rust-analyzer",
"taplo",
-- python
"pyright",
-- english??
"write-good",
-- shell
"shellcheck",
"bash-language-server",
"ltex-ls",
"shellcheck",
"taplo",
},
}

View File

@ -7,16 +7,19 @@ local M = {}
---@type Base46HLGroupsList
M.override = {
Comment = {
italic = true,
},
NvDashAscii = {
fg = "#b33366",
bg = "#1a1a1a",
},
NvDashButtons = {
fg = "White",
bg = "#241e1e",
italic = false,
},
-- NvDashAscii = {
-- fg = "#b33366",
-- bg = "#1a1a1a",
-- },
-- NvDashButtons = {
-- fg = "White",
-- bg = "#241e1e",
-- },
TodoFgNOTE = {
fg = "#cccccc"
}
}
---@type HLTable

View File

@ -1,9 +1,10 @@
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
g.python3_host_prog = "/usr/bin/python3"
opt.mouse = "a" -- mouse does annoying things for me if it's not 'a'
opt.signcolumn = "yes"
opt.spelllang = "en,de"
opt.clipboard = "" -- don't just use the system clipboard
opt.wrap = false
opt.breakindent = false
@ -29,10 +30,16 @@ opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
-- Timing
-- ===
-- NOTE: the which-key plugin makes this a little different. Instead of going
-- to a newline after "o", the which-key panel opens. Only when we input
-- something other than "o" it will go to the line and write that. I don't
-- really like this behavior. We can disable this for specific triggers.
-- See https://github.com/folke/which-key.nvim
opt.timeout = true
opt.ttimeout = true
opt.timeoutlen = 500 -- Time out on mappings
opt.timeoutlen = 250 -- Time out on mappings
opt.ttimeoutlen = 10 -- Time out on key codes
opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold
opt.updatetime = 300 -- Idle time to write swap and trigger CursorHold
-- Searching
-- ===
@ -62,7 +69,7 @@ opt.wildmode = "longest:full,full" -- Command-line completion mode
-- Folds
-- ===
opt.foldlevel = 10000 -- start with all folds open
opt.foldlevel = 10 -- start with all folds open
-- Editor UI
-- ===
@ -75,6 +82,7 @@ opt.scrolloff = 2 -- Keep at least n lines above/below
opt.sidescrolloff = 0 -- Keep at least n lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = true -- Show line numbers
opt.relativenumber = true -- Show relative line numbers
opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters
opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
@ -83,6 +91,24 @@ opt.laststatus = 3 -- Always show laststatus
if vim.g.started_by_firenvim == true then
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
opt.laststatus = 1 -- Don't show laststatus in firenvim
opt.wrap = true
end
if vim.g.neovide == true then
-- fulscreen with F11
vim.api.nvim_set_keymap("n", "<F11>", ":let g:neovide_fullscreen = !g:neovide_fullscreen<CR>", {})
vim.g.neovide_underline_automatic_scaling = true
-- vim.g.neovide_floating_blur_amount_x = 2.0
-- vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_scroll_animation_length = 0.1
-- vim.g.neovide_cursor_animation_length = 0
-- vim.g.neovide_cursor_trail_size = 0
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_fullscreen = true
end
opt.helpheight = 0 -- Disable help window resizing
@ -104,6 +130,13 @@ opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.pumwidth = 10 -- Minimum width for the popup menu
opt.pumblend = 10 -- Popup blend
-- Spelling correction
-- ===
opt.spell = false -- manually enable spell with `set spell` or `<leader>ts`
opt.spelllang = "en,de_de,"
opt.spellsuggest = "double,50,timeout:5000"
-- autocommands
-- ===
local function augroup(name)
@ -136,12 +169,15 @@ vim.api.nvim_create_autocmd("VimResized", {
})
-- Wrap and enable spell-checker in text filetypes
-- also enable wrap on these text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup "spell_conceal",
pattern = { "gitcommit", "markdown", "tex", "latex", "norg" },
callback = function()
vim.opt_local.spell = true
vim.opt_local.conceallevel = 0
vim.opt.wrap = true
-- vim.opt.formatoptions = ""
end,
})
@ -154,3 +190,7 @@ if vim.g.started_by_firenvim == true then
vim.o.lines = vim.o.lines - 1
end, { expr = true, desc = "Make Display smaller" })
end
-- alias filetypes
vim.filetype.add { extension = { tera = "html" } }
vim.filetype.add { extension = { plaintex = "tex" } }

View File

@ -1,4 +1,5 @@
---@type MappingsTable
local M = {}
-- NOTE: The mappings here are case sensitive!!! Removing a specific default
@ -40,7 +41,6 @@ M.disabled = {
["<leader>td"] = "",
["<leader>wk"] = "",
["#"] = "",
["?"] = "",
},
t = {
["<C-t>"] = "",
@ -206,6 +206,9 @@ M.telescope = {
["<localleader>fo"] = { "<cmd> Telescope oldfiles <cr>", "Find oldfiles" },
["<localleader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <cr>", "Find in current buffer" },
-- directory
["<localleader>cd"] = { "<cmd> Telescope zoxide list<cr>", "telescope zoxide cd" },
-- git
["<localleader>cm"] = { "<cmd> Telescope git_commits <cr>", "Git commits" },
["<localleader>gt"] = { "<cmd> Telescope git_status <cr>", "Git status" },
@ -217,6 +220,14 @@ M.telescope = {
["<localleader>th"] = { "<cmd> Telescope themes <cr>", "Nvchad themes" },
["<localleader>ma"] = { "<cmd> Telescope marks <cr>", "telescope bookmarks" },
-- lsp stuff
["<localleader>cw"] = {
"<cmd> Telescope lsp_dynamic_workspace_symbols <cr>",
"telescope dynamic workspace symbols",
},
["<localleader>cf"] = { "<cmd> Telescope lsp_document_symbols <cr>", "telescope document symbols" },
["<localleader>ci"] = { "<cmd> Telescope diagnostics <cr>", "telescope diagnostics" },
},
}
@ -224,45 +235,89 @@ M.toggleterm = {
plugin = true,
n = {
["<F12>"] = {
"<cmd>ToggleTerm direction=float<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
"<cmd>ToggleTerm direction=float<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
"<cmd>ToggleTerm direction=tab<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
"<cmd>ToggleTerm direction=horizontal<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
"<cmd>ToggleTerm direction=vertical<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
i = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
t = {
["<F12>"] = {
"<cmd>ToggleTerm direction=float<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
"<cmd>ToggleTerm direction=float<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
"<cmd>ToggleTerm direction=tab<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
"<cmd>ToggleTerm direction=horizontal<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
"<cmd>ToggleTerm direction=vertical<cr>",
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
x = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
@ -274,6 +329,7 @@ M.nvimtree = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<F5>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<leader>tf"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
-- focus
["<localleader>e"] = { "<cmd> NvimTreeFocus <cr>", "Focus nvimtree" },
@ -306,12 +362,13 @@ M.movements = {
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
-- go to mark with "#"
["#"] = { "'", "go to mark" },
-- spell
["]s"] = { "]s", "go to next spelling mark" },
["[s"] = { "[s", "go to last spelling mark" },
-- just scroll a line
["zk"] = { "<C-y>", "scroll up a line" },
["zj"] = { "<C-e>", "scroll down a line" },
},
v = {
--big move
@ -327,6 +384,10 @@ M.movements = {
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
"Escape terminal mode",
},
["<C-S-v>"] = {
'<C-w>"+pi',
"paste into terminal",
},
},
}
@ -334,25 +395,27 @@ M.edit = {
plugin = false,
n = {
-- easy newline
["OO"] = { "O<esc>", "insert a line above", opts = { nowait = false } },
["oo"] = { "o<esc>", "insert a line below", opts = { nowait = false } },
["OO"] = { "O<esc>", "insert a line above" },
["oo"] = { "o<esc>", "insert a line below" },
-- substitute (change hovered/selection with insert mode)
-- normally, this is s, but that is leaps binding now
["<leader>s"] = { "s", "replace with insert mode" },
-- split and join lines
-- "J" for join is defaul
["S"] = {
"i<cr><esc>l",
"split line",
},
["<C-s-j>"] = { "<cmd>join<cr>", "join lines" },
["<C-s-s>"] = { "i<cr><esc>l", "split line" },
-- do something useful with the arrows
["<Up>"] = { "<cmd> move-2<cr>", "Move line up", opts = { expr = true } },
["<Down>"] = { "<cmd> move+<cr>", "Move line down", opts = { expr = true } },
["<Left>"] = { "<cmd> << <cr>", "Less indentation", opts = { expr = true } },
["<Right>"] = { "<cmd> >> <cr>", "More indentation", opts = { expr = true } },
["<Up>"] = { "<cmd> move-2<cr>", "Move line up" },
["<Down>"] = { "<cmd> move+<cr>", "Move line down" },
["<Left>"] = { "<<", "Less indentation" },
["<Right>"] = { ">>", "More indentation" },
-- format with conform
["<leader>ff"] = {
function()
-- vim.lsp.buf.format()
require("conform").format()
end,
"format buffer",
@ -371,13 +434,15 @@ M.edit = {
["z="] = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
},
v = {
-- NOTE: I would love to know why these commands work, they seem really
-- crazy.
["<Up>"] = { ":move'<-2<CR>gv=gv", "Move lines up", opts = { silent = true } },
["<Down>"] = { ":move'>+<CR>gv=gv", "Move lines down", opts = { silent = true } },
["<Left>"] = { "<gv", "Less indentation" },
["<Right>"] = { ">gv", "More indentation" },
["<leader>fl"] = { ":!fmt -w80<CR>", "Reorder lines" },
},
x = {
["<Up>"] = { "move'<-2<cr>gv=gv", "Move line up", opts = { expr = true } },
["<Down>"] = { "move'<-2<cr>gv=gv", "Move line down", opts = { expr = true } },
},
x = {},
t = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
@ -495,4 +560,104 @@ M.goto_preview = {
},
}
M.debug = {
plugin = true,
n = {
["<leader>db"] = {
function()
require("dap").toggle_breakpoint()
end,
"toggle breakpoint",
noremap = true,
},
["<leader>dc"] = {
function()
require("dap").continue()
end,
"debug continue",
noremap = true,
},
["<leader>ds"] = {
function()
require("dap").step_over()
end,
"debug step over",
noremap = true,
},
["<leader>di"] = {
function()
require("dap").step_into()
end,
"debug step into",
noremap = true,
},
["<leader>dr"] = {
function()
require("dap").repl.open()
end,
"debug open repl",
noremap = true,
},
["<leader>dws"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.scopes)
my_sidebar.open()
end,
"debug window scopes",
noremap = true,
},
["<leader>dwt"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.threads)
my_sidebar.open()
end,
"debug window threads",
noremap = true,
},
["<leader>dwe"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.expression)
my_sidebar.open()
end,
"debug window expressions",
noremap = true,
},
["<leader>dwi"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.sessions)
my_sidebar.open()
end,
"debug window sessions",
noremap = true,
},
["<leader>dwf"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.frames)
my_sidebar.open()
end,
"debug window frames",
noremap = true,
},
["<leader>dK"] = {
function()
require("dap.ui.widgets").hover()
end,
"debug hover",
noremap = true,
},
["<leader>du"] = {
function()
require("dapui").toggle()
end,
"debug ui toggle",
noremap = true,
},
},
}
return M

View File

@ -30,7 +30,9 @@ local plugins = {
-- Install a plugin
{
-- exit insert mode with 'jk'
"max397574/better-escape.nvim",
enabled = true,
event = "InsertEnter",
config = function()
require("better_escape").setup()
@ -92,14 +94,41 @@ local plugins = {
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
["<leader>d"] = { name = "+debug" },
["<leader>c"] = { name = "+code" },
["<leader>g"] = { name = "+git" },
["<leader>t"] = { name = "+toggle/tools" },
["<leader>w"] = { name = "+window/which" },
["<leader>f"] = { name = "+formatting" },
},
opts = {
triggers_nowait = {
-- marks
"`",
"'",
"g`",
"g'",
-- registers
'"',
"<c-r>",
-- spelling
"z=",
},
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for keymaps that start with a native binding
i = { "j", "k" },
v = { "j", "k" },
n = { "o", "O" },
},
},
},
{
"echasnovski/mini.trailspace",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
opts = {},
},
{ "echasnovski/mini.trailspace", lazy = false, event = { "BufReadPost", "BufNewFile" }, opts = {} },
{
"itchyny/vim-cursorword",
event = "FileType",
@ -213,16 +242,26 @@ local plugins = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
-- signs = false, -- configure signs for some keywords individually
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
SECURITY = { icon = "󰒃 ", color = "warning" },
TODO = { icon = "", color = "todo" },
HACK = { icon = "", color = "hack" },
SECURITY = { icon = "󰒃 ", color = "security" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
PERF = { icon = "", color = "perf", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
},
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
todo = { "DiagnosticTodo", "#80e64d" },
hint = { "DiagnosticHint", "#10B981" },
hack = { "DiagnosticHack", "#FF33FF" },
security = { "DiagnosticSecurity", "#FF6600" },
default = { "Identifier", "#7C3AED" },
test = { "DiagnosticTest", "#E6E600" },
perf = { "DiagnosticPerf", "#9999ff" },
},
},
},
{
@ -314,6 +353,9 @@ local plugins = {
"rcarriga/nvim-notify",
},
config = function()
require("notify").setup {
top_down = false,
}
require("noice").setup {
lsp = {
override = {
@ -325,14 +367,37 @@ local plugins = {
-- produce a conflict
signature = { enabled = false },
hover = { enabled = false },
progress = {
enabled = true,
-- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin
-- See the section on formatting for more details on how to customize.
--- @type NoiceFormat|string
format = "lsp_progress",
--- @type NoiceFormat|string
format_done = "lsp_progress_done",
throttle = 1000 / 30, -- frequency to update lsp progress message
view = "mini", -- default: mini
},
},
-- you can enable a preset for easier configuration
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
inc_rename = true, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help
},
messages = {
enabled = true,
-- NOTE: we keep it with notify,
-- change this to something else if you want
view_error = "notify",
},
popupmenu = {
enabled = true,
},
notify = {
enabled = true,
},
}
end,
@ -451,7 +516,8 @@ local plugins = {
},
{
"glacambre/firenvim",
lazy = not vim.g.started_by_firenvim,
enabled = vim.g.started_by_firenvim,
lazy = false,
build = function()
vim.fn["firenvim#install"](0)
end,
@ -461,7 +527,7 @@ local plugins = {
[".*"] = {
filename = "/tmp/{hostname}_{pathname%10}.{extension%5}",
cmdline = "firenvim",
takeover = "never", -- activate manually (<C-e>)
takeover = "never", -- can't open it with never at all?
},
},
}
@ -546,7 +612,6 @@ local plugins = {
-- :Chmod
-- and also some more, but those are easy done with shell
"tpope/vim-eunuch",
enabled = false,
lazy = false,
},
{
@ -557,23 +622,18 @@ local plugins = {
local nls = require "null-ls"
local builtins = nls.builtins
local sources = {
builtins.formatting.black,
builtins.formatting.fixjson,
builtins.formatting.golines,
builtins.formatting.markdownlint,
builtins.formatting.shellharden,
builtins.formatting.sql_formatter,
builtins.diagnostics.markdownlint,
builtins.diagnostics.mypy,
builtins.diagnostics.vint,
builtins.diagnostics.yamllint,
builtins.code_actions.shellcheck,
builtins.formatting.shfmt,
builtins.diagnostics.write_good.with {
diagnostics_postprocess = function(diagnostic)
diagnostic.severity = vim.diagnostic.severity.HINT
end,
builtins.formatting.djlint.with {
filetypes = { "django", "jinja.html", "htmldjango", "tera", "html" },
},
builtins.diagnostics.djlint.with {
filetypes = { "django", "jinja.html", "htmldjango", "tera", "html" },
},
builtins.formatting.shfmt,
-- builtins.diagnostics.write_good.with {
-- diagnostics_postprocess = function(diagnostic)
-- diagnostic.severity = vim.diagnostic.severity.HINT
-- end,
-- },
}
for _, source in ipairs(sources) do
table.insert(opts.sources, source)
@ -608,17 +668,19 @@ local plugins = {
end,
})
-- change how the highlighting looks
vim.cmd "hi LspInlayHint guibg=bg guifg=#804d66"
vim.cmd "hi LspInlayHint guibg=(bg*0.8) guifg=#6699b3"
end,
},
{ "kosayoda/nvim-lightbulb", event = { "BufReadPre", "BufNewFile" } },
{
"Wansmer/treesj",
lazy = false,
cmd = { "TSJJoin", "TSJSplit" },
cmd = { "TSJJoin", "TSJSplit", "TSJSplit" },
keys = {
{ "k", "<cmd>TSJJoin<CR>" },
{ "S", "<cmd>TSJSplit<CR>" },
{ "<C-s-j>", "<cmd>TSJJoin<CR>" },
{ "<C-s-s>", "<cmd>TSJSplit<CR>" },
},
opts = {
use_default_keymaps = false,
},
},
{
@ -643,13 +705,13 @@ local plugins = {
local function get_git_diff(props)
local icons = { removed = "", changed = "", added = "" }
local labels = {}
local signs = vim.api.nvim_buf_get_var(props.buf, "gitsigns_status_dict")
-- local signs = vim.api.nvim_buf_get_var(props.buf, "gitsigns_status_dict")
-- local signs = vim.b.gitsigns_status_dict
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
end
end
-- for name, icon in pairs(icons) do
-- if tonumber(signs[name]) and signs[name] > 0 then
-- table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
-- end
-- end
if #labels > 0 then
table.insert(labels, { "| " })
end
@ -674,6 +736,238 @@ local plugins = {
}
end,
},
{
"mikesmithgh/kitty-scrollback.nvim",
enabled = true,
lazy = true,
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
event = { "User KittyScrollbackLaunch" },
-- version = '*', -- latest stable version, may have breaking changes if major version changed
-- version = '^3.0.0', -- pin major version, include fixes and features that do not have breaking changes
config = function()
require("kitty-scrollback").setup {
myconfig = function()
return { keymaps_enabled = false }
end,
}
end,
},
{
"hrsh7th/nvim-cmp",
enabled = not vim.g.started_by_firenvim,
},
{
"ziontee113/icon-picker.nvim",
keys = {
{ "<C-I>", "<cmd>IconPickerNormal<CR>", desc = "pick icon" },
{ "y<C-I>", "<cmd>IconPickerYank<CR>", desc = "yank icon" },
},
cmd = { "IconPickerInsert", "IconPickerYank", "IconPickerNormal" },
config = function()
require("icon-picker").setup { disable_legacy_commands = true }
end,
},
{
"mfussenegger/nvim-dap",
lazy = false,
init = function()
require("core.utils").load_mappings "debug"
end,
config = function()
local dap = require "dap"
local mason_registry = require "mason-registry"
local codelldb_root = mason_registry.get_package("codelldb"):get_install_path() .. "/extension/"
local codelldb_path = codelldb_root .. "adapter/codelldb"
local liblldb_path = codelldb_root .. "lldb/lib/liblldb.so"
dap.defaults.fallback.external_terminal = {
command = "/home/plex/.local/bin/kitty",
args = {},
}
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "-i", "dap" },
}
dap.adapters.codelldb = {
type = "server",
port = "30333",
executable = {
command = codelldb_path,
args = { "--port", "30333" },
detached = false,
},
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
args = function()
return require("custom.utils").tokenize_args(vim.fn.input "args: ")
end,
cwd = "${workspaceFolder}",
-- FIXME: perhaps we can put the stdio somewhere more practical
stopOnEntry = false,
},
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
end,
},
{
"rcarriga/nvim-dap-ui",
init = function()
require("core.utils").load_mappings "debug"
end,
dependencies = {
"mfussenegger/nvim-dap",
},
config = function(_, opts)
local dap = require "dap"
local dapui = require "dapui"
dapui.setup(opts)
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open {}
end
dap.listeners.before.event_terminated["dapui_config"] = function()
-- dapui.close {}
end
dap.listeners.before.event_exited["dapui_config"] = function()
-- dapui.close {}
end
end,
},
{ "folke/neodev.nvim", opts = {} },
{
"mrcjkb/rustaceanvim",
enabled = false,
version = "^4", -- Recommended
ft = { "rust" },
config = function()
local dap = require "dap"
vim.g.rustaceanvim = {
enable_clippy = true,
-- Plugin configuration
tools = {
enable_clippy = true,
},
-- LSP configuration
server = {
on_attach = function(client, bufnr)
-- you can also put keymaps in here
end,
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargo = {
features = "all",
},
},
},
},
-- DAP configuration
dap = {
-- FIXME: the rustaceanvim debug config does not map the stdout/stderr to the
-- opened terminal, effectively rendering debugging with it useless. Luckily,
-- we can use the regular nvim-dap and nvim-dap-ui.
adapter = dap.adapters.codelldb,
},
}
end,
},
{
"theHamsta/nvim-dap-virtual-text",
lazy = false, -- PERF: this can be done more elegant
config = function()
require("nvim-dap-virtual-text").setup()
end,
},
{
"jvgrootveld/telescope-zoxide",
dependencies = "nvim-telescope/telescope.nvim",
config = function()
-- Useful for easily creating commands
local z_utils = require "telescope._extensions.zoxide.utils"
require("telescope").setup {
-- (other Telescope configuration...)
extensions = {
zoxide = {
prompt_title = "[ Walking on the shoulders of TJ ]",
mappings = {
default = {
after_action = function(selection)
print("Update to (" .. selection.z_score .. ") " .. selection.path)
end,
},
["<C-s>"] = {
before_action = function(selection)
print "before C-s"
end,
action = function(selection)
vim.cmd.edit(selection.path)
end,
},
-- Opens the selected entry in a new split
["<C-q>"] = { action = z_utils.create_basic_command "split" },
},
},
},
}
require("telescope").load_extension "zoxide"
end,
},
{ "nanotee/zoxide.vim", lazy = false, enabled = false },
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function()
vim.fn["mkdp#util#install"]()
end,
config = function()
-- Ugly fix for wsl not finding my browser
-- I HATE windows
vim.g.mkdp_echo_preview_url = 1
end,
},
{
"rhysd/vim-grammarous",
enabled = false,
-- TODO: figure out how i can login to languagetool.org
lazy = false,
config = function()
vim.g["grammarous#jar_url"] = "https://www.languagetool.org/download/LanguageTool-5.9.zip"
vim.g["grammarous#use_vim_spelllang"] = 1
vim.cmd [[
let g:grammarous#default_comments_only_filetypes = {
\ '*' : 1, 'help' : 0, 'markdown' : 0,
\ }
]]
end,
},
{
"NvChad/ui",
enabled = true,
branch = "v2.0",
lazy = false,
},
{
"nvim-lualine/lualine.nvim",
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons",
"NvChad/ui", -- load after nvchad ui
},
config = function()
-- TODO: add lsp module for lualine
-- Maybe we can steal modules from the nvchad ui
require("lualine").setup()
end,
},
}
return plugins

83
lua/custom/utils.lua Normal file
View File

@ -0,0 +1,83 @@
local M = {}
--- this function will split a string into a table of tokens, like it would
--- be passed into the `argv` of a program that was executed from the commandline
---
--- @param raw string string of cli args that should be split
--- @return table tokens args as a table
M.tokenize_args = function(raw)
-- NOTE: string.gmatch is does not use regex, but a smaller pattern matcher!
-- A complete regex parser would be larger than lua itself. See
-- [Programming in Lua 20.2](https://www.lua.org/pil/20.2.html).
--
-- Notable differences:
-- '-' is ungreedy wildcard
-- '*?' does not work
-- '|' is not or
--
-- This means we're better of implementing the lexer with an algorithm.
local t = {}
local current = ""
local in_str = false
local str_seek
for c in string.gmatch(raw, ".") do -- iterate through all chars
if c == " " and not in_str then
if string.len(current) > 0 then
table.insert(t, current)
current = ""
end
elseif c == '"' and not in_str then
in_str = true
str_seek = '"'
elseif c == "'" and not in_str then
in_str = true
str_seek = "'"
elseif c == str_seek and in_str then
in_str = false
table.insert(t, current)
current = ""
else
current = current .. c
end
end
if string.len(current) > 0 then
table.insert(t, current)
end
return t
end
--- dumps a variable into a string, so it can be printed. This is meant for
--- debug prints
--- @param t any variable
--- @return string t_dumped t dumped to string
M.dump = function(t)
if type(t) == "table" then
local s = "{ "
for k, v in pairs(t) do
if type(k) ~= "number" then
k = '"' .. k .. '"'
end
if k ~= 1 then
s = s .. ", "
end
s = s .. "[" .. k .. "] = '" .. M.dump(v) .. "'"
end
return s .. " }"
else
return tostring(t)
end
end
--- Try to require a module
--- @param module string module name
--- @return boolean available is the module available?
--- @return any loaded_module the loaded module if it is available
M.try_require = function(module)
local available, loaded_module = pcall(require, module)
if not available then
return available, nil
else
return available, loaded_module
end
end
return M

View File

@ -33,7 +33,6 @@ return {
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",

View File

@ -1,34 +1,8 @@
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
-- List of all default plugins & their definitions
local default_plugins = {
"nvim-lua/plenary.nvim",
{
"NvChad/base46",
branch = "v2.0",
build = function()
require("base46").load_all_highlights()
end,
},
{
"NvChad/ui",
branch = "v2.0",
lazy = false,
},
{
"NvChad/nvterm",
init = function()
require("core.utils").load_mappings "nvterm"
end,
config = function(_, opts)
require "base46.term"
require("nvterm").setup(opts)
end,
},
{
"NvChad/nvim-colorizer.lua",
init = function()
@ -73,7 +47,6 @@ local default_plugins = {
{
"nvim-treesitter/nvim-treesitter",
tag = "v0.9.2",
init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,

138
mini.lua Normal file
View File

@ -0,0 +1,138 @@
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
g.python3_host_prog = '/usr/bin/python3'
opt.mouse = "a" -- mouse does annoying things for me if it's not 'a'
opt.signcolumn = "yes"
opt.clipboard = "" -- don't just use the system clipboard
opt.wrap = false
opt.breakindent = false
opt.spell = false
opt.list = true
opt.conceallevel = 2
opt.undofile = true
opt.undolevels = 10000
opt.writebackup = false
opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" }
-- Tabs and Indents
-- ===
opt.textwidth = 80 -- Text width maximum chars before wrapping
opt.tabstop = 4 -- The number of spaces a tab is
opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
opt.autoindent = true -- Use same indenting on new lines
opt.smartindent = true -- Smart autoindenting on new lines
opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
-- Timing
-- ===
opt.ttimeout = true
opt.timeoutlen = 500 -- Time out on mappings
opt.ttimeoutlen = 10 -- Time out on key codes
opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold
-- Searching
-- ===
opt.ignorecase = true -- Search ignoring case
opt.smartcase = true -- Keep case when searching with *
opt.infercase = true -- Adjust case in insert completion mode
opt.incsearch = true -- Incremental search
-- Formatting
-- ===
opt.wrap = false -- No wrap by default
opt.linebreak = true -- Break long lines at 'breakat'
opt.breakat = "\\ \\ ;:,!?" -- Long lines break chars
opt.startofline = false -- Cursor in same column for few commands
opt.splitbelow = true -- Splits open bottom right
opt.splitright = true
opt.breakindentopt = { shift = 2, min = 20 }
opt.formatoptions = "" -- see :h fo-table & :h formatoptions
-- Diff
-- ===
opt.diffopt:append { "iwhite", "indent-heuristic", "algorithm:patience" }
opt.wildmode = "longest:full,full" -- Command-line completion mode
-- Folds
-- ===
opt.foldlevel = 10 -- start with all folds open
-- Editor UI
-- ===
vim.o.guifont = "FiraCode Nerd Font:h15"
opt.termguicolors = true
opt.shortmess = "xsTOInfFitloCaAs"
opt.showmode = true -- Show mode in cmd window
opt.scrolloff = 2 -- Keep at least n lines above/below
opt.sidescrolloff = 0 -- Keep at least n lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = true -- Show line numbers
opt.relativenumber = true -- Show relative line numbers
opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters
opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
opt.laststatus = 3 -- Always show laststatus
if vim.g.started_by_firenvim == true then
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
opt.laststatus = 1 -- Don't show laststatus in firenvim
opt.wrap = true
end
if vim.g.neovide == true then
-- fulscreen with F11
vim.api.nvim_set_keymap("n", "<F11>", ":let g:neovide_fullscreen = !g:neovide_fullscreen<CR>", {})
vim.g.neovide_underline_automatic_scaling = true
-- vim.g.neovide_floating_blur_amount_x = 2.0
-- vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_scroll_animation_length = 0.1
-- vim.g.neovide_cursor_animation_length = 0
-- vim.g.neovide_cursor_trail_size = 0
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_fullscreen = true
end
opt.helpheight = 0 -- Disable help window resizing
opt.winwidth = 30 -- Minimum width for active window
opt.winminwidth = 1 -- Minimum width for inactive windows
opt.winheight = 1 -- Minimum height for active window
opt.winminheight = 1 -- Minimum height for inactive window
opt.showcmd = false -- show command in status line
opt.cmdheight = 0
opt.cmdwinheight = 5 -- Command-line lines
opt.equalalways = true -- Resize windows on split or close
opt.colorcolumn = "+0" -- Column highlight at textwidth's max character-limit
opt.cursorline = true
opt.cursorlineopt = { "number", "screenline" }
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.pumwidth = 10 -- Minimum width for the popup menu
opt.pumblend = 10 -- Popup blend
-- Spelling correction
-- ===
opt.spell = false -- manually enable spell with `set spell` or `<leader>ts`
opt.spelllang = "en,de_de,"
opt.spellsuggest = "double,50,timeout:5000"
-- autocommands
-- ===
local function augroup(name)
return vim.api.nvim_create_augroup("plex_" .. name, {})
end

View File

@ -260,3 +260,96 @@ popupmenu
#m
ufo
treesitter
GitLab
Gitea
Autocrate
YAML
TOML
autocrate
TBD
PRs
yaml
netpong
gehostet
IoT
einen
NTSecureGateway
SoC
Lockscreen
licht/!
Licht
ESRDD
erstmal
warmweißer
WG
SilverBullet
Forgejo
additional
scriptable
Autcrate
rustaceans
serv0
serv1
serv2
sequenceDiagram
style
BT
style
logdir
traceback
timestamp
LoggerBuilder
libpt
T2000
TINF22CS
Fliegendes/!
Gewöhnungsphase
Notfallmaßnahmen
übergriffig
Eligswalde
Usecases
OpenAPI
homeserver
theseus
Kernelmodus
entziehbares
vorkompiliert
vorkompilierte
Wordle
Quotientenkriterium
neovim
authentik
auth
Mesum
Raza
letsencrypt
MTA
STS
BIMI
Minecraft
exfiltrate
VPS
JVM
Dammit/!
Maxdorf
Leininger
Dockerfile
yml
CMD
UDPP
Unknowability
unknowability
talmann
Goldberger
ofc
shockwaves
deerhash
argon2
SCSS
Eligswalde's
Achmarel
aswell
AGI
FTL
Houten
Gabriella

Binary file not shown.