This is the first commit that actually adds files to the repo. Yes it's a bad commit but now the major features are here
116 lines
2.5 KiB
Lua
116 lines
2.5 KiB
Lua
-- Global settings
|
|
|
|
local opt = vim.opt -- make things quicker to type
|
|
|
|
opt.relativenumber = true
|
|
opt.number = true -- display the current line number instead of 0
|
|
|
|
-- Make searching a little better
|
|
opt.ignorecase = true
|
|
opt.smartcase = true
|
|
opt.hlsearch = true
|
|
opt.incsearch = true
|
|
|
|
opt.splitright = true
|
|
opt.splitbelow = true
|
|
|
|
-- write to swap file after this much wait time,
|
|
-- also defines CursorHold
|
|
opt.updatetime = 50
|
|
|
|
-- Scrolloff and sidescroll to keep context on screen
|
|
opt.scrolloff = 15
|
|
opt.sidescroll = 6
|
|
|
|
-- Use 24 colours in terminal
|
|
opt.termguicolors = true
|
|
|
|
-- Set terminal title
|
|
opt.title = true
|
|
|
|
-- Spell in english
|
|
opt.spelllang = 'en_gb'
|
|
|
|
-- Ignore compiled files.
|
|
opt.wildignore = {
|
|
"*pycache*",
|
|
"*.o",
|
|
"*~",
|
|
"*.pyc"}
|
|
|
|
-- sign column (mid width 2 max width 5)
|
|
opt.signcolumn = "auto:2-5"
|
|
|
|
-- Cursorline
|
|
-- Configured to only show in the current buffer
|
|
opt.cursorline = true -- start enabled
|
|
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") -- no cursorline for Telescope
|
|
|
|
-- UI
|
|
opt.showmode = false
|
|
opt.showcmd = true
|
|
opt.cmdheight = 1
|
|
|
|
|
|
-- Indentation
|
|
opt.autoindent = true
|
|
opt.cindent = true
|
|
opt.wrap = true
|
|
|
|
opt.tabstop = 4
|
|
opt.shiftwidth = 4
|
|
opt.softtabstop = 4
|
|
opt.expandtab = false
|
|
|
|
opt.breakindent = true
|
|
opt.showbreak = '>'
|
|
opt.linebreak = true
|
|
|
|
|
|
-- Misc
|
|
opt.belloff = "all"
|
|
opt.clipboard = "unnamedplus" -- sync to system clipboard
|
|
opt.mouse = "a"
|
|
|
|
-- Odd format options
|
|
-- fixes a few bugbears of mine.
|
|
|
|
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
|
|
- "r" -- don't auto comment
|
|
- "o" -- REALLY don't auto comment
|
|
end
|
|
})
|
|
|
|
opt.shortmess = ""
|
|
.. "f" -- short filecount
|
|
.. "l" -- shorten lines and bytes count
|
|
.. "m" -- [modified] -> [+]
|
|
.. "n" -- [NewFile] -> [New]
|
|
.. "r" -- [readonly] -> [RO]
|
|
.. "w" -- written -> [w]
|
|
.. "x" -- Short format
|
|
.. "o" -- read message replaces write message
|
|
.. "O" -- read message overwrite previous message
|
|
.. "s" -- Don't say when search wraps
|
|
.. "I" -- Don't show intro message
|