@@ -6,308 +6,13 @@ vim.g.maplocalleader = ' '
6
6
vim .wo .relativenumber = true
7
7
vim .opt .conceallevel = 1
8
8
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' )
248
10
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' )
253
12
254
- -- Enable break indent
255
- vim .o .breakindent = true
13
+ require (' options' )
256
14
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' )
311
16
312
17
-- [[ Configure Telescope ]]
313
18
-- See `:help telescope` and `:help telescope.setup()`
0 commit comments