Tip: #883 - Automatically maximizing gvim in KDE
Created: February 22, 2005 3:12 Complexity: basic Author: Anthony Gorecki Version: 6.0 Karma: 27/13 Imported from: Tip#883
After a week of trying to find a proper way to maximize a gvim window under KDE, using the .vimrc file, the best solution that I was able to find was "pseudo-maximize", which still left extra space around the gvim window. As a result of this, I abandoned the vim configuration file and began experimenting with KDE's window-specific settings. Ironically, the solution was very simple:
First, open a gvim window and press the maximize button. Vim will generally rescale the window after you do this, so you'll need to make sure that the window is in fact maximized, typically by pressing the maximize button a second time to achieve the desired effect.
Next, right click on the title bar: Advanced -> Window Specific Settings. Select the Window tab if it isn't the default.
Click on the Detect button, and click anywhere inside the gvim window. In the window that pops up, select "Use window class (whole application)" and click Ok.
From here, move over to the Geometry tab and check the Size box. Change "Do Not Affect" to Force. You'll note that the size to the right is the same as that of the maximized window, which is the correct value. If you choose "Apply Initially" instead of Force, you'll encounter the same rescaling problem that required you to press the maximize button twice in the first step.
Please make certain that you've followed all of the above steps, as you'll need to edit these settings manually to change them. They're located in ~/.kdeX.Y/share/config/kwinrulesrc and must be edited when KDE is not running in order to avoid being overwritten. The above is tested with KDE 3.4.
Click Ok at the bottom of the window, restart gvim and enjoy.
Comments
Another way, much simplier, is the following: you run GVim, maximize it in usual way (by clicking appropriate button), then open (or create) ~/.gvimrc and type somewhere inside it:
set lines=<n1> columns=<n2>
where <n1> and <n2> may be found by executing command
:set lines? columns?
Ivan Tishchenko , February 25, 2005 8:33
Using KDE 3.3 I found it very simple to define a Keyboard shortcut <CTRL><ALT><SPACE> on Maximise Window in the KDE ControlCenter. This can be used to toggle between the startup size and fulscreen.
h.wesseling--AT--hwesseling.de
, February 28, 2005 13:08
Most KDE desktops will also accept F11 as a fullscreen command.
Regarding set (lines|columns), your method is correct, however it's not a true "maximization." gvim automatically rescales the lines and columns to the nearest whole number that will fit on the screen, thus if you `set lines=999', you may end up with lines=140, leaving extraneous free space below the window because there isn't enough space to evenly fit another line. While the method listed in the tip works, I agree that it could be far less complex; unfortunately, I haven't found a way to forcibly disable the window rescaling at runtime.
anthony--AT--ectrolinux.com , February 28, 2005 21:42