In Vim 8.2 I have two information in my status line:
- full path to my current opened file
- full path to current working directory
I have set the following commands:
set laststatus=2 " always display status line
set statusline=Opened_file: " label
set statusline+=%{resolve(expand('%:p'))} " display full file path of opened file
set statusline+=\ \ " two spaces
set statusline+=Current_working_directory: " label
set statusline+=%{getcwd()}\ \ " display current working directorySample status line:
Opened_file:/home/myname/myfile.txt Current_working_directory:/home/mynameWhat I would like to do is, to display current_working_directory only if it
is different then opened file.
In above example I would like to have status line (without second part; from above cmd list without last three cmd's):
Opened_file:/home/myname/myfile.txtBut if my current working directory is /opt, then I would like to have displayed
both information:
Opened_file:/home/myname/myfile.txt Current_working_directory:/opt