added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 7d4f626b7d
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,60 @@
-- alias for vim.api.nvim_create_autocmd
local create_autocmd = vim.api.nvim_create_autocmd
-- taken from https://github.com/sitiom/nvim-numbertoggle
-- I would much rather avoid fetching yet another plugin for something
-- that should be done locally - and not as a plugin
local augroup = vim.api.nvim_create_augroup("numbertoggle", {})
create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "CmdlineLeave", "WinEnter" }, {
pattern = "*",
group = augroup,
callback = function()
if vim.o.nu and vim.api.nvim_get_mode().mode ~= "i" then
vim.opt.relativenumber = true
end
end,
})
create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter", "WinLeave" }, {
pattern = "*",
group = augroup,
callback = function()
if vim.o.nu then
vim.opt.relativenumber = false
vim.cmd "redraw"
end
end,
})
-- enable spell checking & line wrapping
-- for git commit messages
create_autocmd({ "FileType" }, {
pattern = { "gitcommit" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Highlight yank after yanking
create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end,
})
-- Close terminal window if process exists with code 0
create_autocmd("TermClose", {
callback = function()
if not vim.b.no_auto_quit then
vim.defer_fn(function()
if vim.api.nvim_get_current_line() == "[Process exited 0]" then
vim.api.nvim_buf_delete(0, { force = true })
end
end, 50)
end
end,
})

View file

@ -0,0 +1,25 @@
local options = {
-- disable the -- STATUS -- line
showmode = false,
-- spellchecking
spell = true,
-- spell langs
spelllang = { "en" },
}
-- iterate over the options table and set the options
-- for each key = value pair
for key, value in pairs(options) do
vim.opt[key] = value
end
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "toggleterm" },
callback = function()
vim.opt_local.wrap = false
vim.opt_local.spell = false
end,
})

View file

@ -0,0 +1,37 @@
local float_options = {
border = 'single',
max_width = math.ceil(vim.api.nvim_win_get_width(0) * 0.6),
max_height = math.ceil(vim.api.nvim_win_get_height(0) * 0.8),
}
vim.lsp.handlers['textDocument/publishDiagnostics'] =
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = true,
signs = false,
underline = true,
update_in_insert = false,
severity_sort = true,
})
vim.lsp.handlers['textDocument/show_line_diagnostics'] =
vim.lsp.with(vim.lsp.handlers.hover, float_options)
-- Prevent show notification
-- <https://github.com/neovim/neovim/issues/20457#issuecomment-1266782345>
vim.lsp.handlers['textDocument/hover'] = function(_, result, ctx, config)
config = config or float_options
config.focus_id = ctx.method
if not result then
return
end
local markdown_lines =
vim.lsp.util.convert_input_to_markdown_lines(result.contents)
markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)
if vim.tbl_isempty(markdown_lines) then
return
end
return vim.lsp.util.open_floating_preview(markdown_lines, 'markdown', config)
end
vim.lsp.handlers['textDocument/signatureHelp'] =
vim.lsp.with(vim.lsp.handlers.signature_help, float_options)

View file

@ -0,0 +1,4 @@
-- disables "how to disable mouse" message
-- in right click popups
vim.cmd.aunmenu [[PopUp.How-to\ disable\ mouse]]
vim.cmd.aunmenu [[PopUp.-1-]]

View file

@ -0,0 +1,5 @@
if vim.g.neovide then
vim.o.guifont = "Iosevka Nerd Font:h14" -- text below applies for VimScript
vim.g.neovide_theme = 'auto'
vim.g.neovide_transparency = 0.95
end

View file

@ -0,0 +1,59 @@
local noice = require("noice")
local no_top_text = {
opts = {
border = {
text = { top = "" },
},
},
}
noice.setup({
cmdline = {
format = {
cmdline = no_top_text,
filter = no_top_text,
lua = no_top_text,
search_down = no_top_text,
search_up = no_top_text,
},
},
lsp = {
override = {
["cmp.entry.get_documentation"] = true,
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
},
progress = {
enabled = false,
},
},
popupmenu = {
backend = "cmp",
},
routes = {
{
filter = {
event = "msg_show",
kind = "search_count",
},
opts = { skip = true },
},
},
views = {
cmdline_popup = {
border = {
style = "single",
},
},
confirm = {
border = {
style = "single",
text = { top = "" },
},
},
},
})