Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In VIM, I want to split a window in two parts where first one is the regular editor, and the second one is just read-only window for some auxiliary information.

The user should not be allowed to access (focus) the read-only window. Can I set that somehow?

set nomodifiable is helpful but it is not what I meant - I still can access the window.

Edit

  • I mean two independent buffers
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
191 views
Welcome To Ask or Share your Answers For Others

1 Answer

Usually the preview window is used for auxiliary information, e.g. insert-mode completion can show additional information there. You can :pedit a scratch buffer, and show your information there.

I don't follow your requirement of not allowing to move into that window. That's not very Vim-like. You can disallow (accidental) editing with :setlocal nomodifiable, but why not allow the user to interact with the window?! (Some operations like resizing are way easier or only possible when you're inside the window.)

Alternative

If the amount of information is small and only needs to be displayed for a short time, and you're in GVIM, you can also use tooltip popups via 'balloonexpr'.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...