Software
Vim Config
vim.lsp.enable('clangd')
vim.lsp.enable('debputy')
vim.filetype.add({extension = {launch = "xml"}, filename = {["debputy.manifest"] = "yaml"}})
vim.lsp.enable('ruff')
vim.lsp.enable('texlab')
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client:supports_method('textDocument/completion') then
vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = true})
end
end
})
require("conform").setup({
formatters = {
markdown_pandoc = {
command = "pandoc",
args = {"-f", "markdown", "-t", "gfm", "-sp", "--tab-stop=2"},
},
rst_pandoc = {
command = "pandoc",
args = {"-f", "rst", "-t", "rst", "-s", "--columns=79"},
},
},
formatters_by_ft = {
cmake = {"cmake_format"},
json = {"jq"},
markdown = {"markdown_pandoc"},
rst = {"rst_pandoc"},
sh = {"shfmt"},
},
})
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
require("lint").linters_by_ft = {
cmake = {"cmake_lint"},
json = {"json_tool"},
rst = {"rstcheck"},
sh = {"shellcheck"},
yaml = {"yamllint"},
}
vim.api.nvim_create_autocmd({"BufEnter", "BufWritePost", "InsertLeave"}, {
callback = function()
require("lint").try_lint()
end
})
vim.o.autoread = false
vim.o.autowrite = true
vim.o.colorcolumn = "101"
vim.o.completeopt = "menuone,noselect,popup"
vim.o.foldenable = false
vim.o.ignorecase = true
vim.o.linebreak = true
vim.o.number = true
vim.o.path = vim.o.path .. "**"
vim.o.scrolloff = 3
vim.o.showmatch = true
vim.o.sidescrolloff = 10
vim.o.smartcase = true
vim.o.spell = not vim.o.diff
vim.o.timeoutlen = 500
vim.o.title = true
vim.o.ttimeoutlen = 0
vim.o.updatetime = 250
vim.o.wildmode = "list:longest,full"
vim.g.netrw_chgwin = 2
vim.g.vimtex_view_method = "zathura"
vim.api.nvim_create_autocmd("BufRead", {pattern = "/tmp/mutt*", callback = function() vim.cmd("normal :g/^> -- $/,/^$/-1d^M/^$^M^L") end})
vim.api.nvim_create_autocmd("CursorHold", {pattern = "*", callback = function() vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"}) end})
vim.api.nvim_create_autocmd("CursorHoldI", {pattern = "*", callback = function() vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"}) end})
vim.api.nvim_create_autocmd("DiagnosticChanged", {pattern = "*", callback = function() vim.diagnostic.setqflist({open = false}) end})
vim.api.nvim_create_autocmd("FileType", {pattern = "qf,git,gitAnnotate,Outline,diff,help", callback = function() vim.opt_local.spell = false end})
vim.api.nvim_create_autocmd("FileType", {pattern = "remind,taskedit", callback = function() vim.opt_local.spelllang = "de" end})
vim.api.nvim_create_autocmd("FileType", {
pattern = "mail",
callback = function()
vim.opt_local.expandtab = true
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.colorcolumn = "80"
end
})
-- :TSInstall python c cpp markdown markdown_inline
vim.api.nvim_create_autocmd('FileType', {
pattern = {'python,c,cpp,markdown,markdown_inline'},
callback = function()
vim.treesitter.start()
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})
vim.cmd[[command DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis | wincmd p | diffthis]]
-- https://wiki.ubuntuusers.de/VIM/Tipps
-- https://ftp.nluug.nl/pub/vim/runtime/spell/{de,en}.utf-8.{spl,sug}
-- :mkspell! ~/.local/share/nvim/site/spell/en.utf-8.add
function togglespell()
if vim.o.spell then
if vim.o.spelllang == "de" then
vim.o.spelllang = "en"
print("toggle spell " .. vim.o.spelllang)
else
vim.o.spell = false
print("toggle spell off")
end
else
vim.o.spell = true
vim.o.spelllang = "de"
print("toggle spell " .. vim.o.spelllang)
end
end
vim.keymap.set("", "<F1>", togglespell)
vim.keymap.set("i", "<F1>", togglespell)
vim.keymap.del("", "Y")
vim.keymap.set("", "<space>o", "<Cmd>Outline<CR>", {silent = true})
vim.keymap.set("", "<space>t", require("undotree").toggle, {noremap = true, silent = true})