add c/cpp projectionist config

pull/1/head
Ensar Sarajčić 2021-05-29 18:43:07 +02:00
parent f44705c57b
commit 8e7ab862ba
3 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,4 @@
local log = require "vim.lsp.log"
local vim_readme_template = { local vim_readme_template = {
"# Name", "# Name",
"", "",
@ -289,11 +290,47 @@ local csharp_project_config = {
} }
} }
local function c_project_config(source_extension, header_extension)
return {
["*"] = {
start = "make run"
},
["src/*." .. source_extension] = {
type = "source",
alternate = {
"src/{}." .. header_extension,
"test/{}." .. source_extension,
"include/{project|basename}/{}." .. header_extension,
}
},
["test/*." .. source_extension] = {
type = "test",
alternate = {
"src/{}." .. header_extension
}
},
["src/*." .. header_extension] = {
type = "header",
alternate = {
"src/{}." .. source_extension
}
},
["include/{project|basename}/*." .. header_extension] = {
type = "header",
alternate = {
"src/{}." .. header_extension
}
}
}
end
vim.g.projectionist_heuristics = { vim.g.projectionist_heuristics = {
["pubspec.yaml"] = flutter_config, ["pubspec.yaml"] = flutter_config,
["requirements.txt|pyproject.toml"] = python_config, ["requirements.txt|pyproject.toml"] = python_config,
["*.sln"] = dotnet_solution_config, ["*.sln"] = dotnet_solution_config,
["*.csproj"] = csharp_project_config, ["*.csproj"] = csharp_project_config,
["plugin/|autoload/"] = vim_plugin_config, ["plugin/|autoload/"] = vim_plugin_config,
["src/*.cpp|test/*.cpp"] = c_project_config("cpp", "hpp"),
["src/*.c|test/*.c"] = c_project_config("c", "h"),
["lua/"] = lua_vim_plugin_config ["lua/"] = lua_vim_plugin_config
} }

View File

@ -12,6 +12,7 @@ let g:ale_linters.python = ['flake8']
let g:ale_linters.kotlin = ['ktlint'] let g:ale_linters.kotlin = ['ktlint']
let g:ale_linters.clojure = [] let g:ale_linters.clojure = []
let g:ale_linters.cs = ['OmniSharp'] let g:ale_linters.cs = ['OmniSharp']
let g:ale_linters.cpp = ['clangd']
" ALE Fixers configuration " ALE Fixers configuration
let g:ale_fixers = {} let g:ale_fixers = {}
@ -20,6 +21,7 @@ let g:ale_fixers.python = ['autopep8', 'isort']
let g:ale_fixers.dart = ['dartfmt'] let g:ale_fixers.dart = ['dartfmt']
let g:ale_fixers.lua = ['luafmt'] let g:ale_fixers.lua = ['luafmt']
let g:ale_fixers.go = ['gofmt'] let g:ale_fixers.go = ['gofmt']
let g:ale_fixers.cpp = ['clang-format']
" Warnings navigation " Warnings navigation
nmap <silent> [W <Plug>(ale_first) nmap <silent> [W <Plug>(ale_first)

View File

@ -73,3 +73,5 @@ erl_crash.dump
# Python # Python
pyrightconfig.json pyrightconfig.json
**/.lsp/sqlite.db