Friday, April 5, 2019

How to omit default file path when new buffer or file from default working path?

Hi,
using gVim 8.1.1119 which is latest nightly from https://github.com/vim/vim-win32-installer/releases/ on Windows 7.

I would like to change the information in status line to display file path (without file name) with grey foreground color and file name with white foreground color.

I did the following:

=== C:\Users\user\_vimrc
set statusline=
set statusline+=%1* " grey foreground color
set statusline+=%{expand('%:h')}\\ " current file path without file name
set statusline+=%2* " white foreground color
set statusline+=%t " file name without file path

=== C:\Users\user\vimfiles\colors\colorscheme.vim
hi User1 guifg=#9C9C9C guibg=#444444
hi User2 guifg=#ffffff guibg=#444444

Above code works perfectly when file is opened in one of sub-directories.

But when new empty buffer is opened with command :enew I get:
\[No Name]
and when I open file from default working directory I get:
.\my_file

If empty buffer or file from default working directory I would just like to get
without "current file path witout file name" command, so only display
[No Name]
and
my_file

Regards

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment