File: cpphpp.vim

package info (click to toggle)
polybar 3.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,108 kB
  • sloc: cpp: 30,424; python: 3,750; sh: 284; makefile: 83
file content (19 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"
" Get the filename of the swap file
"
func! ft#cpphpp#GetFilename()
  let ext = expand('%:e')
  let root = expand('%:p:r')
  if (ext == 'cpp')
    return fnameescape(substitute(root, '\(src/.*/\)\?src/', '\1include/', '') . '.hpp')
  elseif (ext == 'hpp')
    return fnameescape(substitute(root, '\(include/.*/\)\?include/', '\1src/', '') . '.cpp')
  endif
endfunc

"
" Swap between source/header using given cmd
"
func! ft#cpphpp#Swap(cmd)
  execute a:cmd . ' ' . ft#cpphpp#GetFilename()
endfunc