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

Re: Problem setting runtimepath in vimrc

Expand Messages
  • Pablo Giménez
    El 5 de junio de 2010 00:39, Tony Mechelynck ... Thanks for the tip, ill try it. ... scripts integrated to make a de velopment environment. I understand vim s
    Message 1 of 9 , Jun 4, 2010
    • 0 Attachment
      El 5 de junio de 2010 00:39, Tony Mechelynck <antoine.mechelynck@...> escribió:
      On 04/06/10 18:53, Pablo Giménez wrote:
      I am using this code to make a proper runtimepath:
      if exists("$TDVIMROOT")
          let s:paths = split(&rtp, ',')
          let s:userPaths = []
          let s:sysPaths = []
          if has("win32") || has("win64")
          let s:user = $USERNAME
          else
          let s:user =$USER
          endif
          for path in s:paths
          if path =~ s:user
              let s:userPaths += [path]
          else
              let s:sysPaths += [path]
          endif
          endfor
          " Add initial paths for runtimepath:
          let&rtp = s:userPaths[0] . ',' . $TDVIMROOT
          " Add system paths
          for path in s:sysPaths
          let&rtp =&rtp . ',' . path
          endfor
          " Add after paths
          let&rtp =&rtp . ',' . $TDVIMROOT . '/after' . '.' . s:userPaths[1]
          "let&runtimepath=$TDVIMROOT. ',' .&rtp . ',' . $TDVIMROOT . '/after'
      else
          echohl ErrorMsg
          echo "TDVIMROOT nor defined.\nPlese set en environment veriable called
      TDVIMRROT to the TDVim install location"
          echohl Normal
      endif

      So user paths will be before, then my path, and the nsystem paths.
      for the after just the other way around , first system, then my stuff and
      finally user after location

      This sounds quite complicated.

      Why not just

         if exists('$TDVIMROOT') && ($TDVIMROOT != "")
             \ && isdirectory($TDVIMROOT)
                 let s:rtp = split(&rtp, ',')
                 call insert(s:rtp, $TDVIMROOT, 1)
                 call insert(s:rtp, $TDVIMROOT . '/after', -1)
                 let &rtp = join(s:rtp, ',')
         else
            echoerr 'Please define $TDVIMROOT as the TDVim install directory'
         endif
      Thanks for the tip, ill try it.

      but then, why insist that your plugin be housed in a different directory tree than the rest? Why not just add one or more additional files at the appropriate location(s) in some existing 'runtimepath' directory tree (other than $VIMRUNTIME), like everyone else does? Distributing a bunch of files for installation into a 'runtimepath' tree, each file into its proper subdir, can even be automated, see ":help pi_vimball.txt".

      Well the think is that my plugin is basically  a lot of other plugins and scripts integrated to make a de velopment environment.
      I understand vim's point of view and  I think is good for one user who is installing plugins separately.
      But in my situation is a pluging that affects many aspepect of vim and I prefer to have everything in one location that eveybody can reuse, not to force every user to install it.
      So I followed what many other apps do, being able to replicate the hierarchy of the conf folder and then using an evironment variable enable to use it or not.

      Best regards,
      Tony.
      --
      Everything you've learned in school as "obvious" becomes less and less
      obvious as you begin to study the universe.  For example, there are no
      solids in the universe.  There's not even a suggestion of a solid.
      There are no absolute continuums.  There are no surfaces.  There are no
      straight lines.
                     -- R. Buckminster Fuller



      --
      Un saludo
      Best Regards
      Pablo Giménez

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.