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

View file

@ -1,63 +1,51 @@
return { return {
"folke/which-key.nvim", "pbrisbin/vim-mkdir",
'pbrisbin/vim-mkdir', "fladson/vim-kitty",
'fladson/vim-kitty', "tpope/vim-repeat",
'tpope/vim-repeat', "tpope/vim-surround",
'tpope/vim-surround', "tpope/vim-characterize",
'tpope/vim-characterize', "tpope/vim-commentary",
'tpope/vim-commentary',
'tpope/vim-sleuth',
{ "chrisgrieser/nvim-genghis", dependencies = "stevearc/dressing.nvim" }, { "chrisgrieser/nvim-genghis", dependencies = "stevearc/dressing.nvim" },
-- ic / ac -- ic / ac
{ {
'glts/vim-textobj-comment', "glts/vim-textobj-comment",
dependencies = { 'kana/vim-textobj-user' } dependencies = { "kana/vim-textobj-user" },
}, },
-- ii / ai -- ii / ai
'michaeljsmith/vim-indent-object', "michaeljsmith/vim-indent-object",
'neovim/nvim-lspconfig', "neovim/nvim-lspconfig",
{ {
'nvim-telescope/telescope.nvim', "nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' } dependencies = { "nvim-lua/plenary.nvim" },
}, },
{ {
'ray-x/lsp_signature.nvim', "ray-x/lsp_signature.nvim",
config = function() config = function()
require('lsp_signature').setup({}) require("lsp_signature").setup({})
end
},
'kyazdani42/nvim-web-devicons',
'folke/trouble.nvim',
'folke/lsp-colors.nvim',
'nvim-lua/popup.nvim',
'junegunn/vim-easy-align',
'machakann/vim-highlightedyank',
'lambdalisue/suda.vim',
'jamessan/vim-gnupg',
{
'lervag/vimtex',
init = function()
vim.g.tex_conceal = "agm"
vim.g.vimtex_quickfix_ignorefilters = { 'overfull', 'underfull' }
vim.g.vimtex_syntax_enabled = 0
end, end,
ft = "tex",
}, },
'ledger/vim-ledger', "kyazdani42/nvim-web-devicons",
'anekos/hledger-vim', "folke/trouble.nvim",
"folke/lsp-colors.nvim",
"nvim-lua/popup.nvim",
"junegunn/vim-easy-align",
"machakann/vim-highlightedyank",
"lambdalisue/suda.vim",
"jamessan/vim-gnupg",
"ledger/vim-ledger",
"anekos/hledger-vim",
'vim-pandoc/vim-pandoc', "vim-pandoc/vim-pandoc",
'vim-pandoc/vim-pandoc-syntax', "vim-pandoc/vim-pandoc-syntax",
'isobit/vim-caddyfile', "isobit/vim-caddyfile",
'Glench/Vim-Jinja2-Syntax', "Glench/Vim-Jinja2-Syntax",
'GEverding/vim-hocon', "GEverding/vim-hocon",
'nfnty/vim-nftables', "nfnty/vim-nftables",
'nfnty/vim-nftables', "nfnty/vim-nftables",
'Everduin94/nvim-quick-switcher', "Everduin94/nvim-quick-switcher",
} }
-- 'powerman/vim-plugin-AnsiEsc', -- 'powerman/vim-plugin-AnsiEsc',

View file

@ -5,7 +5,7 @@ end
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows version = false,
build = ":TSUpdate", build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
dependencies = { dependencies = {
@ -34,8 +34,9 @@ return {
{ "<c-space>", desc = "Increment selection" }, { "<c-space>", desc = "Increment selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" }, { "<bs>", desc = "Decrement selection", mode = "x" },
}, },
---@type TSConfig
opts = { opts = {
auto_install = true,
ignore_install = {},
highlight = { enable = true, disable = ts_disable }, highlight = { enable = true, disable = ts_disable },
indent = { enable = true }, indent = { enable = true },
ensure_installed = { ensure_installed = {
@ -68,6 +69,36 @@ return {
node_decremental = "<bs>", node_decremental = "<bs>",
}, },
}, },
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
-- stylua: ignore start
["af"] = { query = "@function.outer", desc = "outer function" },
["if"] = { query = "@function.inner", desc = "inner function" },
["ac"] = { query = "@class.outer", desc = "outer class" },
["ic"] = { query = "@class.inner", desc = "inner class" },
["ap"] = { query = "@parameter.outer", desc = "outer parameter" },
["ip"] = { query = "@parameter.inner", desc = "inner parameter" },
-- stylua: ignore end
},
selection_modes = {
["@parameter.outer"] = "v", -- charwise
["@function.outer"] = "V", -- linewise
["@class.outer"] = "V",
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
}, },
---@param opts TSConfig ---@param opts TSConfig
config = function(_, opts) config = function(_, opts)
@ -86,28 +117,29 @@ return {
end, end,
}, },
{ {
'nvim-treesitter/playground', "nvim-treesitter/playground",
dependencies = { "nvim-treesitter/nvim-treesitter" }, dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = { cmd = {
'TSPlaygroundToggle', "TSPlaygroundToggle",
'TSHighlightCapturesUnderCursor', "TSHighlightCapturesUnderCursor",
'TSNodeUnderCursor', "TSNodeUnderCursor",
} },
}, },
{ {
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",
event = "VeryLazy", event = "VeryLazy",
dependencies = { "nvim-treesitter/nvim-treesitter" }, dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = { 'TSContextEnable', 'TSContextDisable', 'TSContextToggle' }, cmd = { "TSContextEnable", "TSContextDisable", "TSContextToggle" },
keys = { keys = {
{ "[c", function() require("treesitter-context").go_to_context() end, desc = "Go to context start" }, -- stylua: ignore start
{ "[c", function() require("treesitter-context").go_to_context() end, desc = "Go to context start", },
-- stylua: ignore end
}, },
opts = { enable = true }, opts = { enable = true },
config = function(_, opts) config = function(_, opts)
require 'treesitter-context'.setup(opts) require("treesitter-context").setup(opts)
vim.api.nvim_set_hl(0, 'TreesitterContext', { bg = "#555555" }) vim.api.nvim_set_hl(0, "TreesitterContext", { bg = "#555555" })
vim.api.nvim_set_hl(0, 'TreesitterContextLineNumber', { link = "Special" }) vim.api.nvim_set_hl(0, "TreesitterContextLineNumber", { link = "Special" })
end, end,
} },
} }

9
lua/plugins/vimtex.lua Normal file
View file

@ -0,0 +1,9 @@
return {
"lervag/vimtex",
init = function()
vim.g.tex_conceal = "agm"
vim.g.vimtex_quickfix_ignorefilters = { "overfull", "underfull" }
vim.g.vimtex_syntax_enabled = 0
end,
ft = "tex",
}

View file

@ -0,0 +1,9 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {},
}