forked from bfredl/bfredl.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
230 lines (197 loc) · 4.69 KB
/
init.lua
File metadata and controls
230 lines (197 loc) · 4.69 KB
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
221
222
223
224
225
226
227
228
229
230
-- logic: first_run, setup module and _G {{{
local first_run = not _G.bfredl
local bfredl = _G.bfredl or {}
if not first_run then
require'plenary.reload'.reload_module'bfredl.'
end
do local status, err = pcall(vim.cmd, [[ runtime! autoload/bfredl.vim ]])
if not status then
vim.api.nvim_err_writeln(err)
end
end
local function each(z)
return (function (x) return x(x) end) (function (x) return function (y) z(y) return x(x) end end)
end
local h = bfredl
-- TODO(bfredl):: _G.h should be shorthand for the _last_ edited/reloaded .lua module
_G.h = bfredl
-- }}}
-- packages {{{
local packer = require'packer'
packer.init {}
packer.reset()
do each (packer.use)
'norcalli/snippets.nvim'
'norcalli/nvim-colorizer.lua'
'vim-conf-live/pres.vim'
--use 'norek/bbbork'
'nvim-treesitter/nvim-treesitter'
'nvim-treesitter/playground'
'neovim/nvim-lspconfig'
{'nvim-telescope/telescope.nvim', requires = {'nvim-lua/popup.nvim', 'nvim-lua/plenary.nvim'}}
-- TODO(packer): this should not be an error:
-- use 'nvim-lua/plenary.nvim'
'~/dev/nvim-miniyank'
'~/dev/nvim-bufmngr'
'~/dev/nvim-luadev'
'~/dev/ibus-chords'
'~/dev/nvim-ipy'
'~/dev/vim-argclinic'
'~/dev/nsync.nvim/'
{ '~/dev/nvim-miniluv/', rocks = 'openssl' }
'mileszs/ack.vim'
'Lokaltog/vim-easymotion'
'justinmk/vim-sneak'
'tommcdo/vim-exchange'
-- tpope section
'tpope/vim-repeat'
'tpope/vim-surround'
'tpope/vim-fugitive'
'airblade/vim-gitgutter'
'hotwatermorning/auto-git-diff'
'vim-scripts/a.vim'
-- filetypes
'numirias/semshi'
{'davidhalter/jedi-vim', ft = {'python'}}
'ziglang/zig.vim'
'JuliaEditorSupport/julia-vim'
end
-- }}}
-- utils and API shortcuts {{{
for k,v in pairs(require'bfredl.util') do h[k] = v end
local a, buf, win, tabpage = h.a, h.buf, h.win, h.tabpage
_G.a = a
local v, exec, set = vim.cmd, h.exec, h.set
-- }}}
-- basic options {{{
'hidden'
'title'
'number'
'smartcase'
'ignorecase'
'expandtab'
'sw' (2)
'ts' (2)
'sts' (2)
'incsearch'
'mouse' "a"
'updatetime' (1666)
'foldmethod' "marker"
'nomodeline'
'splitbelow'
'notimeout'
'ttimeout'
'ttimeoutlen' (10)
v 'set cpo-=_'
v 'set diffopt+=vertical'
if first_run then
-- I liked this better:
vim.o.dir = '.,'..vim.o.dir
end
-- }}}
-- them basic bindings {{{
-- test
v [[map <Plug>ch:mw <cmd>lua print("howdy")<cr>]]
-- TODO(bfredl): reload all the filetypes when reloading bfred/init.lua
v [[
augroup bfredlft
au FileType lua noremap <buffer> <Plug>ch:,l <cmd>update<cr><cmd>luafile %<cr>
augroup END
]]
-- }}}
-- vimenter stuff {{{
function h.vimenter(startup)
if startup then
require'colorizer'.setup()
if a._fork_serve then
_G.prepfork = true
a._fork_serve()
_G.postfork = true
-- because reasons
a._stupid_test()
end
end
end -- }}}
require'bfredl.snippets'.setup()
-- LSP {{{
if not vim.g.bfredl_unvisual then
if vim.fn.executable('clangd') ~= 0 then
require'lspconfig'.clangd.setup {}
end
if vim.fn.executable('ra_lsp_server') ~= 0 then
require'lspconfig'.rust_analyzer.setup {}
end
if vim.fn.executable('zls') ~= 0 then
require'lspconfig'.zls.setup {}
end
end
-- }}}
-- tree sitter stuff {{{
function h.ts_setup()
h.did_ts = true
require'nvim-treesitter.configs'.setup {
--ensure_installed = "all", -- one of "all", "language", or a list of languages
highlight = {
enable = true; -- false will disable the whole extension
};
incremental_selection = {
enable = true;
keymaps = {
init_selection = "gnn";
node_incremental = "gxn";
scope_incremental = "grc";
node_decremental = "grm";
};
};
refactor = {
highlight_definitions = { enable = true };
--highlight_current_scope = { enable = false };
};
playground = {
enable = true;
disable = {};
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source cod;
persist_queries = false; -- Whether the query persists across vim sessions
};
}
v [[
nmap <plug>ch:ht grn
]]
end
if true or h.did_ts then
h.ts_setup()
end
-- }}}
-- telescope {{{
require'telescope'.setup {
defaults = {
winblend = 20;
border = false;
};
}
-- }}}
-- color {{{
local colors = require'bfredl.colors'
h.colors = colors
if os.getenv'NVIM_INSTANCE' then
colors.defaults()
else
v [[ hi EndOfBuffer guibg=#222222 guifg=#666666 ]]
v [[ hi Folded guifg=#000000 ]]
end
function h.xcolor()
local out = io.popen("xcolor"):read("*a")
return vim.trim(out)
end
v 'inoremap <F3> <c-r>=v:lua.bfredl.init.xcolor()<cr>'
-- }}}
require'bfredl.miniline'.setup()
h.f = require'bfredl.floaty'.f
_G.f = h.f -- HAIII
-- autocmds {{{
exec [[
augroup bfredlua
augroup END
]]
-- }}}
return bfredl