plugin stuff

This commit is contained in:
Alexander Gehrke 2024-04-11 20:06:27 +02:00
parent 0563865360
commit 2c0362678f
5 changed files with 152 additions and 96 deletions

View file

@ -1,4 +1,4 @@
if vim.env['VIRTUAL_ENV'] ~= nil then
if vim.env["VIRTUAL_ENV"] ~= nil then
vim.g.python3_host_prog = vim.fn.system("which -a python3 | sed -n 2p | tr -d '\n'")
else
vim.g.python3_host_prog = vim.fn.system("which python3 | tr -d '\n'")
@ -21,8 +21,8 @@ require("lazy").setup("plugins", {
dev = {
path = "~/projects/nvim/",
patterns = { "crater2150" },
fallback = true
}
fallback = true,
},
})
vim.opt.background = "dark"
@ -52,22 +52,36 @@ vim.opt.smartcase = true
vim.opt.inccommand = "split"
vim.opt.listchars = "tab:⇥\\ ,trail:-,nbsp:+,lead:␣"
--vim.opt.list = true
vim.cmd [[hi link Whitespace Comment]]
vim.cmd([[hi link Whitespace Comment]])
vim.opt.wildmode = { "list:longest", "list:full" }
vim.opt.wildignore = { "*.so", "*.swp", "*.zip", "*.o" }
vim.opt.suffixes = {
".bak", "~", ".h", ".info", ".swp", ".obj", ".info", ".aux", ".dvi", ".bbl", ".out", ".o", ".lo",
"\\.class", ".pdf" }
".bak",
"~",
".h",
".info",
".swp",
".obj",
".info",
".aux",
".dvi",
".bbl",
".out",
".o",
".lo",
"\\.class",
".pdf",
}
vim.opt.completeopt = "menu,menuone,noselect"
vim.opt.mouse = ''
vim.opt.mouse = ""
vim.opt.shortmess = vim.o.shortmess .. "c"
vim.opt.cursorline = true
vim.opt.undofile = true
vim.opt.spelllang = 'de,en'
vim.opt.spelllang = "de,en"
vim.opt.termguicolors = true
vim.opt.pumblend = 10
@ -75,44 +89,48 @@ vim.opt.pumblend = 10
vim.opt.updatetime = 300
local command = vim.api.nvim_create_user_command
local initlua = vim.fn.stdpath('config') .. '/init.lua'
command('RC', function() vim.cmd.edit(initlua) end, { desc = 'edit init.lua' })
command('CD', ':cd %:h', { desc = 'cd to current file' })
command('TrailingSpace', '%s/\\s*$//g', { desc = 'remove trailing spaces' })
local initlua = vim.fn.stdpath("config") .. "/init.lua"
command("RC", function()
vim.cmd.edit(initlua)
end, { desc = "edit init.lua" })
command("CD", ":cd %:h", { desc = "cd to current file" })
command("TrailingSpace", "%s/\\s*$//g", { desc = "remove trailing spaces" })
vim.g.tex_flavor = 'latex'
vim.g.tex_flavor = "latex"
local key = vim.keymap.set
key('n', '<space>', 'za', { desc = 'toggle fold' })
key('v', '.', '<cmd>normal .<CR>', { desc = 'repeat last command in visual mode' })
key('n', 'cy', '"*y', { desc = 'copy to system clipboard' })
key("n", "<space>", "za", { desc = "toggle fold" })
key("v", ".", "<cmd>normal .<CR>", { desc = "repeat last command in visual mode" })
key("n", "cy", '"*y', { desc = "copy to system clipboard" })
key('t', '<C-q>', '<C-\\><C-n>', { desc = 'exit terminal mode' })
key("t", "<C-q>", "<C-\\><C-n>", { desc = "exit terminal mode" })
-- Arrow keys for window movement and resizing
key('n', '<Left>', '<C-w>h')
key('n', '<Down>', '<C-w>j')
key('n', '<Up>', '<C-w>k')
key('n', '<Right>', '<C-w>l')
key("n", "<Left>", "<C-w>h")
key("n", "<Down>", "<C-w>j")
key("n", "<Up>", "<C-w>k")
key("n", "<Right>", "<C-w>l")
--
key('n', '<S-Left>', "<C-w><")
key('n', '<S-Right>', "<C-w>>")
key('n', '<S-Down>', "<C-w>-")
key('n', '<S-Up>', "<C-w>+")
key("n", "<S-Left>", "<C-w><")
key("n", "<S-Right>", "<C-w>>")
key("n", "<S-Down>", "<C-w>-")
key("n", "<S-Up>", "<C-w>+")
key('n', '<M-[>', function() vim.fn.search('^[^[:space:])\\]}]', 'be') end, { desc = 'jump to previous unindented line' })
key('n', '<M-]>', function() vim.fn.search('^[^[:space:])\\]}]', 'e') end, { desc = 'jump to next unindented line' })
key("n", "<M-[>", function()
vim.fn.search("^[^[:space:])\\]}]", "be")
end, { desc = "jump to previous unindented line" })
key("n", "<M-]>", function()
vim.fn.search("^[^[:space:])\\]}]", "e")
end, { desc = "jump to next unindented line" })
key('i', '<C-U>', '<C-G>u<C-U>')
key('n', '&', ':&&<CR>')
key('x', '&', ':&&<CR>')
key('n', 'Y', 'y$')
key("i", "<C-U>", "<C-G>u<C-U>")
key("n", "&", ":&&<CR>")
key("x", "&", ":&&<CR>")
key("n", "Y", "y$")
key("i", "<C-Space>", "<C-x><C-o>", { desc = "completion" })
key("n", "<C-l>", "<cmd>noh<CR><cmd>redraw!<CR>", { desc = "clear search highlight" })
key("v", "gs", "<cmd>'<,'>sort<CR>", { desc = "sort selection" })
key('i', '<C-Space>', '<C-x><C-o>', { desc = 'completion' })
key('n', '<C-l>', '<cmd>noh<CR><cmd>redraw!<CR>', { desc = 'clear search highlight' })
key('v', 'gs', "<cmd>'<,'>sort<CR>", { desc = 'sort selection' })
key({ 'n', 'x' }, '<M-a>', "<Plug>(EasyAlign)", { desc = 'align selection' })
key({ "n", "x" }, "<M-a>", "<Plug>(EasyAlign)", { desc = "align selection" })