Skip to content

Commit

Permalink
feat(LazyVim): add autocommand for file defaults, lsp config, formatt…
Browse files Browse the repository at this point in the history
…er for OpenCL user extra
  • Loading branch information
Botond Kalocsai committed May 12, 2024
1 parent e875da2 commit e198d7d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
14 changes: 14 additions & 0 deletions home/dot_config/nvim/lua/config/autocmds.lua.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,18 @@ else
vim.schedule(require("chezmoi.commands.__edit").watch)
end,
})

-- OpenCL file setings
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = "*.cl",
callback = function()
vim.opt_local.filetype = "opencl"
vim.opt_local.shiftwidth = 8
vim.opt_local.tabstop = 8
vim.opt_local.commentstring = "/*%s*/"
vim.opt_local.comments =
"sO:* -,mO:* ,exO:*/,s1:/*,mb:*,ex:*/,:///,://"
end,
desc = "Set indentation for OpenCL files",
})
end
31 changes: 31 additions & 0 deletions home/dot_config/nvim/lua/plugins/extras/lang/opencl.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
return {
{
"brgmnn/vim-opencl",
}, -- NOTE: Contains OpenCL file detection autocommand
{
"neovim/nvim-lspconfig",
opts = {
setup = {
opencl_ls = function()
require("lspconfig").opencl_ls.setup({})
end,
},
},
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
table.insert(opts.ensure_installed, "clang-format")
end,
},
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
["opencl"] = { "clang-format" },
},
formatters = {
["clang-format"] = {
args = {
"--style={BasedOnStyle: chromium, IndentWidth: 8}",
},
},
},
},
},
}

0 comments on commit e198d7d

Please sign in to comment.