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',
},
MENU = {
mode = "n",
mode = 'n',
shortcut = '<leader>sm',
description = "Open Session Menu"
}
description = 'Open Session Menu',
},
}
--[[ Git ]]

View file

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

View file

@ -1,4 +1,6 @@
return {
'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 sessions = session_utils.get_sessions()
table.sort(
sessions,
function(a, b) return a.dir.filename < b.dir.filename end
)
table.sort(sessions, function(a, b)
return a.dir.filename < b.dir.filename
end)
local line_len = 0
for i = 1, #sessions, 1 do

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,5 +20,5 @@ return {
brightness_down = K.FOCUS_SHADE.DOWN.shortcut,
},
},
},]]--
},]] --
}

View file

@ -2,7 +2,7 @@ local T = require('toolchain')
local M = {}
function M.setup()
T.add_highlighter_autoinstalls( 'json', 'xml', 'yaml', 'toml' )
T.add_highlighter_autoinstalls('json', 'xml', 'yaml', 'toml')
T.add_null_ls_module(function(null_ls)
return {
@ -19,22 +19,19 @@ function M.setup()
lspconfig.taplo.setup(config)
end)
T.add_plugins(
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {},
},
T.add_plugins({
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {},
},
{
"folke/neoconf.nvim",
priority = 100,
config = function()
require('neoconf').setup()
end
}
)
}, {
'folke/neoconf.nvim',
priority = 100,
config = function()
require('neoconf').setup()
end,
})
end
return M

View file

@ -3,46 +3,48 @@ local K = require('core.keymap')
local M = {}
function M.setup()
T.add_highlighter_autoinstalls('gitcommit', 'gitignore', 'gitattributes', 'git_rebase', 'git_config')
T.add_plugins(
{
'tpope/vim-fugitive',
},
{
'lewis6991/gitsigns.nvim',
config = function()
-- Setup --
require('gitsigns').setup()
-- Keybinding --
vim.keymap.set(
K.GIT.HUNK.mode,
K.GIT.HUNK.shortcut,
':Gitsigns preview_hunk_inline<CR>',
{ desc = K.GIT.HUNK.description }
)
vim.keymap.set(
K.GIT.BLAME.mode,
K.GIT.BLAME.shortcut,
':Gitsigns toggle_current_line_blame<CR>',
{ desc = K.GIT.BLAME.description }
)
vim.keymap.set(
K.GIT.OPEN.mode,
K.GIT.OPEN.shortcut,
':Git <CR>',
{ desc = K.GIT.OPEN.description }
)
end,
},
{
'moyiz/git-dev.nvim',
lazy = true,
cmd = { 'GitDevOpen', 'GitDevCleanAll' },
opts = {},
}
T.add_highlighter_autoinstalls(
'gitcommit',
'gitignore',
'gitattributes',
'git_rebase',
'git_config'
)
T.add_plugins({
'tpope/vim-fugitive',
}, {
'lewis6991/gitsigns.nvim',
config = function()
-- Setup --
require('gitsigns').setup()
-- Keybinding --
vim.keymap.set(
K.GIT.HUNK.mode,
K.GIT.HUNK.shortcut,
':Gitsigns preview_hunk_inline<CR>',
{ desc = K.GIT.HUNK.description }
)
vim.keymap.set(
K.GIT.BLAME.mode,
K.GIT.BLAME.shortcut,
':Gitsigns toggle_current_line_blame<CR>',
{ desc = K.GIT.BLAME.description }
)
vim.keymap.set(
K.GIT.OPEN.mode,
K.GIT.OPEN.shortcut,
':Git <CR>',
{ desc = K.GIT.OPEN.description }
)
end,
}, {
'moyiz/git-dev.nvim',
lazy = true,
cmd = { 'GitDevOpen', 'GitDevCleanAll' },
opts = {},
})
end
return M

View file

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

View file

@ -8,7 +8,7 @@ local plugins = {}
--- @param ... LazySpec
function TOOLCHAINS.add_plugins(...)
for _, spec in ipairs({...}) do
for _, spec in ipairs({ ... }) do
table.insert(plugins, spec)
end
end
@ -16,6 +16,7 @@ end
function TOOLCHAINS.get_plugins()
return plugins
end
---------
-- LSPs -
---------
@ -24,7 +25,7 @@ local lsp_setups = {}
--- @param ... string
function TOOLCHAINS.add_lsp_autoinstalls(...)
for _, lsp in ipairs({...}) do
for _, lsp in ipairs({ ... }) do
table.insert(lsp_autoinstalls, lsp)
end
end
@ -57,7 +58,6 @@ function TOOLCHAINS.add_null_ls_module(setup)
table.insert(null_ls_setups, setup)
end
function TOOLCHAINS.get_null_ls_source(null_ls)
local null_ls_sources = {}
for _, setup_function in ipairs(null_ls_setups) do
@ -79,7 +79,7 @@ local highlighter_autoinstalls = {}
--- @param ... string
function TOOLCHAINS.add_highlighter_autoinstalls(...)
for _, highlighter in ipairs({...}) do
for _, highlighter in ipairs({ ... }) do
table.insert(highlighter_autoinstalls, highlighter)
end
end
@ -88,9 +88,39 @@ function TOOLCHAINS.get_highlighter_autoinstalls()
return highlighter_autoinstalls
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 -
----------------
---------
function TOOLCHAINS.init()
require('toolchain.config').setup()
require('toolchain.database').setup()
@ -106,6 +136,7 @@ function TOOLCHAINS.init()
require('toolchain.web').setup()
require('toolchain.angular').setup()
end
return TOOLCHAINS
---------------------

View file

@ -2,7 +2,7 @@ local T = require('toolchain')
local M = {}
function M.setup()
T.add_highlighter_autoinstalls('lua','luadoc')
T.add_highlighter_autoinstalls('lua', 'luadoc')
T.add_null_ls_module(function(null_ls)
return {

View file

@ -27,6 +27,23 @@ function M.setup()
lspconfig.phpactor.setup(config)
lspconfig.stimulus_ls.setup(config)
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
return M

View file

@ -3,43 +3,39 @@ local M = {}
function M.setup()
T.add_highlighter_autoinstalls('rust')
T.add_null_ls_module(
function(null_ls)
return {
{
name = 'clippy',
method = null_ls.methods.FORMATTING,
filetypes = { 'rust' },
generator = require('null-ls.helpers').formatter_factory({
command = 'rustfmt',
to_stdin = true,
input = '$TEXT',
}),
},
}
end
)
T.add_null_ls_module(function(null_ls)
return {
{
name = 'clippy',
method = null_ls.methods.FORMATTING,
filetypes = { 'rust' },
generator = require('null-ls.helpers').formatter_factory({
command = 'rustfmt',
to_stdin = true,
input = '$TEXT',
}),
},
}
end)
T.add_lsp_autoinstalls('rust_analyzer')
T.add_lsps(
function(lspconfig, capabilities)
lspconfig.rust_analyzer.setup({
cmd = { 'ra-multiplex' },
settings = {
['rust-analyzer'] = {
check = {
overrideCommand = {
'cargo',
'clippy',
'--message-format=json-diagnostic-rendered-ansi',
'--fix',
'--allow-dirty',
},
T.add_lsps(function(lspconfig, capabilities)
lspconfig.rust_analyzer.setup({
cmd = { 'ra-multiplex' },
settings = {
['rust-analyzer'] = {
check = {
overrideCommand = {
'cargo',
'clippy',
'--message-format=json-diagnostic-rendered-ansi',
'--fix',
'--allow-dirty',
},
},
},
})
end
)
},
})
end)
end
--[[T.add_plugins({

View file

@ -3,18 +3,18 @@ local F = require('util.finder')
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)
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
return nil
end
local config_file = vim.fn.readfile(config_file_path, "")
local config_file = vim.fn.readfile(config_file_path, '')
local succes, data = pcall(function()
return vim.json.decode(table.concat(config_file, ""))
return vim.json.decode(table.concat(config_file, ''))
end)
if not succes or data then
@ -22,9 +22,9 @@ function CONFIG.get(module, name)
end
return table.concat(
vim.split(data[name], C.PROJECT_DIR_PLACEHOLDER, { plain = true}),
vim.split(data[name], C.PROJECT_DIR_PLACEHOLDER, { plain = true }),
F.project_dir
)
end
return CONFIG
return CONFIG

View file

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

View file

@ -5,4 +5,4 @@ if FINDER.project_dir == '' then
FINDER.project_dir = vim.fn.getcwd()
end
return FINDER
return FINDER

View file

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