Intro
Constantly asking Vim which file you are editing is disruptive to your workflow.
Especially after the 20th time of asking..😵💫
Here’s a great way to have Vim always tell you which file you are in; instead of stopping to ask.
Vim Options
Here are the commands to change and reset the defaults for laststatus and statusline from Command-line Mode, respectively:
# change the defaults
:set laststatus=2
:set statusline=buf\ %n:\ %F\ %m%r\ %=%l,%c\ \ \ \ \ \ \ \ %p%%
# reset to defaults
:set statusline= laststatus=1
#view buffer list
:ls
Here’s how to view the filename and buffer number from Normal Mode:
# view file name: control-g
^g
# view file name AND buffer number: 2 control-g
2 ^g
**Remember, you have to exit Insert Mode and go into Normal Mode first, with the Esc key
