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

Re: Different working directories in different tabs

Expand Messages
  • Gary Johnson
    ... There are two commands that change the working directory: :cd, which is global, and :lcd, which is window-local. There is no change-directory command
    Message 1 of 6 , Jun 1, 2011
    • 0 Attachment
      On 2011-05-31, Martin Lundberg wrote:
      > On Tuesday, May 31, 2011 2:55:40 PM UTC+2, Christian Brabandt wrote:
      >
      >
      > :h :lcd
      >
      > regards,
      > Christian
      >
      > Hi Christian. To my understanding that is not what I'm talking about. The :lcd
      > command changes it for the current window. I'm talking about creating a new tab
      > and changing the working directory using :cd. It changes the cwd for that tab
      > only (you can even see the filenames of the other tabs changing on the tabs).
      > If you then change back to another tab it's cwd has not changed.

      There are two commands that change the working directory: :cd,
      which is global, and :lcd, which is window-local. There is no
      change-directory command whose scope is a tab.

      That said, you could use the TabEnter autocommand event and a
      tab-local variable to :cd to the working directory you define for
      each tab. That is, in each tab you could execute

      :let t:wd = "some/directory"

      and in your ~/.vimrc you could have an autocommand something like
      this:

      au TabEnter * if exists("t:wd") | exe "cd" t:wd | endif

      See

      :help TabEnter
      :help t:var

      Regards,
      Gary

      --
      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
    • Martin Lundberg
      Weird. I was 100% it did work yesteday when I was discussing this in the #vim irc channel. However now it works just as all of you ve said. :) -- You received
      Message 2 of 6 , Jun 1, 2011
      • 0 Attachment
        Weird. I was 100% it did work yesteday when I was discussing this in the #vim irc channel. However now it works just as all of you've said. :) 

        --
        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.