Advertisement
Guest User

switch from cpp to hpp and back

a guest
Sep 12th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function! SwitchToAlternate()
  2.      let l:Filename = expand('%:t:r')
  3.      let l:Extension = expand('%:t:e')
  4.      if l:Extension == "hpp"
  5.          let l:Alternate = l:Filename.".cpp"
  6.      elseif l:Extension == "cpp"
  7.          let l:Alternate = l:Filename.".hpp"
  8.      endif
  9.      echom "switching to ".l:Alternate
  10.      exec "e ".l:Alternate
  11. endfunction
  12.  
  13. nnoremap <localleader>a :call SwitchToAlternate()<cr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement