When I open 2 files with horizontal split, each windows has its own status line.
e.g. with command
vim -o a.txt b.txt
I will get status line as "a.txt" for first window, and "b.txt" for second window.
I need to invoke vim from command line, and I need to put a custom status line, and I want different status line for each window.
With
vim -o -c "set statusline=hello" a.txt b.txt
I am getting "hello" as status for both windows.
What should I do to get "hello" as status line for first window, and "world" for second window; when invoking vim from command line?
This command isn't working:
vim -o -c "set statusline=hello" a.txt -c "set statusline=world" b.txt
Please help.
You can use setlocal
command:
vim -o a.txt b.txt -c "setl stl=hello | wincmd j | setl stl=world"
Type :help 'stl'
'statusline' 'stl' string (default empty)
global or local to window |global-local|
We can see that: stl
is a global or local to window
option.
So, :setl stl=hello
will set a status-line which is local to current window.
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