Skip to content
Closed

Update #1882

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
579 changes: 410 additions & 169 deletions init.lua

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions lua/custom/plugins/git-conflict.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {
{
'akinsho/git-conflict.nvim',
version = '*',
config = true,
},
}
12 changes: 12 additions & 0 deletions lua/custom/plugins/git-worktree.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
return {
{
'ThePrimeagen/git-worktree.nvim',
dependencies = {
'nvim-telescope/telescope.nvim',
},
config = function()
require('git-worktree').setup()
require('telescope').load_extension 'git_worktree'
end,
},
}
87 changes: 87 additions & 0 deletions lua/custom/plugins/none-ls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
-- Format on save and linters
return {
{
'nvimtools/none-ls.nvim',
dependencies = {
'nvimtools/none-ls-extras.nvim',
'jayp0521/mason-null-ls.nvim', -- ensure dependencies are installed
},
config = function()
local null_ls = require 'null-ls'
local formatting = null_ls.builtins.formatting -- to setup formatters
local diagnostics = null_ls.builtins.diagnostics -- to setup linters

-- list of formatters & linters for mason to install
require('mason-null-ls').setup {
ensure_installed = {
'checkmake',
'prettier', -- ts/js formatter
'stylua', -- lua formatter
'eslint_d', -- ts/js linter
'shfmt',
'ruff',
},
-- auto-install configured formatters & linters (with null-ls)
automatic_installation = true,
}

local sources = {
-- Linters
diagnostics.checkmake,

-- ESLint diagnostics (ESLint 9 compatible)
require('none-ls.diagnostics.eslint_d').with {
prefer_local = 'node_modules/.bin',
filetypes = {
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
},
condition = function(utils)
return utils.root_has_file {
'eslint.config.js',
'eslint.config.mjs',
'eslint.config.cjs',
}
end,
},

-- ESLint code actions
require('none-ls.code_actions.eslint_d').with {
prefer_local = 'node_modules/.bin',
},

-- Formatters
formatting.prettier.with {
filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'html', 'json', 'yaml', 'markdown' },
},

formatting.stylua,
formatting.shfmt.with { args = { '-i', '4' } },
formatting.terraform_fmt,
require('none-ls.formatting.ruff').with { extra_args = { '--config=pyproject.toml' } },
-- require('none-ls.formatting.ruff_format').with { extra_args = { '--config=pyproject.toml' } },
}

local augroup = vim.api.nvim_create_augroup('LspFormatting', {})
null_ls.setup {
-- debug = true, -- Enable debug mode. Inspect logs with :NullLsLog.
sources = sources,
-- you can reuse a shared lspconfig on_attach callback here
on_attach = function(client, bufnr)
if client.supports_method 'textDocument/formatting' then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd('BufWritePre', {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format { async = false }
end,
})
end
end,
}
end,
},
}
7 changes: 7 additions & 0 deletions lua/custom/plugins/rust.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
{
'mrcjkb/rustaceanvim',
version = '^6', -- Recommended
lazy = false, -- This plugin is already lazy
},
}
20 changes: 20 additions & 0 deletions lua/custom/plugins/tmux.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
return {
{
'christoomey/vim-tmux-navigator',
cmd = {
'TmuxNavigateLeft',
'TmuxNavigateDown',
'TmuxNavigateUp',
'TmuxNavigateRight',
'TmuxNavigatePrevious',
'TmuxNavigatorProcessList',
},
keys = {
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
},
},
}
7 changes: 7 additions & 0 deletions lua/custom/plugins/typescript.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
{
'pmizio/typescript-tools.nvim',
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
opts = {},
},
}
189 changes: 130 additions & 59 deletions lua/kickstart/plugins/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@
-- kickstart.nvim and not kitchen-sink.nvim ;)

return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
-- Create a beutifull debugger UI
'rcarriga/nvim-dap-ui',

-- Required dependency for nvim-dap-ui
-- Required dependency for nvim dap ui
'theHamsta/nvim-dap-virtual-text',
'nvim-neotest/nvim-nio',

-- Installs the debug adapters for you
'mason-org/mason.nvim',
-- Install the debug adapter for you
'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',

-- Add your own debuggers here
-- Add your own debugger here
'mfussenegger/nvim-dap-python',
'leoluz/nvim-dap-go',
},
keys = {
Expand Down Expand Up @@ -65,70 +62,144 @@ return {
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
local ui = require 'dapui'

require('dapui').setup()
require('dap-go').setup()

require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
automatic_instalation = true,

-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},

-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
'python',
},
}

-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
controls = {
icons = {
pause = '⏸',
play = '▶',
step_into = '⏎',
step_over = '⏭',
step_out = '⏮',
step_back = 'b',
run_last = '▶▶',
terminate = '⏹',
disconnect = '⏏',
require('nvim-dap-virtual-text').setup {
display_callback = function(variable)
local name = string.lower(variable.name)
local value = string.lower(variable.value)
if name:match 'secret' or name:match 'api' or value:match 'secret' or value:match 'api' then return '*****' end

if #variable.value > 15 then return ' ' .. string.sub(variable.value, 1, 15) .. '... ' end

return ' ' .. variable.value
end,
}

-- Handled by nvim-dap-go
-- dap.adapters.go = {
-- type = "server",
-- port = "${port}",
-- executable = {
-- command = "dlv",
-- args = { "dap", "-l", "127.0.0.1:${port}" },
-- },
-- }

local elixir_ls_debugger = vim.fn.exepath 'elixir-ls-debugger'
if elixir_ls_debugger ~= '' then
dap.adapters.mix_task = {
type = 'executable',
command = elixir_ls_debugger,
}

dap.configurations.elixir = {
{
type = 'mix_task',
name = 'phoenix server',
task = 'phx.server',
request = 'launch',
projectDir = '${workspaceFolder}',
exitAfterTaskReturns = false,
debugAutoInterpretAllModules = false,
},
}
end

-- CodeLLDB debug adapter location
local codelldb = vim.fn.expand '$MASON/packages/codelldb'
local extension_path = codelldb .. '/extension/'
local codelldb_path = extension_path .. 'adapter/codelldb'

-- Configure the LLDB adapter
dap.adapters.codelldb = {
type = 'server',
port = '${port}',
executable = {
command = codelldb_path,
args = { '--port', '${port}' },
},
enrich_config = function(config, on_config)
-- If the configuration(s) in `launch.json` contains a `cargo` section
-- send the configuration off to the cargo_inspector.
if config['cargo'] ~= nil then on_config(cargo_inspector(config)) end
end,
}

-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end

dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close

-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
-- Configure LLDB adapter
dap.adapters.lldb = {
type = 'server',
port = '${port}',
executable = {
command = codelldb_path,
args = { '--port', '${port}' },
detached = false,
},
}

-- Default debug configuration for C, C++
dap.configurations.c = {
{
name = 'Debug an Executable',
type = 'lldb',
request = 'launch',
program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
},
}

dap.configurations.cpp = dap.configurations.c
dap.configurations.rust = {
{
name = 'Debug an Executable',
type = 'lldb',
request = 'launch',
program = function()
local cwd = vim.fn.getcwd()
local default_binary = cwd .. '/target/debug/' .. vim.fn.fnamemodify(cwd, ':t')
return vim.fn.input('Path to executable: ', default_binary, 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
},
}

-- Override default configurations with `launch.json`
require('dap.ext.vscode').load_launchjs('.nvim/launch.json', { lldb = { 'c', 'cpp', 'rust' } })

vim.keymap.set('n', '<space>b', dap.toggle_breakpoint)
vim.keymap.set('n', '<space>gb', dap.run_to_cursor)

-- Eval var under cursor
vim.keymap.set('n', '<space>?', function() require('dapui').eval(nil, { enter = true }) end)

vim.keymap.set('n', '<F1>', dap.continue)
vim.keymap.set('n', '<F2>', dap.step_into)
vim.keymap.set('n', '<F3>', dap.step_over)
vim.keymap.set('n', '<F4>', dap.step_out)
vim.keymap.set('n', '<F5>', dap.step_back)
vim.keymap.set('n', '<F13>', dap.restart)

dap.listeners.before.attach.dapui_config = function() ui.open() end
dap.listeners.before.launch.dapui_config = function() ui.open() end
dap.listeners.before.event_terminated.dapui_config = function() ui.close() end
dap.listeners.before.event_exited.dapui_config = function() ui.close() end

require('dap-python').setup()
end,
}
Loading