Friday, March 11, 2016

Insert hostname or pwd or current file name in VI

You can use the read file command

:r!hostname

you can use the visual mode

v!hostname

or

!!hostname

!!pwd


in insertmode
Ctrl+R %

or

!!echo %:p:h
:p is fullpath
:p:h is the head of the fullpath

No comments:

Blog Archive