Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

VIM: disallow focusing a window

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

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

1 Reply

0 votes
by (71.8m points)

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'.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...