0

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

Sina Sou
  • 159
  • 1
  • 8

2 Answers2

1

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

:wincmd w

See :help window-move-cursor

heijp06
  • 11,558
  • 1
  • 40
  • 60
1

You're looking for :wincmd, so to switch to the next window (<C-W><C-W>), 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! \<C-w>\<C-w>" would be equivalent here.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324