LoginSignup
2
1

More than 5 years have passed since last update.

MacのVimで引数なしのcdコマンドを打つと、ホームディレクトリに移動してしまう

Posted at

これはvimの仕様の違いではなく、OSのコマンドの仕様の違いです。

仕事でWindows、プライベートでMacを使っていて少し悩ませられました。

Windowsにおけるcdコマンドは、引数を何も指定しないと現在のディレクトリを表示します。
が、Linuxでは引数なしcdコマンドを実行するとホームディレクトリに移動します。

:cd

" 実行結果: /Users/ユーザ名 など

MacやLinuxなどで現在のディレクトリパスを確認したい場合、pwdコマンドを使いましょう。

:pwd

これはもちろんvimだけでなく、ターミナルにおいても有効です。

2
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1