简体   繁体   中英

Switching between splitted Vim windows as commands

I changed my .vimrc file to automatically open two windows once I fire $vim my_file.py So in my .vimrc file I added following lines vnew previewwindow

The problem is that I want to automatically modify each window and resize them in .vimrc and taking out the line numbers from previewwindow.

I know in vim I can switch between windows by +w but I do not know any Vim command that does so.

Is there any command such as :selectnext or :selectw previewwindow !? so the focus would switch to other window then I could apply every window specific commands.

Is there any command in vim that it accepts combined keystrokes as an argument so I can easily use that command with combined keystroke symbol to be implemented in .vimrc

In my case any command such as :sendkey( w) will work for me !? In addition I am wondering how can I prevent a window to become smaller than a certain width and height (like minimum values for w and h)? Thanks

You can prepend any window movement command with :wincmd . Eg to move the cursor to the next window you would execute:

:wincmd w

See :help window-move-cursor

You're looking for :wincmd , so to switch to the next window ( <CW><CW> ), you'd use :wincmd w . This is a special command for window commands; in general, you can use :normal to execute normal mode commands, so :execute "normal! \\<Cw>\\<Cw>" would be equivalent here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM