2024-03-06 02:24:31 +01:00
|
|
|
local cmd = vim.cmd
|
|
|
|
local fn = vim.fn
|
|
|
|
local opt = vim.o
|
|
|
|
local g = vim.g
|
|
|
|
|
|
|
|
-- <leader> key. Defaults to `\`. Some people prefer space.
|
2024-03-19 01:54:01 +01:00
|
|
|
g.mapleader = ' '
|
2024-03-06 02:24:31 +01:00
|
|
|
-- g.maplocalleader = ' '
|
2024-05-21 15:25:03 +02:00
|
|
|
vim.opt.wrap = false
|
2024-03-06 02:24:31 +01:00
|
|
|
|
|
|
|
opt.compatible = false
|
|
|
|
|
|
|
|
-- Enable true colour support
|
|
|
|
if fn.has('termguicolors') then
|
|
|
|
opt.termguicolors = true
|
|
|
|
end
|
|
|
|
|
|
|
|
-- See :h <option> to see what the options do
|
|
|
|
|
|
|
|
-- Search down into subfolders
|
|
|
|
opt.path = vim.o.path .. '**'
|
|
|
|
|
|
|
|
opt.number = true
|
|
|
|
opt.relativenumber = true
|
|
|
|
opt.cursorline = true
|
|
|
|
opt.lazyredraw = true
|
|
|
|
opt.showmatch = true -- Highlight matching parentheses, etc
|
|
|
|
opt.incsearch = true
|
|
|
|
opt.hlsearch = true
|
2024-05-21 15:25:03 +02:00
|
|
|
opt.ignorecase = true -- Make search case insensitive
|
|
|
|
opt.smartcase = true -- Overrides ignorecase if your pattern contains mixed case
|
2024-03-06 02:24:31 +01:00
|
|
|
|
|
|
|
opt.spell = true
|
|
|
|
opt.spelllang = 'en'
|
|
|
|
|
|
|
|
opt.expandtab = true
|
|
|
|
opt.tabstop = 2
|
|
|
|
opt.softtabstop = 2
|
|
|
|
opt.shiftwidth = 2
|
|
|
|
opt.foldenable = true
|
|
|
|
opt.history = 2000
|
|
|
|
opt.nrformats = 'bin,hex' -- 'octal'
|
|
|
|
opt.undofile = true
|
|
|
|
opt.splitright = true
|
|
|
|
opt.splitbelow = true
|
|
|
|
opt.cmdheight = 0
|
|
|
|
|
|
|
|
opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
|
|
|
|
|
|
|
-- Configure Neovim diagnostic messages
|
|
|
|
|
|
|
|
local function prefix_diagnostic(prefix, diagnostic)
|
|
|
|
return string.format(prefix .. ' %s', diagnostic.message)
|
|
|
|
end
|
|
|
|
|
|
|
|
local sign = function(opts)
|
|
|
|
fn.sign_define(opts.name, {
|
|
|
|
texthl = opts.name,
|
|
|
|
text = opts.text,
|
|
|
|
numhl = '',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
-- Requires Nerd fonts
|
|
|
|
sign { name = 'DiagnosticSignError', text = '' }
|
|
|
|
sign { name = 'DiagnosticSignWarn', text = '⚠' }
|
|
|
|
sign { name = 'DiagnosticSignInfo', text = 'ⓘ' }
|
|
|
|
sign { name = 'DiagnosticSignHint', text = '' }
|
|
|
|
|
|
|
|
vim.diagnostic.config {
|
|
|
|
virtual_text = {
|
|
|
|
prefix = '',
|
|
|
|
format = function(diagnostic)
|
|
|
|
local severity = diagnostic.severity
|
|
|
|
if severity == vim.diagnostic.severity.ERROR then
|
|
|
|
return prefix_diagnostic('', diagnostic)
|
|
|
|
end
|
|
|
|
if severity == vim.diagnostic.severity.WARN then
|
|
|
|
return prefix_diagnostic('⚠', diagnostic)
|
|
|
|
end
|
|
|
|
if severity == vim.diagnostic.severity.INFO then
|
|
|
|
return prefix_diagnostic('ⓘ', diagnostic)
|
|
|
|
end
|
|
|
|
if severity == vim.diagnostic.severity.HINT then
|
|
|
|
return prefix_diagnostic('', diagnostic)
|
|
|
|
end
|
|
|
|
return prefix_diagnostic('■', diagnostic)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
signs = true,
|
|
|
|
update_in_insert = false,
|
|
|
|
underline = true,
|
|
|
|
severity_sort = true,
|
|
|
|
float = {
|
|
|
|
focusable = false,
|
|
|
|
style = 'minimal',
|
|
|
|
border = 'rounded',
|
|
|
|
source = 'always',
|
|
|
|
header = '',
|
|
|
|
prefix = '',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
g.editorconfig = true
|
|
|
|
|
2024-03-06 18:55:22 +01:00
|
|
|
cmd[[colorscheme tokyonight]]
|
2024-05-21 15:25:03 +02:00
|
|
|
vim.opt.colorcolumn = '80,100'
|
2024-03-06 02:24:31 +01:00
|
|
|
|
|
|
|
-- Native plugins
|
|
|
|
cmd.filetype('plugin', 'indent', 'on')
|
|
|
|
cmd.packadd('cfilter') -- Allows filtering the quickfix list with :cfdo
|
|
|
|
|
|
|
|
-- let sqlite.lua (which some plugins depend on) know where to find sqlite
|
|
|
|
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
|
|
|
|
|
|
|
-- this should be at the end, because
|
|
|
|
-- it causes neovim to source ftplugins
|
|
|
|
-- on the packpath when passing a file to the nvim command
|
|
|
|
cmd.syntax('on')
|
|
|
|
cmd.syntax('enable')
|