Skip to content

Commit

Permalink
Lazy load all the plugins. Set keymaps with lazy.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
kuznetsss committed Jun 29, 2024
1 parent 186bdb5 commit 9be3853
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 0 deletions.
111 changes: 111 additions & 0 deletions lua/plugins/dap.lua
Original file line number Diff line number Diff line change
@@ -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.<name>`)
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 = {
{
'<F10>',
function()
require('dap').continue()
end,
},
{
'<F11>',
function()
require('dap').step_over()
end,
},
{
'<F12>',
function()
require('dap').step_into()
end,
},
{
'<leader>db',
function()
require('dap').toggle_breakpoint()
end,
},
},
cmd = {
'DapUiToggle',
},
},
}
15 changes: 15 additions & 0 deletions lua/plugins/diffview.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
return {
{
'sindrets/diffview.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
keys = {
{
'<leader>gd',
function()
require('diffview').open()
end,
},
},
cmd = 'DiffviewOpen',
},
}
40 changes: 40 additions & 0 deletions lua/plugins/gitsigns.lua
Original file line number Diff line number Diff line change
@@ -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,
},
{
'<leader>gp',
function()
require('gitsigns').preview_hunk()
end,
},
{
'<leader>gr',
function()
require('gitsigns').reset_hunk()
end,
},
{
'<leader>ga',
function()
require('gitsigns').stage_hunk()
end,
},
},
}
}
7 changes: 7 additions & 0 deletions lua/plugins/icon-picker.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
{
'ziontee113/icon-picker.nvim',
config = true,
cmd = { 'IconPickerNormal', 'IconPickerInsert', 'IconPickerYank' },
},
}
14 changes: 14 additions & 0 deletions lua/plugins/lazydev.lua
Original file line number Diff line number Diff line change
@@ -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 },
}
27 changes: 27 additions & 0 deletions lua/plugins/neogit.lua
Original file line number Diff line number Diff line change
@@ -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 = {
{
'<leader>gg',
function()
require('neogit').open { kind = 'split' }
end,
},
},
cmd = 'Neogit',
},
}
19 changes: 19 additions & 0 deletions lua/plugins/nvim-tree.lua
Original file line number Diff line number Diff line change
@@ -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 = {
{ '<F2>', nvim_tree_toggle, mode = 'n' },
{
'<F2>',
function()
vim.cmd.stopinsert()
nvim_tree_toggle()
end,
mode = 'i',
},
},
}
12 changes: 12 additions & 0 deletions lua/plugins/octo.lua
Original file line number Diff line number Diff line change
@@ -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',
},
}
7 changes: 7 additions & 0 deletions lua/plugins/openingh.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
{
'Almo7aya/openingh.nvim',
config = true,
cmd = { 'OpenInGHFile', 'OpenInGHFileLines', 'OpenInGHRepo' },
},
}
3 changes: 3 additions & 0 deletions lua/plugins/other.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
'neovim/nvim-lspconfig'
}
17 changes: 17 additions & 0 deletions lua/plugins/rainbow_delimiters.lua
Original file line number Diff line number Diff line change
@@ -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,
}
35 changes: 35 additions & 0 deletions lua/plugins/toggleterm.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
return {
'akinsho/toggleterm.nvim',
version = '*',
config = true,
keys = {
{
'<C-t>',
function()
require('toggleterm').toggle()
end,
mode = 'n',
},
{
'<C-t>',
function()
-- vim.cmd '1ToggleTerm'
require('toggleterm').toggle(1)
end,
mode = 't',
},
{
'<A-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',
},
},
}

0 comments on commit 9be3853

Please sign in to comment.