~gpanders/dotfiles

ref: c8e63bac959db19c138dcc3198a56514f0b444ff dotfiles/.vim/after/plugin/projectionist/cmake.vim -rw-r--r-- 1.8 KiB
c8e63bacGreg Anders Manage dotfiles directly in home directory 1 year, 3 months ago
                                                                                
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
" Projections for cmake projects
" Author: Greg Anders <greg@gpanders.com>
" Date: 2019-03-20

if !get(g:, 'loaded_projectionist', 0)
  finish
endif

let g:projectionist_heuristics = get(g:, 'projectionist_heuristics', {})

call extend(g:projectionist_heuristics, {
      \ 'CMakeLists.txt&build/|CMakeLists.txt&src/': {
      \   '*': {
      \     'make': 'cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .',
      \     'dispatch': '-dir=build make',
      \   },
      \   'CMakeLists.txt': { 'type': 'list' },
      \   'src/*.cc': {
      \     'type': 'src',
      \     'alternate': ['include/{}.h', 'src/{}.h', 'test/test_{}.cc'],
      \   },
      \   'src/*.cpp': {
      \     'type': 'src',
      \     'alternate': ['include/{}.h', 'src/{}.h', 'test/test_{}.cpp'],
      \   },
      \   'src/*.h': {
      \     'type': 'include',
      \     'alternate': ['src/{}.cc', 'src/{}.cpp', 'test/test_{}.cc', 'test/test_{}.cpp'],
      \     'template': [
      \       '#ifndef _{project|basename|snakecase|uppercase}_{snakecase|uppercase}_H_',
      \       '#define _{project|basename|snakecase|uppercase}_{snakecase|uppercase}_H_',
      \       '',
      \       '#endif  //_{project|basename|snakecase|uppercase}_{snakecase|uppercase}_H_',
      \     ],
      \   },
      \   'include/*.h': {
      \     'type': 'include',
      \     'alternate': ['src/{}.cc', 'src/{}.cpp', 'test/test_{}.cc', 'test/test_{}.cpp'],
      \     'template': [
      \       '#ifndef _{project|basename|snakecase|uppercase}_{uppercase}_H_',
      \       '#define _{project|basename|snakecase|uppercase}_{uppercase}_H_',
      \       '',
      \       '#endif  //_{project|basename|snakecase|uppercase}_{uppercase}_H_',
      \     ],
      \   },
      \   'README.md': { 'type': 'doc' },
      \ }})