Skip to content

Commit

Permalink
0.9.5 - includes out-of-the-box support for many (all?) of the differ…
Browse files Browse the repository at this point in the history
…ent variants of C++ file extensions
  • Loading branch information
derekwyatt committed Dec 21, 2011
1 parent c76d0db commit 7b64e2c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 7 deletions.
47 changes: 44 additions & 3 deletions doc/fswitch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,37 @@ In order to see what created the need for this function, see
*fswitch-defaults*
11. The Default Settings~

By default FSwitch handles {c} and {cpp} files, favouring {cpp}.
By default FSwitch handles {c}, {cc}, {cpp}, {cxx} and {C}. Note that the
difference between {c} and {C} is only case sensitivity. This may mean that
weird stuff happens if your OS is case insensitive.

Also NOTE that when you use {cxx/hxx} or {C/H}, god kills a puppy.
Consider that next time you want to do such a silly thing.

For *.h files:
>
let b:fswitchdst = 'cpp,c'
let b:fswitchdst = 'c,cpp'
let b:fswitchlocs = 'reg:/include/src/,reg:/include.*/src/,../src'
<

For *.hpp files:
>
let b:fswitchdst = 'cpp'
let b:fswitchlocs = 'reg:/include/src/,reg:/include.*/src/,../src'
<

For *.hxx files:
>
let b:fswitchdst = 'cxx'
let b:fswitchlocs = 'reg:/include/src/,reg:/include.*/src/,../src'
<

For *.H files:
>
let b:fswitchdst = 'C'
let b:fswitchlocs = 'reg:/include/src/,reg:/include.*/src/,../src'
<

For *.c
>
let b:fswitchdst = 'h'
Expand All @@ -403,7 +427,19 @@ For *.c

For *.cpp
>
let b:fswitchdst = 'h'
let b:fswitchdst = 'hpp,h'
let b:fswitchlocs = 'reg:/src/include/,reg:|src|include/**|,../include'
<

For *.cxx
>
let b:fswitchdst = 'hxx'
let b:fswitchlocs = 'reg:/src/include/,reg:|src|include/**|,../include'
<

For *.C
>
let b:fswitchdst = 'H'
let b:fswitchlocs = 'reg:/src/include/,reg:|src|include/**|,../include'
<

Expand Down Expand Up @@ -534,6 +570,11 @@ path.
*fswitch-changes*
A. Change History~

0.9.5
- Modified the autocommands to handle the myriad different
formulations of C++ files per Hong Xu's request. See:
https://github.com/derekwyatt/vim-fswitch/pull/3

0.9.4
- Added fixes from Alexey Radkov to handle the 'sb' and 'spr' option
settings as well as the 'switchbuf' option. See:
Expand Down
16 changes: 12 additions & 4 deletions plugin/fswitch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ if exists("g:disable_fswitch")
endif

if v:version < 700
echoerr "FSwitch requires Vim 7.0 or higher!"
echoerr "FSwitch requires Vim 7.0 or higher."
finish
endif

" Version
let s:fswitch_version = '0.9.4'
let s:fswitch_version = '0.9.5'

" Get the path separator right
let s:os_slash = &ssl == 0 && (has("win16") || has("win32") || has("win64")) ? '\' : '/'
Expand Down Expand Up @@ -329,8 +329,16 @@ endfunction
"
augroup fswitch_au_group
au!
au BufEnter *.h call s:SetVariables('cpp,c', 'reg:/include/src/,reg:/include.*/src/,ifrel:|/include/|../src|')
au BufEnter *.c,*.cpp call s:SetVariables('h', 'reg:/src/include/,reg:|src|include/**|,ifrel:|/src/|../include|')
au BufEnter *.c call s:SetVariables('h', 'reg:/src/include/,reg:|src|include/**|,ifrel:|/src/|../include|')
au BufEnter *.cc call s:SetVariables('hh', 'reg:/src/include/,reg:|src|include/**|,ifrel:|/src/|../include|')
au BufEnter *.cpp call s:SetVariables('hpp,h', 'reg:/src/include/,reg:|src|include/**|,ifrel:|/src/|../include|')
au BufEnter *.cxx call s:SetVariables('hxx', 'reg:/src/include/,reg:|src|include/**|,ifrel:|/src/|../include|')
au BufEnter *.C call s:SetVariables('H', 'reg:/src/include/,reg:|src|include/**|,ifrel:|/src/|../include|')
au BufEnter *.h call s:SetVariables('c,cpp', 'reg:/include/src/,reg:/include.*/src/,ifrel:|/include/|../src|')
au BufEnter *.hh call s:SetVariables('cc', 'reg:/include/src/,reg:/include.*/src/,ifrel:|/include/|../src|')
au BufEnter *.hpp call s:SetVariables('cpp', 'reg:/include/src/,reg:/include.*/src/,ifrel:|/include/|../src|')
au BufEnter *.hxx call s:SetVariables('cxx', 'reg:/include/src/,reg:/include.*/src/,ifrel:|/include/|../src|')
au BufEnter *.H call s:SetVariables('C', 'reg:/include/src/,reg:/include.*/src/,ifrel:|/include/|../src|')
augroup END

"
Expand Down

0 comments on commit 7b64e2c

Please sign in to comment.