Opening a directory in vim

前端 未结 5 2057
清酒与你
清酒与你 2021-02-12 12:22

I\'m a mac user giving vim a serious try. Most of the GUI editors I\'m used to allow me to open a directory as a \"project\" by executing a command like:

5条回答
  •  日久生厌
    2021-02-12 12:55

    Braindead:

     (cd /path/to/dir && vim file)
    

    Less so:

     vim /path/to/dir/file +':cd %:h'
    

    You can always map :cd %:h to a convenient key or put in an autocommand (I wouldn't actually recommend the latter, but there is no arguing about taste)


    Oh and for directories instead of files:

    :cd %
    

    is quite enough

提交回复
热议问题