Skip to content

Commit 42d11b9

Browse files
Started refactor to make components more modular
1 parent 82bcac3 commit 42d11b9

23 files changed

+375
-362
lines changed

init.lua

Lines changed: 4 additions & 299 deletions
Original file line numberDiff line numberDiff line change
@@ -6,308 +6,13 @@ vim.g.maplocalleader = ' '
66
vim.wo.relativenumber = true
77
vim.opt.conceallevel = 1
88

9-
-- [[ Install `lazy.nvim` plugin manager ]]
10-
-- https://github.com/folke/lazy.nvim
11-
-- `:help lazy.nvim.txt` for more info
12-
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
13-
if not vim.loop.fs_stat(lazypath) then
14-
vim.fn.system {
15-
'git',
16-
'clone',
17-
'--filter=blob:none',
18-
'https://github.com/folke/lazy.nvim.git',
19-
'--branch=stable', -- latest stable release
20-
lazypath,
21-
}
22-
end
23-
vim.opt.rtp:prepend(lazypath)
24-
25-
-- [[ Configure plugins ]]
26-
-- NOTE: Here is where you install your plugins.
27-
-- You can configure plugins using the `config` key.
28-
--
29-
-- You can also configure plugins after the setup call,
30-
-- as they will be available in your neovim runtime.
31-
require('lazy').setup({
32-
-- NOTE: First, some plugins that don't require any configuration
33-
34-
-- Git related plugins
35-
'tpope/vim-fugitive',
36-
'tpope/vim-rhubarb',
37-
38-
-- Detect tabstop and shiftwidth automatically
39-
'tpope/vim-sleuth',
40-
41-
-- NOTE: This is where your plugins related to LSP can be installed.
42-
-- The configuration is done below. Search for lspconfig to find it below.
43-
{
44-
-- LSP Configuration & Plugins
45-
'neovim/nvim-lspconfig',
46-
dependencies = {
47-
-- Automatically install LSPs to stdpath for neovim
48-
'williamboman/mason.nvim',
49-
'williamboman/mason-lspconfig.nvim',
50-
-- Additional lua configuration, makes nvim stuff amazing!
51-
'folke/neodev.nvim',
52-
},
53-
},
54-
55-
{
56-
-- Autocompletion
57-
'hrsh7th/nvim-cmp',
58-
dependencies = {
59-
-- Snippet Engine & its associated nvim-cmp source
60-
'L3MON4D3/LuaSnip',
61-
'saadparwaiz1/cmp_luasnip',
62-
63-
-- Adds LSP completion capabilities
64-
'hrsh7th/cmp-nvim-lsp',
65-
'hrsh7th/cmp-path',
66-
67-
-- Adds a number of user-friendly snippets
68-
'rafamadriz/friendly-snippets',
69-
},
70-
},
71-
72-
-- Useful plugin to show you pending keybinds.
73-
{ 'folke/which-key.nvim', opts = {} },
74-
{
75-
-- Adds git related signs to the gutter, as well as utilities for managing changes
76-
'lewis6991/gitsigns.nvim',
77-
opts = {
78-
-- See `:help gitsigns.txt`
79-
signs = {
80-
add = { text = '+' },
81-
change = { text = '~' },
82-
delete = { text = '_' },
83-
topdelete = { text = '' },
84-
changedelete = { text = '~' },
85-
},
86-
on_attach = function(bufnr)
87-
local gs = package.loaded.gitsigns
88-
89-
local function map(mode, l, r, opts)
90-
opts = opts or {}
91-
opts.buffer = bufnr
92-
vim.keymap.set(mode, l, r, opts)
93-
end
94-
95-
-- Navigation
96-
map({ 'n', 'v' }, ']c', function()
97-
if vim.wo.diff then
98-
return ']c'
99-
end
100-
vim.schedule(function()
101-
gs.next_hunk()
102-
end)
103-
return '<Ignore>'
104-
end, { expr = true, desc = 'Jump to next hunk' })
105-
106-
map({ 'n', 'v' }, '[c', function()
107-
if vim.wo.diff then
108-
return '[c'
109-
end
110-
vim.schedule(function()
111-
gs.prev_hunk()
112-
end)
113-
return '<Ignore>'
114-
end, { expr = true, desc = 'Jump to previous hunk' })
115-
116-
-- Actions
117-
-- visual mode
118-
map('v', '<leader>hs', function()
119-
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
120-
end, { desc = 'stage git hunk' })
121-
map('v', '<leader>hr', function()
122-
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
123-
end, { desc = 'reset git hunk' })
124-
-- normal mode
125-
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
126-
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
127-
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
128-
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
129-
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
130-
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
131-
map('n', '<leader>hb', function()
132-
gs.blame_line { full = false }
133-
end, { desc = 'git blame line' })
134-
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
135-
map('n', '<leader>hD', function()
136-
gs.diffthis '~'
137-
end, { desc = 'git diff against last commit' })
138-
139-
-- Toggles
140-
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
141-
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
142-
143-
-- Text object
144-
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
145-
end,
146-
},
147-
},
148-
149-
{
150-
-- Theme
151-
"catppuccin/nvim",
152-
name = "catppuccin",
153-
priority = 1000,
154-
155-
config = function()
156-
require("catppuccin").setup({
157-
flavour = "mocha",
158-
transparent_background = true,
159-
})
160-
vim.cmd.colorscheme 'catppuccin'
161-
end,
162-
},
163-
164-
{
165-
-- Set lualine as statusline
166-
'nvim-lualine/lualine.nvim',
167-
-- See `:help lualine.txt`
168-
opts = {
169-
options = {
170-
icons_enabled = false,
171-
theme = 'auto',
172-
component_separators = '|',
173-
section_separators = { left = '', right = '' },
174-
},
175-
},
176-
},
177-
178-
{
179-
-- Add indentation guides even on blank lines
180-
'lukas-reineke/indent-blankline.nvim',
181-
-- Enable `lukas-reineke/indent-blankline.nvim`
182-
-- See `:help ibl`
183-
main = 'ibl',
184-
opts = {},
185-
},
186-
187-
-- "gc" to comment visual regions/lines
188-
{ 'numToStr/Comment.nvim', opts = {} },
189-
190-
-- Fuzzy Finder (files, lsp, etc)
191-
{
192-
'nvim-telescope/telescope.nvim',
193-
branch = '0.1.x',
194-
dependencies = {
195-
'nvim-lua/plenary.nvim',
196-
'nvim-telescope/telescope-ui-select.nvim',
197-
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
198-
-- Only load if `make` is available. Make sure you have the system
199-
-- requirements installed.
200-
{
201-
'nvim-telescope/telescope-fzf-native.nvim',
202-
-- NOTE: If you are having trouble with this installation,
203-
-- refer to the README for telescope-fzf-native for more instructions.
204-
build = 'make',
205-
cond = function()
206-
return vim.fn.executable 'make' == 1
207-
end,
208-
},
209-
},
210-
},
211-
212-
{
213-
-- Highlight, edit, and navigate code
214-
'nvim-treesitter/nvim-treesitter',
215-
dependencies = {
216-
'nvim-treesitter/nvim-treesitter-textobjects',
217-
},
218-
build = ':TSUpdate',
219-
},
220-
221-
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
222-
-- These are some example plugins that I've included in the kickstart repository.
223-
-- Uncomment any of the lines below to enable them.
224-
require 'kickstart.plugins.autoformat',
225-
require 'kickstart.plugins.debug',
226-
227-
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
228-
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
229-
-- up-to-date with whatever is in the kickstart repo.
230-
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
231-
--
232-
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
233-
{ import = 'custom.plugins.plugins' },
234-
}, {})
235-
236-
-- [[ Setting options ]]
237-
-- See `:help vim.o`
238-
-- NOTE: You can change these options as you wish!
239-
240-
-- Set highlight on search
241-
vim.o.hlsearch = false
242-
243-
-- Make line numbers default
244-
vim.wo.number = true
245-
246-
-- Enable mouse mode
247-
vim.o.mouse = 'a'
9+
require('lazy-bootstrap')
24810

249-
-- Sync clipboard between OS and Neovim.
250-
-- Remove this option if you want your OS clipboard to remain independent.
251-
-- See `:help 'clipboard'`
252-
vim.o.clipboard = 'unnamedplus'
11+
require('lazy-plugins')
25312

254-
-- Enable break indent
255-
vim.o.breakindent = true
13+
require('options')
25614

257-
-- Save undo history
258-
vim.o.undofile = true
259-
260-
-- Case-insensitive searching UNLESS \C or capital in search
261-
vim.o.ignorecase = true
262-
vim.o.smartcase = true
263-
264-
-- Keep signcolumn on by default
265-
vim.wo.signcolumn = 'yes'
266-
267-
-- Decrease update time
268-
vim.o.updatetime = 250
269-
vim.o.timeoutlen = 300
270-
271-
-- Set completeopt to have a better completion experience
272-
vim.o.completeopt = 'menuone,noselect'
273-
274-
-- NOTE: You should make sure your terminal supports this
275-
vim.o.termguicolors = true
276-
277-
-- [[ Basic Keymaps ]]
278-
279-
-- Keymaps for better default experience
280-
-- See `:help vim.keymap.set()`
281-
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
282-
vim.keymap.set('n', '<leader>sa', '<cmd>:wa<CR>', { desc = '[S]ave [A]ll buffers' })
283-
vim.keymap.set('n', '<Esc>', '<cmd> noh <CR>', { desc = 'Clear highlighting' })
284-
285-
-- Remap for dealing with word wrap
286-
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
287-
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
288-
289-
-- Diagnostic keymaps
290-
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
291-
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
292-
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
293-
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
294-
295-
-- Move between windows
296-
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Window left' })
297-
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Window right' })
298-
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Window down' })
299-
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Window up' })
300-
301-
-- [[ Highlight on yank ]]
302-
-- See `:help vim.highlight.on_yank()`
303-
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
304-
vim.api.nvim_create_autocmd('TextYankPost', {
305-
callback = function()
306-
vim.highlight.on_yank()
307-
end,
308-
group = highlight_group,
309-
pattern = '*',
310-
})
15+
require('keymaps')
31116

31217
-- [[ Configure Telescope ]]
31318
-- See `:help telescope` and `:help telescope.setup()`

lazy-lock.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,45 @@
33
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
44
"beacon.nvim": { "branch": "master", "commit": "a786c9a89b2c739c69f9500a2f70f2586c06ec27" },
55
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
6-
"catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" },
6+
"catppuccin": { "branch": "main", "commit": "f288876c6d05d3bb91b0e72b8031fe9e26ef05b8" },
77
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
88
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
99
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
1010
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
1111
"copilot.lua": { "branch": "master", "commit": "b03617a6dc4bc88b65ab5deac1631da9a9c2dcaf" },
12+
"fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" },
1213
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
1314
"gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" },
1415
"glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
1516
"inc-rename.nvim": { "branch": "main", "commit": "6f9b5f9cb237e12935144cdc535322b8c93c1b25" },
1617
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
17-
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
18+
"lazy.nvim": { "branch": "main", "commit": "747bb955c5bfb2dc5d51280132f00a56a53f9f6d" },
1819
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
1920
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
2021
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
2122
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
22-
"neodev.nvim": { "branch": "main", "commit": "482abc6688a028ce183719b0350d0235ae2c2e83" },
23+
"neodev.nvim": { "branch": "main", "commit": "aaeb44589cab39c2545a328661af355622d68479" },
2324
"neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
2425
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
2526
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
2627
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
2728
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
2829
"nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" },
2930
"nvim-dap-ui": { "branch": "master", "commit": "a6beb3a855b42faa1d0fee1081602257719c2c5e" },
30-
"nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" },
31+
"nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" },
3132
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
3233
"nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" },
33-
"nvim-treesitter": { "branch": "master", "commit": "5037721ec5870990db16dcbf06513a78a6a81641" },
34+
"nvim-treesitter": { "branch": "master", "commit": "1eb22367b97e277a7fbcf53f5de86167e1d2f523" },
3435
"nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" },
3536
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
36-
"obsidian.nvim": { "branch": "main", "commit": "a9ae6b20560d716a5f9b89252e4ea29c8e64617a" },
37+
"obsidian.nvim": { "branch": "main", "commit": "e2d6ce7b07941b0788177e1297699ad99c1470dc" },
3738
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
3839
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
3940
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
4041
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
4142
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
42-
"tree-sitter-hyprlang": { "branch": "master", "commit": "42aa7274b5f093cec92b7a5bab629ba26b4be439" },
43-
"vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" },
43+
"tree-sitter-hyprlang": { "branch": "master", "commit": "e60fc858e6327a15c0b26f99ec96945fecd1e4ee" },
44+
"vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" },
4445
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
4546
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
4647
"vim-startify": { "branch": "master", "commit": "4e089dffdad46f3f5593f34362d530e8fe823dcf" },

0 commit comments

Comments
 (0)