1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
| -- Bootstrap lazy.nvim if it has not been installed yet.
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
-- Colorscheme. Load first so every UI plugin can pick up the theme.
{
"catppuccin/nvim",
name = "catppuccin",
lazy = false,
priority = 1000,
opts = {
flavour = "mocha",
transparent_background = false,
auto_integrations = true,
integrations = {
cmp = true,
gitsigns = true,
native_lsp = {
enabled = true,
},
neotree = true,
telescope = true,
treesitter = true,
trouble = true,
which_key = true,
},
},
config = function(_, opts)
require("catppuccin").setup(opts)
vim.cmd.colorscheme("catppuccin")
end,
},
-- Fuzzy finder for files, grep, buffers, help, and LSP lists.
{
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = {
"nvim-lua/plenary.nvim",
},
},
-- Completion engine and snippet support. The actual completion behavior lives
-- in lua/config/completion.lua.
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
},
-- Syntax-aware highlighting and indentation.
{
"nvim-treesitter/nvim-treesitter",
branch = "master",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"go",
"gomod",
"gosum",
"gowork",
"lua",
"query",
"vim",
"vimdoc",
},
highlight = {
enable = true,
},
indent = {
enable = true,
},
})
end,
},
-- File tree and Git status tree.
{
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
},
keys = {
{
"<leader>e",
"<cmd>Neotree toggle position=float reveal_force_cwd<cr>",
desc = "Toggle file tree",
},
{
"<leader>gs",
"<cmd>Neotree float git_status<cr>",
desc = "Neo-tree git status",
},
},
opts = {
enable_git_status = true,
source_selector = {
winbar = true,
statusline = false,
},
filesystem = {
follow_current_file = {
enabled = true,
},
use_libuv_file_watcher = true,
},
},
},
-- Git signs in the sign column and hunk-level actions.
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, desc = desc })
end
map("n", "]h", gs.next_hunk, "Next git hunk")
map("n", "[h", gs.prev_hunk, "Previous git hunk")
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
map("n", "<leader>hb", gs.blame_line, "Git blame line")
end,
},
},
-- Full Git UI for status, staging, committing, pushing, and pulling.
{
"NeogitOrg/neogit",
dependencies = {
"nvim-lua/plenary.nvim",
"sindrets/diffview.nvim",
"nvim-telescope/telescope.nvim",
},
keys = {
{ "<leader>gg", "<cmd>Neogit<cr>", desc = "Open Neogit" },
},
opts = {},
},
-- Dedicated Git diff and file history views.
{
"sindrets/diffview.nvim",
cmd = {
"DiffviewOpen",
"DiffviewClose",
"DiffviewFileHistory",
},
keys = {
{ "<leader>gd", "<cmd>DiffviewOpen<cr>", desc = "Open git diff view" },
{ "<leader>gD", "<cmd>DiffviewClose<cr>", desc = "Close git diff view" },
{ "<leader>gh", "<cmd>DiffviewFileHistory %<cr>", desc = "Current file history" },
},
},
-- Shows possible keybindings after pressing leader keys.
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
preset = "modern",
},
},
-- Statusline with mode, branch, diff, diagnostics, filetype, and location.
{
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
event = "VeryLazy",
opts = {
options = {
theme = "catppuccin",
globalstatus = true,
component_separators = { left = "|", right = "|" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff" },
lualine_c = {
{
"filename",
path = 1,
},
},
lualine_x = { "diagnostics", "encoding", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
},
},
-- Better UI for diagnostics, quickfix, location list, and references.
{
"folke/trouble.nvim",
cmd = "Trouble",
opts = {},
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer diagnostics",
},
{
"<leader>xq",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix list",
},
{
"<leader>xl",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location list",
},
{
"<leader>xr",
"<cmd>Trouble lsp_references toggle focus=true<cr>",
desc = "LSP references",
},
},
},
})
|