1

How I open Vim/Command Prompt maximized from Windows Run (Win + R)?

I have tried the below for vim but it does not work, I tried

vim /max C:\Users\USERNAME\Desktop\test.txt

I know you can set it to open as a shortcut in the properties, but I believe when I do it this way via 'Windows Run' ideally I am looking at starting it maximised this way via the vim.exe? Is this possible, even if its command based in Run it will be enough, or by adding a .bat file to path and doing it this way, would work? If so how exactly, as in what batch code?

Windows Version is:

Windows 10 Home

Vim version:

8.2.24

Update I tried this as a workaround as a .bat file but it does not open anything at all:

: Input I am entering below when prompted: 
C:\Users\USERNAME\Desktop\test.txt

@ECHO OFF
SET /P dirVar=Please enter a directory and file name to open it in Vim:
IF "%uname%"=="" GOTO Error
ECHO start /max vim %uname%
GOTO End
:Error
ECHO You did not enter a file name!
:End
7
  • What version of Vim and from where did you install it? What version of Windows?
    – DavidPostill
    Jan 5, 2020 at 18:14
  • Apologies I forgot to put edited in above question.
    – SomeT
    Jan 5, 2020 at 18:15
  • Vim is not part of Windows. Where did you download it from?
    – DavidPostill
    Jan 5, 2020 at 18:17
  • I know its not, my issue is more with Windows Run though and Vim, just look at vim as a computer program in windows that runs in the Windows command prompt that I am trying to open maximized at the OS level via Windows Run.
    – SomeT
    Jan 5, 2020 at 18:18
  • You cannot do it via Windows > Run
    – DavidPostill
    Jan 5, 2020 at 18:28

2 Answers 2

1

cmd itself does not support starting it maximized because you can define the size of a window and cmd will respect that over maximized status.

That said, you can change the size of the cmd window from within cmd itself, and that can also be done from a batch file. All you need to figure out is how big you need the window to be.

The command for this is the following:

mode con: cols=200 lines=50

The default settings are:

mode con: cols=80 lines=25

Additionally, you can also configure these settings as default for any cmd window, such that if you do Start->run followed by cmd, your new fresh cmd window opens in that size directly.

To do so, start a new cmd window, then click on the little cmd icon in the top left and select properties.

In this window, you can configure CMD, such as the font its using, the colors it has available and of course how big the window is going to be.

1
  • 1
    I realised the thing I was looking for was this: set tw=0 which works exactly how I want it to, but thanks anyway! This might work for others though what you mentioned depending on the context someone else is coming from.
    – SomeT
    Jan 5, 2020 at 19:42
1

So I worked it out:

First create a .bat file with the following in it:

@ECHO OFF
SET /P dirVar=Please enter a directory and/or file name to open/start it in Vim: 
START /max vim %dirVar%

then you can add to windows 10 environment variables if you like, or just type in a new file. This kind of works how I like but I have no wrap set to on, and for some reason it does not have no wrap on the first line which is a bit annoying but that is more a Vim issue than windows. I solved the windows issue at least.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .