diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua new file mode 100644 index 0000000..a7a98b9 --- /dev/null +++ b/lua/plugins/dap.lua @@ -0,0 +1,111 @@ +local setup_dap = function() + local dap = require 'dap' + dap.adapters.lldb = { + type = 'executable', + command = '/opt/homebrew/opt/llvm@18/bin/lldb-dap', + name = 'lldb', + } + + dap.configurations.cpp = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input( + 'Path to executable: ', + vim.fn.getcwd() .. '/', + 'file' + ) + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = function() + return vim.split(vim.fn.input 'Input args: ', ' ') + end, + initCommands = { 'command source ~/.lldbinit' }, + }, + { + -- If you get an "Operation not permitted" error using this, try disabling YAMA: + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + name = 'Attach to process', + type = 'lldb', -- Adjust this to match your adapter name (`dap.adapters.`) + request = 'attach', + pid = require('dap.utils').pick_process, + args = {}, + }, + { + name = 'Load core file', + type = 'lldb', + request = 'attach', + program = function() + return vim.fn.input( + 'Path to executable: ', + vim.fn.getcwd() .. '/', + 'file' + ) + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + coreFile = function() + return vim.fn.input('Corefile: ', vim.fn.getcwd() .. '/', 'file') + end, + }, + } + dap.configurations.c = dap.configurations.cpp +end + +return { + { + 'mfussenegger/nvim-dap', + dependencies = { + 'rcarriga/nvim-dap-ui', + 'nvim-telescope/telescope-dap.nvim', + 'nvim-neotest/nvim-nio', + }, + lazy = true, + config = function() + local dap, dapui = require 'dap', require 'dapui' + dapui.setup() + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + end + dap.listeners.before.event_exited['dapui_config'] = function() + dapui.close() + end + setup_dap() + vim.api.nvim_create_user_command('DapUiToggle', function() + dapui.toggle() + end, {}) + end, + keys = { + { + '', + function() + require('dap').continue() + end, + }, + { + '', + function() + require('dap').step_over() + end, + }, + { + '', + function() + require('dap').step_into() + end, + }, + { + 'db', + function() + require('dap').toggle_breakpoint() + end, + }, + }, + cmd = { + 'DapUiToggle', + }, + }, +} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua new file mode 100644 index 0000000..4c43225 --- /dev/null +++ b/lua/plugins/diffview.lua @@ -0,0 +1,15 @@ +return { + { + 'sindrets/diffview.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + keys = { + { + 'gd', + function() + require('diffview').open() + end, + }, + }, + cmd = 'DiffviewOpen', + }, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..264a9db --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,40 @@ +return { + { + 'lewis6991/gitsigns.nvim', + config = true, + dependencies = { 'nvim-lua/plenary.nvim' }, + event = { 'BufReadPre', 'BufNewFile' }, + keys = { + { + ']c', + function() + require('gitsigns').next_hunk() + end, + }, + { + '[c', + function() + require('gitsigns').prev_hunk() + end, + }, + { + 'gp', + function() + require('gitsigns').preview_hunk() + end, + }, + { + 'gr', + function() + require('gitsigns').reset_hunk() + end, + }, + { + 'ga', + function() + require('gitsigns').stage_hunk() + end, + }, + }, + } +} diff --git a/lua/plugins/icon-picker.lua b/lua/plugins/icon-picker.lua new file mode 100644 index 0000000..2f6bf48 --- /dev/null +++ b/lua/plugins/icon-picker.lua @@ -0,0 +1,7 @@ +return { + { + 'ziontee113/icon-picker.nvim', + config = true, + cmd = { 'IconPickerNormal', 'IconPickerInsert', 'IconPickerYank' }, + }, +} diff --git a/lua/plugins/lazydev.lua b/lua/plugins/lazydev.lua new file mode 100644 index 0000000..442efaf --- /dev/null +++ b/lua/plugins/lazydev.lua @@ -0,0 +1,14 @@ +return { + { + 'folke/lazydev.nvim', + ft = 'lua', -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, +} diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua new file mode 100644 index 0000000..404b0f2 --- /dev/null +++ b/lua/plugins/neogit.lua @@ -0,0 +1,27 @@ +return { + { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', -- required + 'nvim-telescope/telescope.nvim', -- optional + 'sindrets/diffview.nvim', -- optional + }, + config = function() + require('neogit').setup { + commit_editor = { + kind = 'split', + }, + console_timeout = 10000, + } + end, + keys = { + { + 'gg', + function() + require('neogit').open { kind = 'split' } + end, + }, + }, + cmd = 'Neogit', + }, +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..0eb85ca --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,19 @@ +local nvim_tree_toggle = function() + require('nvim-tree.api').tree.toggle { find_file = true, update_root = true } +end + +return { + 'kyazdani42/nvim-tree.lua', + config = true, + keys = { + { '', nvim_tree_toggle, mode = 'n' }, + { + '', + function() + vim.cmd.stopinsert() + nvim_tree_toggle() + end, + mode = 'i', + }, + }, +} diff --git a/lua/plugins/octo.lua b/lua/plugins/octo.lua new file mode 100644 index 0000000..5fc3f6e --- /dev/null +++ b/lua/plugins/octo.lua @@ -0,0 +1,12 @@ +return { + { + 'pwntester/octo.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', + 'nvim-tree/nvim-web-devicons', + }, + config = true, + cmd = 'Octo', + }, +} diff --git a/lua/plugins/openingh.lua b/lua/plugins/openingh.lua new file mode 100644 index 0000000..3ffa227 --- /dev/null +++ b/lua/plugins/openingh.lua @@ -0,0 +1,7 @@ +return { + { + 'Almo7aya/openingh.nvim', + config = true, + cmd = { 'OpenInGHFile', 'OpenInGHFileLines', 'OpenInGHRepo' }, + }, +} diff --git a/lua/plugins/other.lua b/lua/plugins/other.lua new file mode 100644 index 0000000..9b64bdc --- /dev/null +++ b/lua/plugins/other.lua @@ -0,0 +1,3 @@ +return { + 'neovim/nvim-lspconfig' +} diff --git a/lua/plugins/rainbow_delimiters.lua b/lua/plugins/rainbow_delimiters.lua new file mode 100644 index 0000000..23975b8 --- /dev/null +++ b/lua/plugins/rainbow_delimiters.lua @@ -0,0 +1,17 @@ +return { + 'hiphish/rainbow-delimiters.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + vim.g.rainbow_delimiters = { + highlight = { + 'RainbowDelimiterGreen', + 'RainbowDelimiterYellow', + 'RainbowDelimiterOrange', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + 'RainbowDelimiterBlue', + 'RainbowDelimiterRed', + }, + } + end, +} diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..cf8570c --- /dev/null +++ b/lua/plugins/toggleterm.lua @@ -0,0 +1,35 @@ +return { + 'akinsho/toggleterm.nvim', + version = '*', + config = true, + keys = { + { + '', + function() + require('toggleterm').toggle() + end, + mode = 'n', + }, + { + '', + function() + -- vim.cmd '1ToggleTerm' + require('toggleterm').toggle(1) + end, + mode = 't', + }, + { + '', + function() + local pathStr = vim.api.nvim_buf_get_name(0) + local path = require('plenary.path'):new(pathStr) + if not path:is_path() then + vim.notify('Current buffer is not a file', vim.log.levels.WARN) + return + end + vim.cmd.ToggleTerm('dir=' .. path:parent():expand()) + end, + mode = 'n', + }, + }, +}