November 2018
Beginner
330 pages
7h 21m
English
Since Vim is a text editor, much of what you do operates on files. Vim provides a number of file-related functions.
You can manipulate file path information using expand:
echom 'Current file extension is ' . expand('%:e')
When passed a filename (through %, #, or shortcuts such as <cfile>), expand lets you parse the path using these modifiers:
See :help expand() for more information about these.
You can check the file exists (aka can be read) by using filereadable:
if filereadable(expand('%')) echom 'Current file (' . expand('%:t') . ') is readable!'endif
When executed from ...
Read now
Unlock full access