The commands 1 CTRL-G and :pwd return related but different results:

1 CTRL-G    "~/dev/src/tiff.c" 170 lines --15%--
:pwd        /home/user/src

Of course, CTRL-G returns the file, not the working directory, but interestingly enough uses the tilde (~) shortcut to the home directory, but pwd does not give the tilde, but expands it out. Also, CTRL-G surrounds the path in quotation marks, but pwd does not.

What is the significance of these differences? For example, why would CTRL-G have quotation marks around it, but pwd not?

  • Don't know if these can be answered unless the dev(s) show up and reveal their thinking! I know :pwd comes from getcwd() which returns a string type which must not have quotes around it. Ctrl-G on the other hand is purely for human consumption thus probably intentionally prettified/delimeted with quotes. But that's pure conjecture! – B Layer Dec 13 '17 at 15:59
  • I think @BLayer is right: CRTL-G is only used to display information to the user its output is easy to read for a human but not that easy to parse in code. pwd can be used in code to easily get a data just like line('$') and line('.') * 100 / line('$') which show the remaining data of CTRL-G – statox Dec 13 '17 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.