I wanted to have the output of a(any) shell command to open up in a vim split.Did a bit of research and found out that the command to do so was::new | 0read | ! ls                       ---  (or something of this form)But the issue I am facing is that when I try to bind it to something like this :nmap ,s :new | 0read | !            --- (without a specific command at the end)Also tried with a specific command at the end and same resultit is showing up this error everytime I open up vim:line  277:E32: No file namePress ENTER or type command to continueEdit : It was not exactly an issue with binding, the command had a small issue.Use this command:nmap ,s :new | 0read !Btw the accepted answer has a function implementation which is much better than this simple mapping
Problem when assigning a keybinding to open the output of a shell command in vim
key bindings;command line;split
To open the output of a command in a new window::new +0r!lsNote the syntax of new::[N]new [++opt] [+cmd]                                  :newAnd for +cmd:                                                        +cmd [+cmd]The [+cmd] argument can be used to position the cursor in the newly openedfile, or execute any other command:        +               Start at the last line.        +{num}          Start at line {num}.        +/{pat}         Start at first line containing {pat}.        +{command}      Execute {command} after opening the new file.                        {command} is any Ex command.To include a white space in the {pat} or {command}, precede it with abackslash.  Double the number of backslashes.         :edit  +/The\ book           file        :edit  +/dir\ dirname\\      file        :edit  +set\ dir=c:\\\\temp  fileNote that in the last example the number of backslashes is halved twice: Oncefor the +cmd argument and once for the :set command.So, to run a command in a new window, you can just + with :new, the command being 0r!ls. This can quickly become a pain with complex commands, though.In an map, leaving the command to you to enter:nnoremap ,s :new +0r!You could also write a function to read in the command:function! SplitRunCommand()    call inputsave()    let l:cmd = input('Command: ')    new    call append(0, systemlist(l:cmd))    call inputrestore()endfunctionnnoremap ,s :call SplitRunCommand()<cr>Now, when you type ,s you'll be prompted:Command:Then, say:Command: date '+%y%m%d'And you will have a new window with the output of date '+%y%m%d'.