mirror of
https://github.com/tomru/vim.git
synced 2026-03-03 06:27:18 +01:00
38 lines
1.1 KiB
Lua
38 lines
1.1 KiB
Lua
vim.api.nvim_create_augroup('_bcr', { clear = true })
|
|
vim.api.nvim_create_autocmd('BufRead,BufNewFile', {
|
|
pattern = '*/frontend-apps/*/bcr/core/public/*',
|
|
callback = function()
|
|
vim.cmd [[
|
|
" set base for requirejs imports
|
|
setlocal path+=core/public
|
|
" for mustach templates
|
|
setlocal isfname-=!
|
|
setlocal suffixesadd+=.template
|
|
]]
|
|
end,
|
|
group = '_bcr',
|
|
})
|
|
vim.api.nvim_create_autocmd('BufRead,BufNewFile', {
|
|
pattern = '*/frontend-apps/*/bcr/*',
|
|
callback = function()
|
|
vim.g.rooter_patterns = { '=bcr' }
|
|
end,
|
|
group = '_bcr',
|
|
})
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
pattern = { '*/frontend-apps/*/bcr/*.[jt]s', '*/frontend-apps/*/bcr/*.[jt]sx', '*/frontend-apps/*/bcr/*.json' },
|
|
callback = function(opts)
|
|
local bufnr = opts.buf
|
|
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
|
|
|
if client.name ~= 'tsserver' then
|
|
return
|
|
end
|
|
|
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
|
vim.cmd 'EslintFixAll'
|
|
end, { desc = 'Format current buffer with Eslint' })
|
|
end,
|
|
group = '_bcr',
|
|
})
|