Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: setting different status line for split windows

Tags:

vim

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.

like image 490
m.divya.mohan Avatar asked Jul 18 '12 09:07

m.divya.mohan


Video Answer


1 Answers

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.

like image 63
kev Avatar answered Sep 20 '22 07:09

kev