V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
nouh
V2EX  ›  问与答

VIM启动时初始目录的设置

  •  
  •   nouh · 2011-10-14 12:04:29 +08:00 · 7574 次点击
    这是一个创建于 4585 天前的主题,其中的信息可能已经有所发展或是发生改变。
    问个小白的问题,一直不是清楚VIM启动时如何把初始目录设定到我项目的目录下。大家平时使用时是怎么做的呢?
    10 条回复    1970-01-01 08:00:00 +08:00
    coderoar
        1
    coderoar  
       2011-10-14 12:13:36 +08:00
    到vimrc里添加一条命令不就得了。
    luofei
        2
    luofei  
       2011-10-14 12:14:50 +08:00
    cd ~/
    forestchen
        3
    forestchen  
       2011-10-14 12:43:07 +08:00
    在我的.vimrc里有一句,当时为了配合NERDTree
    autocmd BufEnter * lcd %:p:h

    via: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file
    nouh
        4
    nouh  
    OP
       2011-10-14 13:14:57 +08:00
    @luofei 我是在windows的下gvim里加了条cd D:\,启动的时候就有问题
    nouh
        5
    nouh  
    OP
       2011-10-14 13:29:21 +08:00
    @forestchen 谢谢,这个帖子很有用
    luofei
        6
    luofei  
       2011-10-14 13:51:44 +08:00
    @nouh cd d:\\
    nouh
        7
    nouh  
    OP
       2011-10-14 14:04:46 +08:00
    @forestchen 在Nerdtree中不知道如何切换到D盘,貌似Nerdtree里无法做到
    forestchen
        8
    forestchen  
       2011-10-14 19:05:54 +08:00
    nouh
        9
    nouh  
    OP
       2011-10-14 22:23:40 +08:00
    @forestchen 谢谢了:)
    Mize
        10
    Mize  
       2013-06-25 20:10:40 +08:00
    感谢:)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2162 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 05:29 · PVG 13:29 · LAX 22:29 · JFK 01:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.