V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
nouh
V2EX  ›  问与答

VIM启动时初始目录的设置

  •  
  •   nouh · Oct 14, 2011 · 8519 views
    This topic created in 5320 days ago, the information mentioned may be changed or developed.
    问个小白的问题,一直不是清楚VIM启动时如何把初始目录设定到我项目的目录下。大家平时使用时是怎么做的呢?
    10 replies    1970-01-01 08:00:00 +08:00
    coderoar
        1
    coderoar  
       Oct 14, 2011
    到vimrc里添加一条命令不就得了。
    luofei
        2
    luofei  
       Oct 14, 2011
    cd ~/
    forestchen
        3
    forestchen  
       Oct 14, 2011
    在我的.vimrc里有一句,当时为了配合NERDTree
    autocmd BufEnter * lcd %:p:h

    via: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file
    nouh
        4
    nouh  
    OP
       Oct 14, 2011
    @luofei 我是在windows的下gvim里加了条cd D:\,启动的时候就有问题
    nouh
        5
    nouh  
    OP
       Oct 14, 2011
    @forestchen 谢谢,这个帖子很有用
    luofei
        6
    luofei  
       Oct 14, 2011
    @nouh cd d:\\
    nouh
        7
    nouh  
    OP
       Oct 14, 2011
    @forestchen 在Nerdtree中不知道如何切换到D盘,貌似Nerdtree里无法做到
    nouh
        9
    nouh  
    OP
       Oct 14, 2011
    @forestchen 谢谢了:)
    Mize
        10
    Mize  
       Jun 25, 2013
    感谢:)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1301 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 17:31 · PVG 01:31 · LAX 10:31 · JFK 13:31
    ♥ Do have faith in what you're doing.