-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
settings.lua
119 lines (101 loc) · 3.72 KB
/
settings.lua
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
-- Indentation
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
-- Search
vim.opt.ignorecase = true -- Case insensitive search
vim.opt.smartcase = true -- But sensitive if includes capital letter
vim.opt.grepprg = 'rg --ignore-case --vimgrep'
vim.opt.grepformat = '%f:%l:%c:%m,%f:%l:%m'
vim.opt.path = '**'
-- Ignore some folders and files with find
vim.opt.wildignore = {
'**/node_modules/**',
'**/coverage/**',
'**/.idea/**',
'**/.git/**',
'**/.nuxt/**',
}
-- UI
vim.opt.wrap = false
vim.opt.linebreak = true -- Break lines by spaces or tabs
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.signcolumn = 'yes'
vim.opt.statuscolumn =
"%C%=%4{&nu && v:virtnum <= 0 ? (&rnu ? (v:lnum == line('.') ? v:lnum . ' ' : v:relnum) : v:lnum) : ''}%=%s"
vim.opt.showmode = false
vim.opt.list = true
vim.opt.listchars = {
nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
tab = ' ',
extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
trail = '·', -- Dot Operator (U+22C5)
}
-- Show cool character on line wrap
vim.opt.showbreak = '↳ ' -- DOWNWARDS ARROW WITH TIP RIGHTWARDS (U+21B3, UTF-8: E2 86 B3)
vim.opt.fillchars = {
eob = ' ', -- Suppress ~ at EndOfBuffer
fold = ' ', -- Hide trailing folding characters
diff = '╱',
foldopen = '',
foldclose = '',
}
vim.opt.colorcolumn = { 81, 121 } -- Highlight columns
vim.opt.showmode = false -- Do not show mode in command line
-- Folds
vim.opt.foldcolumn = '0'
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldenable = true
vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.opt.foldtext = ''
-- UX
vim.opt.confirm = true
vim.opt.updatetime = 100 -- Trigger cursorhold faster
vim.opt.splitright = true -- Open new split to the right
vim.opt.splitbelow = true -- Open new split below
vim.opt.splitkeep = 'screen'
vim.opt.whichwrap = vim.opt.whichwrap + 'h,l,<,>,[,]'
vim.opt.completeopt = { 'menuone', 'noselect' } -- Completion menu
vim.opt.pumheight = 13
-- Autoformatting
-- TODO: Can we get rid of concat here?
vim.opt.formatoptions = table.concat {
'2', -- Use the second line's indent vale when indenting (allows indented first line)
'q', -- Formatting comments with `gq`
'w', -- Trailing whitespace indicates a paragraph
'j', -- Remove comment leader when makes sense (joining lines)
'r', -- Insert comment leader after hitting Enter
'o', -- Insert comment leader after hitting `o` or `O`
}
-- Messages
vim.opt.shortmess:append {
I = true, -- No splash screen
W = true, -- Don't print "written" when editing
a = true, -- Use abbreviations in messages ([RO] intead of [readonly])
c = true, -- Do not show ins-completion-menu messages (match 1 of 2)
F = true, -- Do not print file name when opening a file
s = true, -- Do not show "Search hit BOTTOM" message
}
-- Integration with the system clipboard
vim.opt.clipboard = { 'unnamed', 'unnamedplus' }
-- Navigation
vim.opt.scrolloff = 5 -- Lines to scroll when cursor leaves screen
vim.opt.sidescrolloff = 3 -- Lines to scroll horizontally
vim.opt.suffixesadd = { '.md', '.js', '.ts', '.tsx' } -- File extensions not required when opening with `gf`
-- Backups
vim.opt.backup = true
vim.opt.backupdir = { vim.env.XDG_DATA_HOME .. '/nvim/backups' }
vim.opt.backupskip = { '/tmp/*', '/private/tmp/*' }
vim.opt.writebackup = true
-- Undo & History
vim.opt.undofile = true
vim.opt.undolevels = 1000
vim.opt.undoreload = 10000
vim.opt.shada = { '!', "'1000", '<50', 's10', 'h' } -- Increase the shadafile size so that history is longer
-- Sesssions
vim.opt.sessionoptions:remove { 'buffers', 'folds' }