How do I get the name of the current file without the extension?

You can get the name of the current file without the extension using:

    :echo expand("%:r")

With some commands, you can use the file name modifiers directly:

    :cd %:p:h

    :!gcc -o %:r.o %

    :!xpdf %<.pdf

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind