Pressing ctrl-g will reveal the filename, current line, the line count, your current position as a percentage, and your cursor's current column number.
Answer. Explanation: The current file name is shown in the Title bar.
Navigate to the file, press R , and change the name. Press Enter to edit the file.
You can use the search function in vi (or vim which is more likely what you are running). In command mode, type / and the regular expression you want to search for. Show activity on this post.
:f
(:file
) will do same as <C-G>
. :f!
will give a untruncated version, if applicable.
ctrl+g will do it.
Also, I like to have:
set statusline="%f%m%r%h%w [%Y] [0x%02.2B]%< %F%=%4v,%4l %3p%% of %L"
Which produces:
foo.c [C] [0x23]<code/foo.c 1, 1 2% of 50
Also, as someone mentioned (but now deleted) %
will be replaced with the current filename. For example:
:!echo "current file: %" current file: foo.c Press ENTER or type command to continue
set the status line. more info with :help statusline
These commands can go in your .vimrc file, or you can enter them as commands while in vim by typing ':' in command mode.
First, set last status to 2 using the following:
set laststatus=2
Then set status line to %f for short file name.
set statusline=%f
For the full path to the file, use %F.
:set title
to display file name in window title bar.
Why so complicated? Control-G will do the job
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With