feat: initial NEAR functional commit

This commit is enough to make nvim start and bootstrap lazy
to actually use this commit as a base for your own config
- Add the directory 'lua/plugins/spec'
- Place plugin specs there
- Edit configuration as needed
This commit is contained in:
Robert Morrison 2025-09-14 02:33:21 +01:00
commit 736ff3bef4
7 changed files with 175 additions and 0 deletions

12
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-toml
- id: check-yaml
- id: mixed-line-ending
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.18.0
hooks:
- id: stylua # or stylua-system / stylua-github

1
init.lua Normal file
View File

@ -0,0 +1 @@
require("core").setup()

4
lazy-lock.json Normal file
View File

@ -0,0 +1,4 @@
{
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }
}

30
lua/core/autocommands.lua Normal file
View File

@ -0,0 +1,30 @@
-- Control cursorline option
-- This function allows the easy creation of autocommands that configure cursorline for one buffer
-- either based on events or filetypes
local auGroupCursorLine = vim.api.nvim_create_augroup("CursorLine", { clear = true })
local set_cursorline = function(event, value, pattern)
vim.api.nvim_create_autocmd(event, {
group = auGroupCursorLine,
pattern = pattern,
callback = function()
vim.opt_local.cursorline = value
end,
})
end
set_cursorline("WinLeave", false)
set_cursorline("WinEnter", true)
set_cursorline("FileType", false, "TelescopePrompt")
-- Wrangle formatoptions
-- Format options is local to the buffer
-- This autocommand fixes formatoptions for all buffers at load
local auGroupFormatOptions = vim.api.nvim_create_augroup("FormatOptions", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = auGroupFormatOptions,
pattern = "*",
callback = function()
vim.opt.formatoptions = vim.opt.formatoptions -- take the default
- "r" -- remove auto commenting
- "o" -- and for newlines
end,
})

9
lua/core/init.lua Normal file
View File

@ -0,0 +1,9 @@
local M = {}
M.setup = function()
require("core.options")
require("core.autocommands")
require("plugins.lazy")
end
return M

96
lua/core/options.lua Normal file
View File

@ -0,0 +1,96 @@
-- Default options for all file types
local opt = vim.opt -- lazy shortcut to save on typing
vim.g.mapleader = "\\"
vim.g.maplocalleader = ","
-- Show line number for current line
-- And the relative line for all others
opt.relativenumber = true
opt.number = true
-- Make searching easier
opt.ignorecase = true -- Searching should not care about case
opt.smartcase = true -- except from when you specify it in the search
opt.hlsearch = true -- highlights all searches (this is now a Nvim DEFAULT)
opt.incsearch = ture -- begins searching as you type (also a DEFAULT)
-- Split in a more sensible manner
-- Splits go to the right or bottom keeping the original in the top left
-- This is similar to the dwm/dwl attachtop patch
opt.splitright = true
opt.splitbelow = true
-- Setting timeout allows whichkey to appear much faster
-- In this case immediately
opt.timeout = true
opt.timeoutlen = 0
-- Keep more context on screen where possible
opt.scrolloff = 15
opt.sidescroll = 6
-- Force full 24 colour support
-- Nvim should detect this but it doesn't always
opt.termguicolors = true
-- let Nvim set terminal title
opt.title = true
-- Set default spell language (correctly this time)
opt.spelllang = "en_gb"
-- Ignore some files (compiled) when expanding or globbing
opt.wildignore = {
"*pycache*",
"*.o",
"*~",
"*.pyc",
"*.pdf",
}
-- configure folding
opt.foldmethod = "expr" -- use an expression for folding
opt.foldexpr = "nvim_treesitter#foldexpr()" -- Use treesitter to fold
opt.foldminlines = 5 -- don't fold small items
opt.foldclose = "all" -- close any out of focus fold
opt.foldlevelstart = 1 -- always show top level
-- configure sign column (this is used by some plugins)
opt.signcolumn = "auto:2-5" -- auto-size from 2 to 5 cells
-- highlight the line the cursor is on
opt.cursorline = true
-- UI
opt.showmode = false -- do not show current mode (this is done by my statusline plugin)
opt.showcmd = true
opt.cmdheight = 1
opt.background = "dark"
opt.laststatus = 0
-- indentation & wrapping
opt.autoindent = true -- inherit indenting when adding new lines
opt.cindent = true
opt.wrap = true -- long lines will wrap
opt.tabstop = 4 -- medium tabs
opt.shiftwidth = 4
opt.softtabstop = 4
opt.expandtab = false -- Tabs > Spaces Tab Supremacy!!
opt.breakindent = true -- make it easier to see where line wrapping occured
opt.showbreak = ""
opt.linebreak = true
-- MISC
opt.belloff = "all" -- no window flashing or beeping
opt.clipboard = "unnamedplus" -- clipboard links to system clipboard (providing appropriate tools are installed)
opt.mouse = "a" -- use mouse in all modes
opt.shortmess = ""
.. "s" -- don't give search messages
.. "W" -- don't give file written messages
.. "I" -- don't give intro message
.. "F" -- don't give file info when editing

23
lua/plugins/lazy/init.lua Normal file
View File

@ -0,0 +1,23 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
{ import = "plugins.spec" },
},
checker = { enabled = true },
})