Changes #1

Merged
snoweuph merged 5 commits from SZUT-Dominik/Dotfiles_nvim:master into master 2025-01-14 22:59:12 +00:00
21 changed files with 204 additions and 147 deletions
Showing only changes of commit 01b54c4487 - Show all commits

View file

@ -25,10 +25,10 @@ K.SESSIONS = {
description = 'Create Session', description = 'Create Session',
}, },
MENU = { MENU = {
mode = "n", mode = 'n',
shortcut = '<leader>sm', shortcut = '<leader>sm',
description = "Open Session Menu" description = 'Open Session Menu',
} },
} }
--[[ Git ]] --[[ Git ]]

View file

@ -15,5 +15,5 @@ local plugins = require('toolchain').get_plugins()
table.insert(plugins, 1, { import = 'editor' }) table.insert(plugins, 1, { import = 'editor' })
require('lazy').setup({ require('lazy').setup({
spec = plugins spec = plugins,
}) })

View file

@ -1,4 +1,6 @@
return { return {
'm4xshen/autoclose.nvim', 'm4xshen/autoclose.nvim',
config = function() require('autoclose').setup() end, config = function()
require('autoclose').setup()
end,
} }

View file

@ -42,10 +42,9 @@ return {
local session_utils = require('session_manager.utils') local session_utils = require('session_manager.utils')
local sessions = session_utils.get_sessions() local sessions = session_utils.get_sessions()
table.sort( table.sort(sessions, function(a, b)
sessions, return a.dir.filename < b.dir.filename
function(a, b) return a.dir.filename < b.dir.filename end end)
)
local line_len = 0 local line_len = 0
for i = 1, #sessions, 1 do for i = 1, #sessions, 1 do

View file

@ -1,4 +1,5 @@
local K = require('core.keymap') local K = require('core.keymap')
local T = require('toolchain')
return { return {
'mfussenegger/nvim-dap', 'mfussenegger/nvim-dap',
@ -10,6 +11,8 @@ return {
-- Setup Debugging -- -- Setup Debugging --
local dap = require('dap') local dap = require('dap')
T.setup_debuggers(dap.adapters, dap.configurations)
-- Open UI on Debugging -- -- Open UI on Debugging --
local dapui = require('dapui') local dapui = require('dapui')
dapui.setup({ dapui.setup({
@ -32,8 +35,12 @@ return {
}, },
}, },
}) })
dap.listeners.before.attach.dapui_config = function() dapui.open() end dap.listeners.before.attach.dapui_config = function()
dap.listeners.before.launch.dapui_config = function() dapui.open() end dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
-- Keybinding -- -- Keybinding --
vim.keymap.set( vim.keymap.set(

View file

@ -5,7 +5,9 @@ return {
{ {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
lazy = false, lazy = false,
config = function() require('mason').setup() end, config = function()
require('mason').setup()
end,
}, },
{ {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',

View file

@ -18,11 +18,7 @@ return {
require('telescope').load_extension('ui-select') require('telescope').load_extension('ui-select')
-- Keybinding -- -- Keybinding --
local function setTelescopeBinding( local function setTelescopeBinding(mapping, method, search_global)
mapping,
method,
search_global
)
local function binding() local function binding()
local path = search_global and '~' local path = search_global and '~'
or require('neo-tree.sources.manager').get_state( or require('neo-tree.sources.manager').get_state(
@ -30,21 +26,18 @@ return {
).path ).path
method({ search_dirs = { path } }) method({ search_dirs = { path } })
end end
vim.keymap.set(mapping.mode, mapping.shortcut, binding, { desc = mapping.description }) vim.keymap.set(
mapping.mode,
mapping.shortcut,
binding,
{ desc = mapping.description }
)
end end
local telescope = require('telescope.builtin') local telescope = require('telescope.builtin')
setTelescopeBinding( setTelescopeBinding(K.SEARCH.FIND_FILE, telescope.find_files, false)
K.SEARCH.FIND_FILE, setTelescopeBinding(K.SEARCH.FUZZY_FIND, telescope.live_grep, false)
telescope.find_files,
false
)
setTelescopeBinding(
K.SEARCH.FUZZY_FIND,
telescope.live_grep,
false
)
setTelescopeBinding( setTelescopeBinding(
K.SEARCH.GLOBAL_FIND_FILE, K.SEARCH.GLOBAL_FIND_FILE,
telescope.find_files, telescope.find_files,

View file

@ -49,7 +49,9 @@ return {
vim.keymap.set( vim.keymap.set(
K.SNIPPETS.JUMP_BACKWARDS.mode, K.SNIPPETS.JUMP_BACKWARDS.mode,
K.SNIPPETS.JUMP_BACKWARDS.shortcut, K.SNIPPETS.JUMP_BACKWARDS.shortcut,
function() luasnip.jump(-1) end, function()
luasnip.jump(-1)
end,
{ silent = true } { silent = true }
) )
@ -64,7 +66,9 @@ return {
-- Setup -- -- Setup --
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end, expand = function(args)
luasnip.lsp_expand(args.body)
end,
}, },
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),

View file

@ -42,7 +42,9 @@ return {
sections = { sections = {
lualine_a = { 'mode' }, lualine_a = { 'mode' },
lualine_b = { lualine_b = {
function() return require('lsp-progress').progress() end, function()
return require('lsp-progress').progress()
end,
}, },
lualine_c = { 'diagnostics' }, lualine_c = { 'diagnostics' },
lualine_d = { lspsaga_breadcrumbs }, lualine_d = { lspsaga_breadcrumbs },
@ -77,6 +79,8 @@ return {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
'nvim-tree/nvim-web-devicons', 'nvim-tree/nvim-web-devicons',
}, },
config = function() require('barbar').setup() end, config = function()
require('barbar').setup()
end,
}, },
} }

View file

@ -19,22 +19,19 @@ function M.setup()
lspconfig.taplo.setup(config) lspconfig.taplo.setup(config)
end) end)
T.add_plugins( T.add_plugins({
{
'folke/lazydev.nvim', 'folke/lazydev.nvim',
ft = 'lua', ft = 'lua',
opts = { opts = {
library = {}, library = {},
}, },
}, }, {
{ 'folke/neoconf.nvim',
"folke/neoconf.nvim",
priority = 100, priority = 100,
config = function() config = function()
require('neoconf').setup() require('neoconf').setup()
end end,
} })
)
end end
return M return M

View file

@ -3,13 +3,17 @@ local K = require('core.keymap')
local M = {} local M = {}
function M.setup() function M.setup()
T.add_highlighter_autoinstalls('gitcommit', 'gitignore', 'gitattributes', 'git_rebase', 'git_config') T.add_highlighter_autoinstalls(
'gitcommit',
'gitignore',
'gitattributes',
'git_rebase',
'git_config'
)
T.add_plugins( T.add_plugins({
{
'tpope/vim-fugitive', 'tpope/vim-fugitive',
}, }, {
{
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
config = function() config = function()
-- Setup -- -- Setup --
@ -35,14 +39,12 @@ function M.setup()
{ desc = K.GIT.OPEN.description } { desc = K.GIT.OPEN.description }
) )
end, end,
}, }, {
{
'moyiz/git-dev.nvim', 'moyiz/git-dev.nvim',
lazy = true, lazy = true,
cmd = { 'GitDevOpen', 'GitDevCleanAll' }, cmd = { 'GitDevOpen', 'GitDevCleanAll' },
opts = {}, opts = {},
} })
)
end end
return M return M

View file

@ -27,14 +27,17 @@ function M.setup()
config = function() config = function()
local args = CONFIG.get(C.CONFIG_DAP_MODULE, C.CONFIG_DAP_KEY_ARGS) local args = CONFIG.get(C.CONFIG_DAP_MODULE, C.CONFIG_DAP_KEY_ARGS)
if args ~= nil then if args ~= nil then
args = vim.split(args, "") args = vim.split(args, '')
end end
require('dap-go').setup({ require('dap-go').setup({
delve = { delve = {
cwd = CONFIG.get(C.CONFIG_DAP_MODULE, C.CONFIG_DAP_KEY_DIR), cwd = CONFIG.get(C.CONFIG_DAP_MODULE, C.CONFIG_DAP_KEY_DIR),
build_flags = CONFIG.get(C.CONFIG_DAP_MODULE, C.CONFIG_DAP_KEY_BUILD_FLAGS), build_flags = CONFIG.get(
args = args C.CONFIG_DAP_MODULE,
} C.CONFIG_DAP_KEY_BUILD_FLAGS
),
args = args,
},
}) })
end, end,
}) })

View file

@ -16,6 +16,7 @@ end
function TOOLCHAINS.get_plugins() function TOOLCHAINS.get_plugins()
return plugins return plugins
end end
--------- ---------
-- LSPs - -- LSPs -
--------- ---------
@ -57,7 +58,6 @@ function TOOLCHAINS.add_null_ls_module(setup)
table.insert(null_ls_setups, setup) table.insert(null_ls_setups, setup)
end end
function TOOLCHAINS.get_null_ls_source(null_ls) function TOOLCHAINS.get_null_ls_source(null_ls)
local null_ls_sources = {} local null_ls_sources = {}
for _, setup_function in ipairs(null_ls_setups) do for _, setup_function in ipairs(null_ls_setups) do
@ -88,9 +88,39 @@ function TOOLCHAINS.get_highlighter_autoinstalls()
return highlighter_autoinstalls return highlighter_autoinstalls
end end
---------------- --------------
-- Debugging -
--------------
local debug_adapters = {}
local debug_configs = {}
---@param name string
---@param adapter dap.Adapter
function TOOLCHAINS.add_debug_adapter(name, adapter)
debug_adapters[name] = adapter
end
---@param name string
---@param config dap.Configuration
function TOOLCHAINS.add_debug_config(name, config)
debug_configs[name] = config
end
---@param adapters table<string, dap.Adapter>
---@param configs table<string, dap.Configuration>
function TOOLCHAINS.setup_debuggers(adapters, configs)
for name, adapter in pairs(debug_adapters) do
adapters[name] = adapter
end
for name, config in pairs(debug_configs) do
configs[name] = config
end
end
---------
-- Init - -- Init -
---------------- ---------
function TOOLCHAINS.init() function TOOLCHAINS.init()
require('toolchain.config').setup() require('toolchain.config').setup()
require('toolchain.database').setup() require('toolchain.database').setup()
@ -106,6 +136,7 @@ function TOOLCHAINS.init()
require('toolchain.web').setup() require('toolchain.web').setup()
require('toolchain.angular').setup() require('toolchain.angular').setup()
end end
return TOOLCHAINS return TOOLCHAINS
--------------------- ---------------------

View file

@ -27,6 +27,23 @@ function M.setup()
lspconfig.phpactor.setup(config) lspconfig.phpactor.setup(config)
lspconfig.stimulus_ls.setup(config) lspconfig.stimulus_ls.setup(config)
end) end)
T.add_debug_adapter('php', {
type = 'executable',
command = 'node',
args = {
vim.loop.os_homedir()
.. '/.local/share/nvim/mason/packages/php-debug-adapter/extension/out/phpDebug.js',
},
})
T.add_debug_config('php', {
{
type = 'php',
request = 'launch',
name = 'Listen for Xdebug',
port = 9003,
},
})
end end
return M return M

View file

@ -3,8 +3,7 @@ local M = {}
function M.setup() function M.setup()
T.add_highlighter_autoinstalls('rust') T.add_highlighter_autoinstalls('rust')
T.add_null_ls_module( T.add_null_ls_module(function(null_ls)
function(null_ls)
return { return {
{ {
name = 'clippy', name = 'clippy',
@ -17,11 +16,9 @@ function M.setup()
}), }),
}, },
} }
end end)
)
T.add_lsp_autoinstalls('rust_analyzer') T.add_lsp_autoinstalls('rust_analyzer')
T.add_lsps( T.add_lsps(function(lspconfig, capabilities)
function(lspconfig, capabilities)
lspconfig.rust_analyzer.setup({ lspconfig.rust_analyzer.setup({
cmd = { 'ra-multiplex' }, cmd = { 'ra-multiplex' },
settings = { settings = {
@ -38,8 +35,7 @@ function M.setup()
}, },
}, },
}) })
end end)
)
end end
--[[T.add_plugins({ --[[T.add_plugins({

View file

@ -3,18 +3,18 @@ local F = require('util.finder')
local CONFIG = {} local CONFIG = {}
CONFIG.config_dir = F.project_dir .. "/" .. C.CONFIG_DIR CONFIG.config_dir = F.project_dir .. '/' .. C.CONFIG_DIR
function CONFIG.get(module, name) function CONFIG.get(module, name)
local config_file_path = CONFIG.config_dir .. module .. ".json" local config_file_path = CONFIG.config_dir .. module .. '.json'
if vim.fn.filereadable(config_file_path) == 0 then if vim.fn.filereadable(config_file_path) == 0 then
return nil return nil
end end
local config_file = vim.fn.readfile(config_file_path, "") local config_file = vim.fn.readfile(config_file_path, '')
local succes, data = pcall(function() local succes, data = pcall(function()
return vim.json.decode(table.concat(config_file, "")) return vim.json.decode(table.concat(config_file, ''))
end) end)
if not succes or data then if not succes or data then

View file

@ -1,9 +1,9 @@
local CONST = {} local CONST = {}
CONST.PROJECT_DIR_PLACEHOLDER = "$PROJECT_DIR" CONST.PROJECT_DIR_PLACEHOLDER = '$PROJECT_DIR'
CONST.CONFIG_DIR = ".nvim" CONST.CONFIG_DIR = '.nvim'
CONST.CONFIG_DAP_MODULE = "debugging" CONST.CONFIG_DAP_MODULE = 'debugging'
CONST.CONFIG_DAP_KEY_DIR = "dir" CONST.CONFIG_DAP_KEY_DIR = 'dir'
CONST.CONFIG_DAP_KEY_ARGS = "args" CONST.CONFIG_DAP_KEY_ARGS = 'args'
CONST.CONFIG_DAP_KEY_BUILD_FLAGS = "build_flags" CONST.CONFIG_DAP_KEY_BUILD_FLAGS = 'build_flags'
return CONST return CONST

View file

@ -4,4 +4,4 @@ indent_type = "Spaces"
indent_width = 4 indent_width = 4
quote_style = "AutoPreferSingle" quote_style = "AutoPreferSingle"
call_parentheses = "Always" call_parentheses = "Always"
collapse_simple_statement = "FunctionOnly" collapse_simple_statement = "Never"