summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/core/options.lua
blob: 3299e8383360e8528613b27764468bd4b30d7234 (plain)
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
local opts = {
	-- this might not be needed anymore
	termguicolors = true,

	-- copy indent on a new line
	autoindent = true,

	-- :h tabstop, 2. point
	-- use appropriate number of spaces to insert a <Tab>
	expandtab = true,
	shiftwidth = 4,
	softtabstop = 4,
	tabstop = 8,

	-- use english for spellchecking
	spelllang = "en_gb",

	-- tab completion, zsh style
	wildmode = "longest:full,full",

	-- put one space for join (not two)
	joinspaces = false,

	-- keep n lines above/below cursor while scrolling
	scrolloff = 4,

	-- line numbers
	number = true,

	-- manual folding
	foldmethod = "marker",

	-- set the terminal title
	title = true,

	-- wrap using 'breakat' character
	linebreak = true,

	-- new split panes will split to below and right
	splitbelow = true,
	splitright = true,

	-- use relative line numbers
	relativenumber = true,

	-- we are already using a cursorline, don't clobber linter messages
	showmode = false,

	-- jump to the matching bracket briefly
	showmatch = true,

	-- persistent undo
	undofile = true,

	-- lower case searches ignore case, upper case searches do not
	ignorecase = true,
	smartcase = true,

	-- https://stackoverflow.com/a/3445040/
	-- switch case labels
	cinoptions = "l1",

}

for opt, val in pairs(opts) do
	vim.o[opt] = val
end

-- set other options
-- local colorscheme = require("helpers.colorscheme")
-- vim.cmd.colorscheme(colorscheme)

-- interact with system clipboard
vim.opt.clipboard:append('unnamedplus')

vim.opt.wildignore = {
    '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls',
    '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv',
    '*.bbl', '*.bcf', '*.blg', '*-blx.aux', '*-blx.bib', '*.run.xml',
    '*.fdb_latexmk', '*.synctex', '*.synctex(busy)', '*.synctex.gz',
    '*.synctex.gz(busy)', '*.pdfsync'
}

-- iwhite: ignore changes in amount of white space.
-- vertical: start diff mode with vertical splits
-- filler: show filler lines,
vim.opt.diffopt = {
    "iwhite", "vertical", "filler", "algorithm:patience", "indent-heuristic"
}

-- menu: use a popup menu to show the possible completions
-- preview: show extra information
vim.opt.completeopt = {"menu", "menuone", "noselect"}

if vim.fn.executable("rg") then
    vim.o.grepprg = "rg --vimgrep --no-heading --smart-case"
    vim.o.grepformat = "%f:%l:%c:%m,%f:%l:%m"
end