Skip to content

Commit 1207bdf

Browse files
committed
modular plugins
1 parent 2cbdb13 commit 1207bdf

File tree

19 files changed

+1044
-1228
lines changed

19 files changed

+1044
-1228
lines changed

init.lua

Lines changed: 2 additions & 1217 deletions
Large diffs are not rendered by default.

lua/core/plugins.lua

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
1+
local conform = require 'plugin-configs.conform'
2+
local dapUi = require 'plugin-configs.dap-ui'
3+
local fuzzyFinder = require 'plugin-configs.fuzzy-finder'
4+
local gitsigns = require 'plugin-configs.gitsigns'
5+
local lazyDev = require 'plugin-configs.lazy-dev'
6+
local lspConfig = require 'plugin-configs.lsp-config'
7+
local luvitMeta = require 'plugin-configs.luvit-meta'
8+
local miniNvim = require 'plugin-configs.mini-nvim'
9+
local nvimCmp = require 'plugin-configs.nvim-cmp'
10+
local nvimDap = require 'plugin-configs.nvim-dap'
11+
local obsidian = require 'plugin-configs.obsidian'
12+
local oil = require 'plugin-configs.oil'
13+
local todoComments = require 'plugin-configs.todo-comments'
14+
local tokyoNight = require 'plugin-configs.tokyo-night'
15+
local treesitter = require 'plugin-configs.treesitter'
16+
local whichKey = require 'plugin-configs.which-key'
17+
18+
--return {
19+
-- 'stevearc/oil.nvim',
20+
--
21+
-- -- Optional dependencies
22+
-- dependencies = { { 'echasnovski/mini.icons', opts = {} } },
23+
-- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
24+
-- { 'lewis6991/gitsigns.nvim', opts = 'plugin-configurations.gitsigns' },
25+
-- { 'folke/which-key.nvim', whichKeyConfig },
26+
--} --
127
return {
2-
'stevearc/oil.nvim',
3-
-- Optional dependencies
4-
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
5-
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
6-
{ 'lewis6991/gitsigns.nvim', opts = 'plugin-options.gitsigns' },
7-
} --
28+
conform,
29+
dapUi,
30+
fuzzyFinder,
31+
gitsigns,
32+
lazyDev,
33+
lspConfig,
34+
luvitMeta,
35+
miniNvim,
36+
nvimCmp,
37+
nvimDap,
38+
obsidian,
39+
oil,
40+
todoComments,
41+
tokyoNight,
42+
treesitter,
43+
whichKey,
44+
}

lua/custom/plugins/init.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

lua/plugin-configs/conform.lua

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
return { -- Autoformat
2+
3+
'stevearc/conform.nvim',
4+
event = { 'BufWritePre' },
5+
cmd = { 'ConformInfo' },
6+
-- keys = {
7+
-- {
8+
-- '<leader>f',
9+
-- function()
10+
-- require('conform').format { async = true, lsp_format = 'fallback' }
11+
-- end,
12+
-- mode = '',
13+
-- desc = '[F]ormat buffer',
14+
-- },
15+
-- },
16+
opts = {
17+
notify_on_error = false,
18+
format_on_save = function(bufnr)
19+
-- Disable "format_on_save lsp_fallback" for languages that don't
20+
-- have a well standardized coding style. You can add additional
21+
-- languages here or re-enable it for the disabled ones.
22+
local disable_filetypes = { c = true, cpp = true }
23+
local lsp_format_opt
24+
if disable_filetypes[vim.bo[bufnr].filetype] then
25+
lsp_format_opt = 'never'
26+
else
27+
lsp_format_opt = 'fallback'
28+
end
29+
return {
30+
timeout_ms = 500,
31+
lsp_format = lsp_format_opt,
32+
}
33+
end,
34+
formatters_by_ft = {
35+
lua = { 'stylua' },
36+
-- Conform can also run multiple formatters sequentially
37+
-- python = { "isort", "black" },
38+
--
39+
-- You can use 'stop_after_first' to run the first available formatter from the list
40+
-- javascript = { "prettierd", "prettier", stop_after_first = true },
41+
},
42+
},
43+
}

lua/plugin-configs/dap-ui.lua

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
return {
2+
'rcarriga/nvim-dap-ui',
3+
dependencies = { 'nvim-neotest/nvim-nio' },
4+
-- stylua: ignore
5+
keys = {
6+
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
7+
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
8+
},
9+
opts = {},
10+
config = function(_, opts)
11+
local dap = require 'dap'
12+
local mason_registry = require 'mason-registry'
13+
local codelldb = mason_registry.get_package 'codelldb'
14+
local ext_path = codelldb:get_install_path() .. '/extension/'
15+
local codelldb_path = ext_path .. 'adapter/codelldb'
16+
local liblldb_path = ext_path .. 'lldb/lib/liblldb.dylib'
17+
local dapui = require 'dapui'
18+
dapui.setup(opts)
19+
dap.listeners.after.event_initialized['dapui_config'] = function()
20+
dapui.open {}
21+
end
22+
dap.listeners.before.event_terminated['dapui_config'] = function()
23+
dapui.close {}
24+
end
25+
dap.listeners.before.event_exited['dapui_config'] = function()
26+
dapui.close {}
27+
end
28+
dap.adapters.lldb = {
29+
type = 'executable',
30+
command = codelldb_path, -- adjust as needed, must be absolute path
31+
name = 'lldb',
32+
}
33+
34+
dap.adapters.cpp = {
35+
type = 'executable',
36+
attach = {
37+
pidProperty = 'pid',
38+
pidSelect = 'ask',
39+
},
40+
command = codelldb_path,
41+
env = {
42+
LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = 'YES',
43+
},
44+
name = 'lldb',
45+
}
46+
47+
dap.configurations.cpp = {
48+
{
49+
name = 'lldb',
50+
type = 'cpp',
51+
request = 'launch',
52+
program = function()
53+
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/Binaries/App/App.exe', 'file')
54+
end,
55+
cwd = '${workspaceFolder}',
56+
externalTerminal = false,
57+
stopOnEntry = false,
58+
args = {},
59+
},
60+
}
61+
end,
62+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
return { -- Fuzzy Finder (files, lsp, etc)
2+
'nvim-telescope/telescope.nvim',
3+
event = 'VimEnter',
4+
branch = '0.1.x',
5+
dependencies = {
6+
'nvim-lua/plenary.nvim',
7+
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
8+
'nvim-telescope/telescope-fzf-native.nvim',
9+
10+
-- `build` is used to run some command when the plugin is installed/updated.
11+
-- This is only run then, not every time Neovim starts up.
12+
build = 'make',
13+
14+
-- `cond` is a condition used to determine whether this plugin should be
15+
-- installed and loaded.
16+
cond = function()
17+
return vim.fn.executable 'make' == 1
18+
end,
19+
},
20+
{ 'nvim-telescope/telescope-ui-select.nvim' },
21+
22+
-- Useful for getting pretty icons, but requires a Nerd Font.
23+
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
24+
},
25+
config = function()
26+
-- Telescope is a fuzzy finder that comes with a lot of different things that
27+
-- it can fuzzy find! It's more than just a "file finder", it can search
28+
-- many different aspects of Neovim, your workspace, LSP, and more!
29+
--
30+
-- The easiest way to use Telescope, is to start by doing something like:
31+
-- :Telescope help_tags
32+
--
33+
-- After running this command, a window will open up and you're able to
34+
-- type in the prompt window. You'll see a list of `help_tags` options and
35+
-- a corresponding preview of the help.
36+
--
37+
-- Two important keymaps to use while in Telescope are:
38+
-- - Insert mode: <c-/>
39+
-- - Normal mode: ?
40+
--
41+
-- This opens a window that shows you all of the keymaps for the current
42+
-- Telescope picker. This is really useful to discover what Telescope can
43+
-- do as well as how to actually do it!
44+
45+
-- [[ Configure Telescope ]]
46+
-- See `:help telescope` and `:help telescope.setup()`
47+
require('telescope').setup {
48+
-- You can put your default mappings / updates / etc. in here
49+
-- All the info you're looking for is in `:help telescope.setup()`
50+
--
51+
-- defaults = {
52+
-- mappings = {
53+
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
54+
-- },
55+
-- },
56+
-- pickers = {}
57+
extensions = {
58+
['ui-select'] = {
59+
require('telescope.themes').get_dropdown(),
60+
},
61+
},
62+
}
63+
64+
-- Enable Telescope extensions if they are installed
65+
pcall(require('telescope').load_extension, 'fzf')
66+
pcall(require('telescope').load_extension, 'ui-select')
67+
68+
-- See `:help telescope.builtin`
69+
end,
70+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
return {
2+
'lewis6991/gitsigns.nvim',
23
signs = {
34
add = { text = '+' },
45
change = { text = '~' },

lua/plugin-configs/lazy-dev.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
return
2+
-- LSP Plugins
3+
{
4+
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
5+
-- used for completion, annotations and signatures of Neovim apis
6+
'folke/lazydev.nvim',
7+
ft = 'lua',
8+
opts = {
9+
library = {
10+
-- Load luvit types when the `vim.uv` word is found
11+
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
12+
},
13+
},
14+
}

0 commit comments

Comments
 (0)