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

Re: Workspace concept ala TextPad

Expand Messages
  • Eric Leenman
    Hi Yegappan, ... What I did: I assume you mean line 521, 527. But when I look at the workspace.vim file the line numbers doesn t line up with it. Therefor I
    Message 1 of 12 , Mar 1, 2007
    • 0 Attachment
      Hi Yegappan,

      I'm trying to do as you said:

      >In the prompt for adding a file to the workspace, you have to enter
      >the filename.
      >If you are using Vim7, you can make the attached change to the workspace
      >plugin to get filename completion at this prompt. With this change, you can
      >complete directory and filenames at the prompt.
      >
      >- Yegappan
      >
      >***************
      >*** 521,527 ****
      > let file_names = a:args
      >
      > if file_names == ''
      >! let file_names = input("Enter file name(s): ")
      > if file_names == ''
      > return
      > endif
      >--- 521,527 ----
      > let file_names = a:args
      >
      > if file_names == ''
      >! let file_names = input("Enter file name(s): ", '', 'file')
      > if file_names == ''
      > return
      > endif


      What I did:
      I assume you mean line 521, 527.
      But when I look at the workspace.vim file the line numbers doesn't line up
      with it.
      Therefor I copied the whole function Ws_Add_Files
      It is from line number 483--556

      " Ws_Add_Files
      " Add one or more files to the current group in the workspace
      function! s:Ws_Add_Files(args, append)
      " Get the current group
      let lnum = line('.')
      let cmd = s:Ws_Get_Entry_Idx_By_Line('s:ws_entry_', lnum)
      if cmd == ''
      " Add the new files at the end of the workgroup
      let prefix="s:ws_entry"
      let idx=""
      endif

      exe cmd
      if {prefix}{idx}_type == 'group' || {prefix}{idx}_type == 'workspace'
      " Cursor is on a group name. Add the new file to this group
      let prefix = prefix . idx . '_'
      let idx = 0
      endif

      let file_names = a:args

      if file_names == ''
      " let file_names = input("Enter file name(s): ")
      !let file_names = input("Enter file name(s): ", '', 'file')
      if file_names == ''
      return
      endif
      endif

      let len = strlen(file_names)
      let start = 0
      let i = 0

      while start != -1 && start < len
      " Skip whitespace characters
      if file_names[start] =~ '\s'
      let start = matchend(file_names, '\s\+', start)
      endif

      if file_names[start] == "'"
      " Single-quoted file name
      let pat = "'[^']\\+'"
      elseif file_names[start] == '"'
      " Double-quoted file name
      let pat = '"[^"]\+"'
      else
      " Unquoted filename
      let pat = '.\{-}[^\\]\(\s\|$\)'
      endif

      " Extract one filename
      let fnames = matchstr(file_names, pat, start)
      let skip_pat = "['" . '"]\=\zs.\{-}\ze[' . "'" . '"]\=$'
      let fnames = matchstr(fnames, skip_pat)

      let start = matchend(file_names, pat, start)

      if fnames != ''
      let fnames = glob(fnames) . "\n"
      while fnames != ''
      let one_fname = strpart(fnames, 0, stridx(fnames, "\n"))
      if a:append
      call s:Ws_Add_File(prefix, {prefix}count, one_fname)
      else
      call s:Ws_Add_File(prefix, idx + i, one_fname)
      endif
      let i = i + 1
      let fnames = strpart(fnames, stridx(fnames, "\n") + 1)
      endwhile
      endif
      endwhile

      call s:Ws_Refresh()
      endfunction


      When I do it, and try to add a file, it ends up with:

      C:\Windows\system32\cmd.exe /c let file_names = input("Enter file name(s):
      ", '', 'file')
      'let' is not recognized as an internal or external command, operable program
      or batch file.
      shell returned 1
      Hit any key to close this window...


      What am I doing wrong?

      Best regards,
      Eric

      _________________________________________________________________
      Don�t miss your chance to WIN 10 hours of private jet travel from Microsoft�
      Office Live http://clk.atdmt.com/MRT/go/mcrssaub0540002499mrt/direct/01/
    • Eric Leenman
      Hi Yegappan [...] ... Thanks, it works Rgds, Eric _________________________________________________________________ Win a Zune™—make MSN® your homepage
      Message 2 of 12 , Mar 2, 2007
      • 0 Attachment
        Hi Yegappan


        [...]
        >
        >Remove the "!" before the "let".
        >
        > let file_names = input("Enter file name(s): ", '', 'file')
        >
        >- Yegappan

        Thanks, it works

        Rgds,
        Eric

        _________________________________________________________________
        Win a Zune��make MSN� your homepage for your chance to win!
        http://homepage.msn.com/zune?icid=hmetagline
      Your message has been successfully submitted and would be delivered to recipients shortly.