-- SPDX-FileCopyrightText: (C) 2026 Sushant Mondal <contact@sushantmondal.com>
--
-- SPDX-License-Identifier: GPL-3.0-only
--
-- * My Neovim configuration file when editing my www source files.
-- * Run `mkdir -p ~/.config/nvim && echo 'vim.opt.exrc = true' > ~/.config/nvim/init.lua` and: `v`
--   to view -> `:trust` to trust this config file.
-- * Use `source-highlight -s lua -f html -i .nvim.lua -o .nvim.lua.html` after every change to
--   `.nvim.lua` to generate this www document (`.nvim.lua.html`).

-- Strip trailing whitespaces using `sed`.
vim.api.nvim_create_autocmd('BufWritePost', {
  pattern = '*',
  command = "silent !sed -i 's/[[:blank:]]*$//' %",
})

-- Do not exceed this maximum column limit for the www source files.
vim.opt.colorcolumn = "100"

vim.opt.expandtab = true
vim.opt.fileformat = "unix"
vim.opt.fixendofline = true
vim.opt.number = true

-- Useful for jumping between paragraphs of code.
vim.opt.relativenumber = true

-- CSS/HTML/JS/PHP: 2-space indentation, uniform!
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.tabstop = 2