-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.lua
220 lines (198 loc) · 5.12 KB
/
init.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
-- security
vim.o.exrc = false -- ignore ~/.exrc
vim.o.secure = true -- disallow local rc exec
-- tab / whitespace control
vim.o.expandtab = true -- expand hard tabs to spaces
vim.o.softtabstop = 4 -- expand tabs to 4 spaces
vim.o.tabstop = 8 -- use 8 spaces for hard tabs
-- formatting options
vim.o.autoindent = true
vim.o.shiftwidth = 4
vim.o.shiftround = true
vim.o.textwidth = 79
vim.opt.formatoptions = vim.opt.formatoptions
+ 't'
+ 'c'
+ 'r'
- 'o'
+ 'q'
- 'a'
+ 'n'
- '2'
+ 'j'
-- display settings
vim.o.number = true
vim.o.ruler = true
vim.o.hidden = true
vim.o.hlsearch = true
vim.opt.listchars = {
trail = '-',
nbsp = '+',
eol = '$',
tab = '>-'
}
vim.opt.termguicolors = true
vim.opt.syntax = 'on'
vim.opt.laststatus = 2
-- windows
vim.o.splitbelow = true
vim.o.splitright = true
-- editing
vim.o.mouse = ''
vim.o.showmatch = true
vim.o.clipboard = 'unnamed,unnamedplus'
vim.o.undofile = true
vim.o.undodir = vim.env.HOME .. '/.vim/undodir'
vim.o.backspace = 'indent,eol,start'
-- spelling
-- set spell to activate
vim.o.spelllang = 'en_us'
---- remap O and o to not leave things in insert mode
vim.api.nvim_set_keymap('n', 'O', 'O<esc>', {noremap = true})
vim.api.nvim_set_keymap('n', 'o', 'o<esc>', {noremap = true})
-- disable unused providers to speed up start up
vim.g.loaded_ruby_provider = 0
vim.g.loaded_python_provider = 0
vim.g.loaded_python3_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_node_provider = 0
-- plugins
vim.cmd('packadd paq-nvim')
local paq = require('paq').paq
paq({'savq/paq-nvim', opt = true})
paq({'nvim-treesitter/nvim-treesitter'})
require('nvim-treesitter.configs').setup({
folding = {enable = true},
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
incremental_selection = {enable = true},
ensure_installed = {
'bash',
'c',
'comment',
'cpp',
'devicetree',
'diff',
'disassembly',
'dockerfile',
'editorconfig',
'git_rebase',
'gitcommit',
'gitignore',
'go',
'groovy',
'javascript',
'json',
'kconfig',
'latex',
'lua',
'make',
'markdown',
'markdown_inline',
'meson',
'ninja',
'passwd',
'pem',
'perl',
'promql',
'proto',
'python',
'query',
'regex',
'rust',
'ssh_config',
'strace',
'toml',
'udev',
'vim',
'xml',
'yaml'
}
})
vim.o.foldmethod = 'expr'
vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
vim.o.foldenable = false
paq({'norcalli/nvim-colorizer.lua'})
require('colorizer').setup()
paq({'marko-cerovac/material.nvim'})
require('material').setup({
custom_colors = require('custom-material-colors').colors,
style = 'darker'
})
vim.cmd([[colorscheme material]])
paq({'kyazdani42/nvim-web-devicons', opt = true})
paq({'nvim-lualine/lualine.nvim'})
require('lualine').setup({
options = {theme = 'material'},
sections = {
lualine_y = {
{'diagnostics', sources = {'nvim_diagnostic', 'ale'}}
}
}
})
local default_parallelism = vim.uv.available_parallelism()
paq({'neovim/nvim-lspconfig'})
local lspconfig = require('lspconfig')
lspconfig.clangd.setup({
cmd = {
'clangd',
'--background-index',
'-j', math.min(1, default_parallelism / 2),
'--limit-results=20000',
'--limit-references=20000'
}
})
lspconfig.rust_analyzer.setup({})
vim.g.ale_linters_explicit = 1
vim.g.ale_linters = {
cpp = {'cpplint'}, -- `pipx install cpplint`
gitcommit = {'gitlint'}, -- `pipx install --include-deps gitlint`
markdown = {'mdl'}, -- `gem install --user mdl`
sh = {'shellcheck'}, -- `cabal update; cabal install --installdir=${HOME}/.local/bin ShellCheck`
yaml = {'yamllint'}, -- `pipx install yamllint`
python = {'pylint'} -- `pipx install pylint`
}
vim.g.ale_sh_shellcheck_options = '-x'
vim.g.ale_sh_shellcheck_change_directory = 0
paq({'w0rp/ale'})
paq({'tpope/vim-fugitive'})
paq({'godlygeek/tabular'})
paq({'martinda/Jenkinsfile-vim-syntax'})
paq({'glench/vim-jinja2-syntax'})
paq({'nvim-lua/popup.nvim'})
paq({'nvim-lua/plenary.nvim'})
paq({'nvim-telescope/telescope.nvim'})
-- miscellaneous
vim.g.vimpager_scrolloff = 0
-- use real tabs in Makefiles and Kconfig
local expand_tabs_override_augroup = vim.api.nvim_create_augroup(
'ExpandTabsOverride',
{clear = true}
)
vim.api.nvim_create_autocmd(
'FileType',
{
group = expand_tabs_override_augroup,
pattern = {'make', 'kconfig'},
callback = function()
vim.opt_local.expandtab = false
end
}
)
-- detect files named Config.in as Kconfig
local detect_config_in_as_kconfig_augroup = vim.api.nvim_create_augroup(
'DetectConfigInAsKconfig',
{clear = true}
)
vim.api.nvim_create_autocmd(
{'BufNewFile', 'BufRead'},
{
group = detect_config_in_as_kconfig_augroup,
pattern = 'Config.in',
callback = function()
vim.opt_local.filetype = 'kconfig'
end
}
)