~/.config/nvim/init.lua
This is my configuration file for Neovim, a highly configurable text editor, which I highly recommend.
If you are interested, my configuration file is available for download as well.
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
-- Author: microfracture / https://linuxious.com/
-- Updated: 2026-06-07
local g = vim.g
g.mapleader = " " -- Key used for custom key mappings
g.maplocalleader = " " -- Same, but for certain file types/buffers
local opt = vim.opt
-- ============================================================================
-- Appearance
-- ============================================================================
opt.termguicolors = true -- Enable true color support
opt.background = "dark" -- Enable colors for dark backgrounds
opt.number = true -- Always show line numbers
opt.cursorline = true -- Highlight the line with the cursor
opt.scrolloff = 4 -- Keep 4 lines above/below the cursor
opt.textwidth = 80 -- Maximum text length before a new line
opt.colorcolumn = "80" -- A visual guide for column 80
opt.laststatus = 3 -- Always show the statusline
opt.signcolumn = "yes" -- Always show the sign column
opt.splitbelow = true -- Horizontal split below the window
opt.splitright = true -- Vertical split to the right of the window
-- ============================================================================
-- Tabs and Folds
-- ============================================================================
opt.expandtab = true -- Use spaces instead of tabs
opt.autoindent = true -- Enable automatic indentation
opt.smartindent = false -- Disable smart auto-indenting new lines
opt.preserveindent = true -- Preserves indentation when pasting text
opt.foldenable = true -- Enable folding
opt.foldlevel = 99 -- All folds are open upon start
opt.foldlevelstart = 99 -- All folds are open when opening a file
-- ============================================================================
-- Clipboard and Undo
-- ============================================================================
opt.clipboard = "unnamedplus" -- Use the system clipboard
opt.undofile = true -- Enable persistent undo
-- Set the undo directory to ~/.local/state/nvim/undo
-- (or wherever your state directory is located)
opt.undodir = vim.fn.stdpath("state") .. "/undo"
-- ============================================================================
-- Load Plugins
-- ============================================================================
--[[
Plugins:
alpha-nvim: Greeter
barbar: Tabline
blink.cmp: A fast completion plugin
friendly-snippets: Snippets collection for various languages
fzf-lua: Integrates fzf / fuzzy finding into Nvim
indent-blankline: Indentation guides
nvim-colorizer: Color highlighter
nvim-lualine: Statusline
nvim-scrollview: Interactive vertical scrollbars
nvim-tree: File explorer
nvim-treesitter: Treesitter configurations
nvim-web-devicons: Adds Nerd font icons.
which-key: Shows available key binds within a popup
Colorschemes:
vague: A nice dark and low contrast colorscheme
]]--
vim.pack.add({
{
src = "https://github.com/nvim-treesitter/nvim-treesitter",
version = "main",
data = {
run = function(_) vim.cmd "TSUpdate" end,
},
},
{
src = "https://github.com/saghen/blink.cmp",
version = vim.version.range("1.*"),
},
"https://github.com/goolord/alpha-nvim",
"https://github.com/romgrk/barbar.nvim",
"https://github.com/rafamadriz/friendly-snippets",
"https://github.com/ibhagwan/fzf-lua",
"https://github.com/lukas-reineke/indent-blankline.nvim",
"https://github.com/catgoose/nvim-colorizer.lua",
"https://github.com/nvim-lualine/lualine.nvim",
"https://github.com/dstein64/nvim-scrollview",
"https://github.com/nvim-tree/nvim-tree.lua",
"https://github.com/folke/which-key.nvim",
-- Dependencies
"https://github.com/nvim-tree/nvim-web-devicons",
-- Colorschemes
"https://github.com/vague-theme/vague.nvim",
})
-- ============================================================================
-- Configure Plugins
-- ============================================================================
-- Enable the vague colorscheme
vim.cmd.colorscheme("vague")
-- No config needed. Just setup
require("lualine").setup()
require("colorizer").setup()
-- alpha-nvim
local status_ok, alpha = pcall(require, "alpha")
if status_ok then
local dashboard = require("alpha.themes.startify")
alpha.setup(dashboard.config)
end
-- nvim-tree
require("nvim-tree").setup({
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
})
-- blink.cmp
require("blink.cmp").setup({
keymap = {
preset = "super-tab",
},
sources = {
default = {
"lsp",
"path",
"snippets",
"buffer",
},
},
})
-- treesitter
vim.api.nvim_create_autocmd('FileType', {
pattern = {
"css",
"html",
"javascript",
"json",
"lua",
"markdown",
"python",
"ruby",
"scss",
"xml",
"yaml",
},
callback = function()
-- Enable highlighting
vim.treesitter.start()
-- Enable folding
opt.foldmethod = "expr"
opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- Enable experimental indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})