move most important config to ansible

This commit is contained in:
Johannes Knopp
2025-09-06 15:44:39 +02:00
parent 7770c4b5e4
commit 14e4d4fe3e
49 changed files with 179 additions and 327 deletions

View File

@ -0,0 +1,37 @@
return {
'vim-airline/vim-airline',
dependencies = {
'vim-airline/vim-airline-themes',
-- 'nvim-tree/nvim-web-devicons',
'ryanoasis/vim-devicons',
},
config = function()
-- vim.g.airline_theme = 'base16_monokai'
vim.g.airline_powerline_fonts = 1
-- vim.g.airline_symbols = {}
-- unicode symbols
vim.g.airline_left_sep = '»'
vim.g.airline_left_sep = '▶'
vim.g.airline_right_sep = '«'
vim.g.airline_right_sep = '◀'
vim.g.airline_symbols.linenr = '␊'
vim.g.airline_symbols.linenr = '␤'
vim.g.airline_symbols.linenr = '¶'
vim.g.airline_symbols.branch = '⎇'
vim.g.airline_symbols.paste = 'ρ'
vim.g.airline_symbols.paste = 'Þ'
vim.g.airline_symbols.paste = '∥'
vim.g.airline_symbols.whitespace = 'Ξ'
-- airline symbols
vim.g.airline_left_sep = ''
vim.g.airline_left_alt_sep = ''
vim.g.airline_right_sep = ''
vim.g.airline_right_alt_sep = ''
vim.g.airline_symbols.branch = ''
vim.g.airline_symbols.readonly = ''
vim.g.airline_symbols.linenr = ''
end,
}

View File

@ -0,0 +1,40 @@
return {
'goolord/alpha-nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
event = 'VimEnter',
config = function()
local alpha = require('alpha')
local startify = require('alpha.themes.startify')
-- startify.section.header.val = {
-- '░▒▓███████▓▒░ ░▒▓████████▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████████████▓▒░ ',
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓████████▓▒░░▒▓██████▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
-- ' '
-- }
alpha.setup(startify.opts)
local alpha_start_group = vim.api.nvim_create_augroup('AlphaStart', { clear = true })
vim.api.nvim_create_autocmd('TabNewEntered', {
callback = function()
local bufnr = vim.api.nvim_get_current_buf()
local bufname = vim.api.nvim_buf_get_name(bufnr)
-- Start alpha if no file associated with buffer
if bufname == '' then
alpha.start()
end
end,
group = alpha_start_group
})
-- vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
end
}

View File

@ -0,0 +1,57 @@
return {
'rmagatti/auto-session',
lazy = false,
config = function()
local auto_session = require('auto-session')
auto_session.setup({
auto_save = false,
auto_restore = false,
post_restore_cmds = {
function ()
local buf_exists = function(bufname)
for _, buf in ipairs(vim.fn.getbufinfo({ bufloaded = true })) do
if buf.name:match(bufname) then
return true
end
end
return false
end
-- If NvimTree was opened when the session was saved, show it
if buf_exists('NvimTree_') then
local nvim_tree_api = require('nvim-tree.api')
nvim_tree_api.tree.reload()
nvim_tree_api.tree.open()
end
end
}
})
local opts = { silent = true, noremap = true }
local keymap = vim.keymap
keymap.set('n', '<leader>ss', '<cmd>SessionSave<cr>', opts)
keymap.set('n', '<leader>sq', '<cmd>SessionSave<cr><cmd>wa<cr><cmd>qa<cr>', opts)
keymap.set('n', '<leader>sl', '<cmd>SessionSearch<cr>', opts)
keymap.set('n', '<leader>sr', '<cmd>SessionRestore<cr>', opts)
keymap.set('n', '<leader>sd', '<cmd>Autosession delete<cr>', opts)
local function named_save()
vim.ui.input({ prompt = 'Enter Session name: ' }, function(input)
auto_session.SaveSession(input)
end)
end
keymap.set('n', '<leader>sS', named_save, opts)
local wk = require('which-key')
wk.add({
{ '<leader>s', group = 'auto-session' },
{ '<leader>ss', desc = 'SessionSave' },
{ '<leader>sS', desc = 'NamedSessionSave' },
{ '<leader>sq', desc = 'Save and Quit' },
{ '<leader>sl', desc = 'SessionList (SessionSearch)'},
{ '<leader>sr', desc = 'SessionRestore'},
{ '<leader>sd', desc = 'SessionDelete'},
})
end,
}

View File

@ -0,0 +1,22 @@
return {
'windwp/nvim-autopairs',
event = { 'InsertEnter' },
dependencies = {
'hrsh7th/nvim-cmp',
},
config = function()
local autopairs = require('nvim-autopairs')
autopairs.setup({
check_ts = true,
ts_config = {
javascript = { 'template_string' },
},
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
}

View File

@ -0,0 +1,6 @@
return {
'famiu/bufdelete.nvim',
config = function()
vim.keymap.set('n', '<C-q>', '<cmd>Bdelete<cr>', { noremap = true, silent = true })
end
}

View File

@ -0,0 +1,33 @@
return {
'akinsho/bufferline.nvim',
lazy = false,
version = '*',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function ()
local bufferline = require('bufferline')
bufferline.setup({
options = {
persist_buffer_sort = true,
hover = {
enabled = true,
delay = 200,
reveal = {'close'}
},
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",
highlight = "Directory",
separator = true,
}
}
}
})
local map = vim.keymap.set
local opts = { noremap = true, silent = true }
map('n', '<A-Left>', '<cmd>BufferLineCyclePrev<cr>', opts)
map('n', '<A-Right>', '<cmd>BufferLineCycleNext<cr>', opts)
end
}

View File

@ -0,0 +1,55 @@
return {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
"hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths
{
"L3MON4D3/LuaSnip",
-- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp",
},
"saadparwaiz1/cmp_luasnip", -- for autocompletion
"rafamadriz/friendly-snippets", -- useful snippets
"onsails/lspkind.nvim", -- vs-code like pictograms
},
config = function()
-- TODO keybindings
local cmp = require('cmp')
local luasnip = require('luasnip')
local lspkind = require('lspkind')
-- require('lspkind.loaders.from_vscode').lazy_load()
cmp.setup({
-- preselect = nil,
completion = {
completeopt = 'menu,menuone,preview',
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<Tab>'] = cmp.mapping.confirm({ select = true }),
['<Enter>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
}),
-- formatting = {
-- format = lspkind.cmp_format({
-- maxwidth = 50,
-- ellipsis_char = '...',
-- }),
-- },
})
end,
}

View File

@ -0,0 +1,8 @@
return {
'polirritmico/monokai-nightasty.nvim',
priority = 1000,
config = function()
require('monokai-nightasty').setup()
vim.cmd('colorscheme monokai-nightasty')
end,
}

View File

@ -0,0 +1,3 @@
return {
'sindrets/diffview.nvim'
}

View File

@ -0,0 +1,4 @@
return {
'stevearc/dressing.nvim',
opts = {}
}

View File

@ -0,0 +1,18 @@
return {
'voldikss/vim-floaterm',
config = function ()
local keymap = vim.keymap
local opts = { noremap = true, silent = true }
keymap.set('n', '<C-a>', '<cmd>FloatermToggle<cr>', opts)
keymap.set('t', '<C-a>', '<cmd>FloatermToggle<cr>', opts)
keymap.set('t', '<PageUp>', '<cmd>FloatermPrev<cr>', opts)
keymap.set('t', '<PageDown>', '<cmd>FloatermNext<cr>', opts)
local wk = require('which-key')
wk.add({
{ '<leader>t', group = 'Floaterm', icon = { icon = '', color = 'red' } },
{ '<leader>tn', '<leader>tn', desc = 'New Terminal', noremap = true, silent = true },
{ '<leader>tt', '<leader>tt', desc = 'Toggle Terminal', noremap = true, silent = true },
})
end
}

View File

@ -0,0 +1,9 @@
return {
'nvim-flutter/flutter-tools.nvim',
lazy = false,
dependencies = {
'nvim-lua/plenary.nvim',
'stevearc/dressing.nvim', -- optional for vim.ui.select
},
config = true,
}

View File

@ -0,0 +1,3 @@
return {
'nvim-lua/plenary.nvim', -- dependency of many plungins
}

View File

@ -0,0 +1,14 @@
return {
'kdheepak/lazygit.nvim',
lazy = true,
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
depedencies = {
'nvim-lua/plenary.nvim',
},
}

View File

@ -0,0 +1,125 @@
return {
'neovim/nvim-lspconfig',
event = { 'BufReadPre', 'BufNewFile' },
dependencies = {
'williamboman/mason.nvim',
'hrsh7th/cmp-nvim-lsp',
{ 'antosha417/nvim-lsp-file-operations', config = true },
{ 'folke/neodev.nvim', opts = {} },
},
config = function()
local lspconfig = require('lspconfig')
local mason_lspconfig = require('mason-lspconfig')
local cmp_nvim_lsp = require('cmp_nvim_lsp')
local keymap = vim.keymap
local wk = require('which-key')
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local function opts(desc)
return { desc = desc, buffer = ev.buf, silent = true }
end
keymap.set('n', 'gr', vim.lsp.buf.rename, opts('Rename'))
keymap.set('n', 'K', vim.lsp.buf.hover, opts('Show documentation'))
keymap.set('n', 'gR', '<cmd>Telescope lsp_references<cr>', opts('Show LSP references'))
keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('Go to declaration'))
keymap.set('n', 'gd', '<cmd>Telescope lsp_definitions<cr>', opts('Show LSP definitions'))
keymap.set('n', 'gi', '<cmd>Telescope lsp_implementations<cr>', opts('Show LSP implementations'))
keymap.set('n', 'gt', '<cmd>Telescope lsp_type_definitions<cr>', opts('Show LSP type definitions'))
keymap.set('n', 'gE', vim.diagnostic.open_float, opts('Show diagnostics'))
keymap.set({ 'n', 'v' }, 'ga', vim.lsp.buf.code_action, opts('Show available code actions'))
wk.add({
{ '<leader>r', group = 'Rename' },
{ '<leader>rn', vim.lsp.buf.rename, desc = 'Smart Rename' },
})
end,
})
local capabilities = cmp_nvim_lsp.default_capabilities()
mason_lspconfig.setup_handlers({
-- default handler for installed servers
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
-- TODO add lsp configs
['lua_ls'] = function()
lspconfig['lua_ls'].setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { 'vim' },
},
completion = {
callSnippet = 'Replace'
},
}
}
})
end,
['emmet_ls'] = function()
-- capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig['emmet_ls'].setup({
capabilities = capabilities,
filetypes = {
'html',
'css',
'sass',
'scss',
'less',
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'svelte',
'vue',
}
})
end,
['ts_ls'] = function()
lspconfig['ts_ls'].setup({
capabilities = capabilities,
cmd = { "typescript-language-server", "--stdio" },
init_options = {
hostInfo = "neovim",
-- preferences = {
-- includePackagesJsonAutoImports = "on",
-- }
}
})
end,
-- ['pyright'] = function()
-- lspconfig['pyright'].setup({
-- -- cmd = { "pyright-langserver", "--stdio" },
-- -- filetypes = { "python" },
-- -- root_dir = function(filename)
-- -- return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename)
-- -- end,
-- -- settings = {
-- -- python = {
-- -- analysis = {
-- -- autoSearchPaths = true,
-- -- diagnosticMode = "workspace",
-- -- useLibraryCodeForTypes = true
-- -- }
-- -- }
-- -- }
-- capabilities = capabilities,
-- settings = {
-- python = {
-- analysis = {
-- useLibraryCodeForTypes = true,
-- typeCheckingMode = "basic",
-- -- configPath = vim.fn.expand('./pyrightconfig.json')
-- }
-- }
-- },
-- })
-- end,
})
end
}

View File

@ -0,0 +1,45 @@
return {
{ 'williamboman/mason.nvim', commit = '4da89f3' },
{ 'williamboman/mason-lspconfig.nvim', commit = '1a31f82' },
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
config = function()
local mason = require('mason')
local mason_lspconfig = require('mason-lspconfig')
local mason_tool_installer = require('mason-tool-installer')
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
pip = {
upgrade_pip = true,
}
})
mason_lspconfig.setup({
ensure_installed = {
'lua_ls',
'html',
'cssls',
-- 'pyright',
-- 'emmet_ls',
'bashls',
'ts_ls',
},
})
mason_tool_installer.setup({
ensure_installed = {
'prettier',
'isort',
-- 'black',
-- 'pylint',
-- 'eslint_d',
}
})
end,
}

View File

@ -0,0 +1,41 @@
return {
'nvimtools/none-ls.nvim',
dependencies = {
'nvimtools/none-ls-extras.nvim'
},
config = function()
local null_ls = require('null-ls')
local sources = {
null_ls.builtins.formatting.prettier.with({
filetypes = { 'javascript', 'typescript', 'typescriptreact', 'css', 'html', 'json', 'markdown', 'yaml' }
}),
-- null_ls.builtins.formatting.black,
-- null_ls.builtins.formatting.djlint,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.stylua,
-- require('none-ls.diagnostics.eslint_d'),
}
null_ls.setup({
sources = sources,
-- on_attach = function(client, bufnr)
-- if client.server_capabilities.documentFormattingProvider then
-- vim.
-- end
-- end,
})
local keymap = vim.keymap
local fmt_func = function()
vim.lsp.buf.format({ async = true })
end
keymap.set('n', '<leader>ii', fmt_func, { noremap = true, silent = true })
local wk = require('which-key')
wk.add({
{ '<leader>i', group = 'Formatting' },
{ '<leader>ii', desc = 'Format File' },
})
end,
}

View File

@ -0,0 +1,46 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'horizon',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
end
}

View File

@ -0,0 +1,35 @@
return {
'nvim-tree/nvim-tree.lua',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function ()
local nvim_tree = require('nvim-tree')
local api = require('nvim-tree.api')
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
nvim_tree.setup({
filters = {
custom = { 'node_modules', '__pycache__' },
exclude = { 'secrets' },
},
update_focused_file = {
enable = true,
update_cwd = true,
}
})
local keymap = vim.keymap
keymap.set('n', '<leader>ee', api.tree.toggle, { noremap = true, silent = true })
keymap.set('n', '<leader>ec', '<cmd>NvimTreeCD<cr>', { noremap = true, silent = true })
local wk = require('which-key')
wk.add({
{ '<leader>e', group = 'nvim-tree', icon = { icon = '', color = 'orange' } },
{ '<leader>ee', group = 'Toggle tree' },
{ '<leader>ec', group = 'Change tree root to CWD' }
})
end
}

View File

@ -0,0 +1,6 @@
return {
'kylechui/nvim-surround',
event = { 'BufReadPre', 'BufNewFile' },
version = '*',
config = true,
}

View File

@ -0,0 +1,43 @@
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-tree/nvim-web-devicons",
},
config = function()
local telescope = require('telescope')
-- local actions = require('telescope.actions')
-- local transform_mod = require('telescope.actions.mt').transform_mod
-- local trouble = require('trouble')
-- local trouble_telescope = require('trouble.sources.telescope')
telescope.setup({
defaults = {
path_display = { 'smart' },
},
})
telescope.load_extension('fzf')
local opts = { noremap = true, silent = true }
local keymap = vim.keymap
local builtin = require('telescope.builtin')
keymap.set('n', '<leader>ff', builtin.find_files, opts)
keymap.set('n', '<leader>fh', builtin.oldfiles, opts)
keymap.set('n', '<leader>fs', builtin.live_grep, opts)
keymap.set('n', '<leader>fc', builtin.grep_string, opts)
local wk = require('which-key')
wk.add({
{ '<leader>f', group = 'telescope' },
{ '<leader>ff', desc = 'Find Files'},
{ '<leader>fh', desc = 'Recent Files'},
{ '<leader>fs', desc = 'Search Text in Files'},
{ '<leader>fc', desc = 'Search Text under Cursor'},
})
end,
}

View File

@ -0,0 +1,22 @@
return {
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
lazy = false,
config = function()
require("todo-comments").setup({
-- keywords = {
-- TODO = { icon = " ", color = "custom" },
-- },
-- colors = {
-- custom = { fg = "#FF0000", bg = "#000000" },
-- },
highlight = {
pattern = [[.*<(KEYWORDS)\s*]],
},
search = {
pattern = [[\b(KEYWORDS)\b]],
}
})
end
}

View File

@ -0,0 +1,51 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
},
config = function()
local treesitter = require('nvim-treesitter.configs')
treesitter.setup({
auto_install = true,
sync_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = { enable = true },
autotag = { enable = true },
ensure_installed = {
'json',
'javascript',
'typescript',
'yaml',
'html',
'htmldjango',
'css',
'scss',
'markdown',
'markdown_inline',
'bash',
'lua',
'vim',
'dockerfile',
'python',
'gitignore',
'c',
},
ignore_install = {},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<C-Space>',
node_incremental = '<C-Space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
})
end,
}

View File

@ -0,0 +1,24 @@
return {
"linux-cultist/venv-selector.nvim",
dependencies = {
"neovim/nvim-lspconfig",
-- "mfussenegger/nvim-dap", "mfussenegger/nvim-dap-python", --optional
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
},
lazy = false,
branch = "regexp", -- This is the regexp branch, use this for the new version
config = function()
require("venv-selector").setup({
-- settings = {
-- search = {
-- my_envs = {
-- command = "fd python$ ~/git/cerenim/backend/"
-- }
-- }
-- }
})
end,
keys = {
{ ",v", "<cmd>VenvSelect<cr>" },
},
}

View File

@ -0,0 +1,12 @@
return {
'folke/which-key.nvim',
event = 'VeryLazy',
config = function()
local wk = require('which-key')
wk.add({
{ '<leader>nh', '<cmd>nohl<cr>', desc = 'No Highlight' },
{ '<leader>l', group = 'LazyGit', icon = { icon = '', color = 'cyan' } },
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'Open LazyGit', icon = { icon = '', color = 'cyan' } },
})
end
}