summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/settings.lua
blob: 27ad40d6a9b512e3baa6d932240e3c1b8e74f11b (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
99
100
101
-- ┌───────────────────────┐
-- │      ▐  ▐  ▗          │
-- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│
-- │▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│
-- │▀▀ ▝▀▘ ▀  ▀ ▀▘▘ ▘▗▄▘▀▀ │
-- └───────────────────────┘

local o = vim.o -- [o]ptions
local wo = vim.wo -- [w]indow-local [o]ptions
local bo = vim.bo -- [b]uffer-local [o]ptions
local go = vim.go -- [g]lobal [o]ptions
local opt = vim.opt -- convenient :set

-- neovim filetype lua
go.do_filetype_lua = true
go.did_load_filetypes = false

-- look & feel
o.termguicolors = true

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

-- copy indent on a new line
o.autoindent = true

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

-- use english for spellchecking, but don't spellcheck by default
wo.spell = true
bo.spelllang = "en_gb"
wo.spell = false

-- tab completion, zsh style
o.wildmode = "longest:full,full"
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'
}

-- put one space while joining (not two)
o.joinspaces = false

-- keep n lines above/below cursor while scrolling
o.scrolloff = 4
-- line numbers
o.number = true
-- fold manually, when I place markers
o.foldmethod = "marker"
-- set the terminal title
o.title = true
-- wrap using 'breakat' character
o.linebreak = true
-- new split panes will split to below and right
o.splitbelow = true
o.splitright = true
-- highlight the current line, yoc undoes
o.cursorline = true
-- current line actual number, rest are relative
o.relativenumber = true
-- we are already using a cursorline, don't clobber linter messages
o.showmode = false
-- jump to the matching bracket briefly
o.showmatch = true
-- wait 500 ms for a mapped sequence to complete
o.timeoutlen = 500

-- persistent undo
o.undofile = true

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

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

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

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

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