Loading ...
Sorry, an error occurred while loading the content.

RE: Loading a header directly from a C module

Expand Messages
  • Michael Geddes
    This is my stuff to do it.. it does some buffer smarts, and allows for ugly microsoftish things (like not differentiating btwn c & c++ headers. ...
    Message 1 of 4 , Jan 31, 2001
      This is my stuff to do it.. it does some buffer smarts, and allows for ugly
      microsoftish things (like not differentiating btwn c & c++ headers.

      " Source code extensions

      "Hpp and Cpp browse
      function! Open_header(Extension)
      let fileName=expand("%:p:r").".".a:Extension
      if !file_readable(fileName)
      if a:Extension=='hpp'
      let ff=expand("%:p:r").".h"
      elseif a:Extension=='c'
      let ff=expand("%:p:r").".cpp"
      if exists("ff")
      if file_readable(ff)
      let fileName=ff
      if buffer_exists(fileName)
      exec "buf ".fileName
      exec "e ".fileName
      aug toHeader
      au BufEnter * map gh :echo 'None defined'<cr>
      au BufEnter * map gc :echo 'None defined'<cr>
      au BufEnter *.cpp map gh :call Open_header('hpp')<cr>
      au BufEnter *.c map gh :call Open_header('h')<cr>
      au BufEnter *.hpp map gc :call Open_header('cpp')<cr>
      au BufEnter *.h map gc :call Open_header('c')<cr>
      au BufEnter *.rc map gh :call Open_header('rh')<cr>
      au BufEnter *.rh map gc :call Open_header('rc')<cr>
      au BufEnter *.cpp,*.rc,*.c map gc :echo 'Already here'<CR>
      au BufEnter *.hpp,*.h,*.rh map gh :echo 'Already here'<CR>
      aug END

      -----Original Message-----
      From: James, Scott [SMTP:scott.james@...]
      Sent: Wednesday, 31 January 2001 23:41
      To: 'vim@...'
      Subject: Loading a header directly from a C module

      I seem to remember seeing a module that would allow me to load the
      directly from a C module by deriving its name from the C modules
      name. I
      have written a cut down version:

      fu! LoadHeader()
      let incPath="../include/"
      let bufferName=bufname("%")
      let headerName=incPath . substitute(bufferName,"\.C$","\.H","")
      if (filereadable(headerName))
      exe "normal :edit ".l:headerName"\<CR>"
      echo "Unable to locate header file"

      but I really want to be able to then bounce back and load the C
      module from
      the header. I could mod my code to do this but IIRC someone has
      done this. I have had a quick look but could find nothing. Any

      Scott James

      Rape my mind and destroy my feelings, dont tell me what to do. I
      dont care
      now, 'cause I'm on my side and I can see through you. Feed my brain
      your so called standards. Who says that I ain't right. Break away
      your common fashion see through your blurry sight.
      >>>> END OF USEFUL CONTENT <<<<

      This message is for the named person's use only. It may contain
      confidential, proprietary or legally privileged information. No
      confidentiality or privilege is waived or lost by any
      If you receive this message in error, please immediately delete it
      and all
      copies of it from your system, destroy any hard copies of it and
      notify the
      sender. You must not, directly or indirectly, use, disclose,
      print, or copy any part of this message if you are not the intended
      recipient. CREDIT SUISSE GROUP and each of its subsidiaries each
      the right to monitor all e-mail communications through its networks.
      views expressed in this message are those of the individual sender,
      where the message states otherwise and the sender is authorised to
      them to be the views of any such entity.
      Unless otherwise stated, any pricing information given in this
      message is
      indicative only, is subject to change and does not constitute an
      offer to
      deal at any price quoted.
      Any reference to the terms of executed transactions should be
      treated as
      preliminary only and subject to our formal written confirmation.
    Your message has been successfully submitted and would be delivered to recipients shortly.