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

Vim60as Autocommands

Expand Messages
  • Ian
    All, I m using vim60as on win32, my gvimrc file is shown below. I have the following two autocommands within my gvimrc file: au! BufNewFile,BufRead *.* call
    Message 1 of 2 , Sep 2, 2001
    • 0 Attachment
      All,

      I'm using vim60as on win32, my gvimrc file is shown below.
      I have the following two autocommands within my gvimrc file:

      au! BufNewFile,BufRead *.* call FoldMarker()
      au! BufNewFile,BufRead *.* call SetFoldMarkerComment()

      When I open up a *.c file using verbose=9 I can only see the function
      "SetFoldMarkerComment()" being called, can anyone please tell me why the
      function "FoldMarker()" is not being called as well.

      I want both functions to be called whenever I open up a new file can anyone
      tell me how to do this.

      Thanks for your help.

      Ian Midgley

      *****************************gvimrc file below********************

      syntax on
      set verbose=9
      set foldmethod=marker
      set foldcolumn=4
      set foldtext=getline(v:foldstart)
      hi Normal guibg=White "guifg=White
      hi PreProc ctermfg=3
      hi cIncluded ctermfg=3
      hi Comment ctermfg=2
      hi cString ctermfg=6
      hi folded ctermfg=6 guibg=White
      set hls
      set cindent
      "set background=dark
      set sw=2 ts=8 aw
      set ai
      set showcmd
      set showmode
      set ruler
      set report=0
      set history=50
      set cmdheight=2
      set splitbelow

      "Allow repeated undo's
      set cpoptions-=u
      set undolevels=50

      au! BufNewFile,BufRead *.* call FoldMarker()
      au! BufNewFile,BufRead *.* call SetFoldMarkerComment()

      function! SetFoldMarkerComment()
      if &filetype == "c"
      set commentstring=/*%s*/
      elseif &filetype == "vhdl"
      set commentstring=--%s
      elseif &filetype == "conf"
      set commentstring=##%s
      elseif &filetype == "cfg"
      set commentstring=##%s
      elseif &filetype == "make"
      set commentstring=##%s
      endif
      endfun

      function! InsertFoldMarkers()
      "set foldmethod=""
      if &filetype == "c"
      : '<put!='/*{{{ */'
      : '>put='/*}}} */'
      elseif &filetype =="vhdl"
      : '<put!='--{{{ '
      : '>put='--}}} '
      elseif &filetype =="conf"
      : '<put!='##{{{ '
      : '>put='##}}} '
      elseif &filetype =="cfg"
      : '<put!='##{{{ '
      : '>put='##}}} '
      elseif &filetype =="make"
      : '<put!='##{{{ '
      : '>put='##}}} '
      endif
      "set foldmethod=marker
      endfun

      function! FoldMarker()
      set cpoptions-=<
      if &filetype == "c"
      nmap <f7> o/*{{{ */<ESC>zc
      nmap <f8> o/*}}} */<ESC>zc
      elseif &filetype =="vhdl"
      nmap <f7> o--{{{<ESC>zc
      nmap <f8> o--}}}<ESC>zc
      elseif &filetype =="conf"
      nmap <f7> o##{{{<ESC>zc
      nmap <f8> o##}}}<ESC>zc
      elseif &filetype =="cfg"
      nmap <f7> o##{{{<ESC>zc
      nmap <f8> o##}}}<ESC>zc
      elseif &filetype =="make"
      nmap <f7> o##{{{<ESC>zc
      nmap <f8> o##}}}<ESC>zc
      endif
      set cpoptions+=<
      endfun

      set cpoptions-=<
      vmap <F7> :<C-U>call InsertFoldMarkers()<CR>
      set cpoptions+=<
    • Benji Fisher
      ... Normally, :au! is used only at the top of your vimrc file, or inside an ... HTH --Benji Fisher
      Message 2 of 2 , Sep 4, 2001
      • 0 Attachment
        Ian wrote:
        >
        > All,
        >
        > I'm using vim60as on win32, my gvimrc file is shown below.
        > I have the following two autocommands within my gvimrc file:
        >
        > au! BufNewFile,BufRead *.* call FoldMarker()
        > au! BufNewFile,BufRead *.* call SetFoldMarkerComment()
        >
        > When I open up a *.c file using verbose=9 I can only see the function
        > "SetFoldMarkerComment()" being called, can anyone please tell me why the
        > function "FoldMarker()" is not being called as well.

        :help autocmd-remove

        Normally, :au! is used only at the top of your vimrc file, or inside an
        :augroup

        HTH --Benji Fisher
      Your message has been successfully submitted and would be delivered to recipients shortly.