Does NeoVim have an equivalent for the ":!" command in Vim? - vim

The one thing that I'm having a hard time with in NeoVim is that I frequently use ":!" in Vim in order to view my recent commands/outputs on the command line.
(That command just hides vim temporarily)
I've searched around but haven't been able to find anything like that in NeoVim. Is there something I'm missing?

Related

What is the difference between gVim and gVim easy?

The question is self explanatory, but I haven't found a single resource that explains what the difference is after an hour of searching. After poking around a little bit in both, it appears that gVim and gVim easy are identical.
Gvim easy is started and locked in insert-mode (every character you type is printed like a simple notepad).
Standard gvim starts in normal mode and you have to toggle between normal/insert like all other vim.
From help:
Easy mode. Implied for |evim| and |eview|. Starts with
'insertmode' set and behaves like a click-and-type editor.
This sources the script $VIMRUNTIME/evim.vim. Mappings are
set up to work like most click-and-type editors, see
|evim-keys|. The GUI is started when available.
{not in Vi}
gVim-Easy, which is installed with gVim, has all the functionality of
normal gVim but lacks modes. This is especially useful for begginers
and people who do not want to, or do not have the time to, learn how
to use gVim. Users can benefit from gVim's superior syntax
highlighting and auto-indentation while not having to have to learn
the, often deemed complex, command set of gVim in order to edit a
simple document. It is recommended that readers of this tutorial at
least try to learn how to use gVim in normal mode, the learning curve
is steep, but, the benefits in speed and usability this confers is
worth the investment.
Read here
gVim Easy: gvim.exe -y (pass a parameter y)
gVim: gvim.exe
It seems that Insert and Replace are available modes, and command mode is missing. And at first glance it appears to have lost the ability to save a document using keystrokes - the File menu shows only ":w" for Save and without command mode, the command simply isn't there. What isn't shown however is Alt-F followed by S - this works, although also missing is the status line confirmation of the file being written.

Vim issue with running specs in Ruby/Rspec

I am using Vim as my main editors for a few days now.
Using http://www.github.com/astrails/dotvim as the base of my installation.
The problem I am having is that when I run the specs, the result of the specs is not delayed on the screen and I can't see what is going on.
to further explain this, I have a video to demo the situation:
http://www.youtube.com/watch?v=gUB48XwNq0M&feature=plcp
I need to hide vim with CTRL+Z and then fg to show it again, that's obviously not good.
Would love help on this
** Edit **
I posted about the problem in more detail here:
http://avi.io/blog/2012/08/05/problem-with-running-spec-in-vim/
I would first check if this is the same behavior for any shell command you run, or just when you run spec files.
E.g. how does a simple run of 'ls' from within VIM behave?
:!ls
If the above waits for 'Enter', I would guess that you have a trailing space (or similar) in the mapping that runs your spec.
For example, adding this line to your .vimrc will map Leader-l to the 'ls' command and will prompt for 'Enter'.
nmap <leader>l :!ls<cr>
However if you add the same line with a trailing space at the end, it will exit the console immediately:
nmap <leader>l :!ls<cr>
So I would check the mapping you use to run the specs.
This might have something to do with :help more, but I think the best solution for this sort of thing is a combination of tmux and turbux.vim. See the video here.

is there a way to see output of previous ":! g++ %" without rerunning?

When coding, I like to check the code by running :! g++ %. I map the command to <F5>. sometimes it takes a while to compile and I want to see the errors without spending time recompiling. Also, sometimes I want to compare the new output to previous one.
Is there a way to see the previous output of :! ...?
Provided you have g++ configured with makeprg, you can use :copen to reopen the last list of errors from the :make command.
set makeprg=g++\ %
Then, to compile, use
:make
When the compile completes, any errors will be listed in the quickfix window, which can (assuming errorformat is correctly configured) be used to jump to the lines on which errors occur. This usually works out of the box for C/C++.
If you dismiss the quickfix window, retrieve the last error list with
:copen
Review :help quickfix and :help makeprg for full gory details on how this works.
If you are using Vim from the terminal just suspend vim with Ctrl+z.
This will send you back to your terminal. You should see the commands that you just ran via :!. To get back to vim issue the fg. Note: This maybe different depending upon your shell.
:sh starts you a shell within Vim. If you're using Vim in a terminal, this switches back to what's known as the "primary buffer", which means that you see the history from the terminal before you started Vim, as well as any of the :! commands you ran in Vim.
You can get back to your Vim session with Ctrl-d.
Michael gave you the right answer: :makeis the way to go. The old :!compilation-command is to be forgotten. Vi is, well, ... history.
Now to clarify : you'd almost never have to tweak &makeprg. The default value is the one you want to use, unless:
you're using something else to compile (ant, ...)
you want to compile a mono file program, and you don't want write a Makefile, and you're under mingw whose gnumake installation s*cks (all other installations of gnumake do permit to transform foo.c/cpp into foo(.exe) without having to write any single Makefile)
you want to play with the compilation directory, or with things that can't be injected through $CXXFLAGS, $LDFLAGS, $CFLAGS, etc.

Vim: running a command in the editor instead of shelling out

When I do something like !git init inside of vim it switches over to bash and runs the command there then says "Press Enter to continue".
From what I've read and seen I thought it would run the command in the bottom area of vim (in a buffer maybe?).
Am I doing something wrong? Is there a setting I messed up on?
While that git plugin does look interesting I'm watching a TekPub demo where he is doing things like !bundle install as well and the result is just displayed at the bottom (under where he typed the command) in vim directly.
Also I am using vim in Ubuntu if that matters.
If you're specifically wanting to use Git, checkout Tim Pope's fugitive plugin.
http://www.vim.org/scripts/script.php?script_id=2975
This is the behavior I have (and have always had) when using console Vim. The behavior that you were expecting is what I get when using GUI Vim (e.g., MacVim or GVim). So, to answer your question: no, you are not doing anything wrong, and there are no messed up settings.
Use
:read !command
to insert output in current buffer. So, for example, if you want to insert the current date:
:r !date

Interactive terminal in VIM

I'm using Vim for editing source code, but I would also like to have a terminal embedded in vim's window (just like in Kate, you know).
Now I have seen the vimsh plugin that turns a vim buffer into an interactive terminal, but I don't like 2 things about it:
It opens automatically at startup. Can I disable it and invoke the terminal with a special command whenever I wish?
It splits the window in two and occupies the top window, but I would like it to occupy the bottom window. Can this be arranged?
PS: I'm not exactly a vim guru :)
Maybe this is what you want: Conque Shell - VIM Plugin
There's also an older patch that you can apply. It requires recompilation of the VIM source code though.
http://www.wana.at/vimshell/
Maybe I am not going to reply exactly to your question but I'll propose anyway a different approach on working with Vim and the terminal.
The first approach is to run shell commands directly from vim in command mode prepending them with a "!":
:!ls
will run the shell ls command and display you the output in a temporary window. This is useful if you just want to run a single or few commands.
If you want to mess around longer I suggest to suspend your vim session with Ctrl-z, work in the shell and issue fg as your last command to get back to vim.
Hope it helps you.
Another option you could try is using tmux/screen to split your terminal, so that you can then run vim in one pane and have your shell in another. I also liberally use ControlZ to drop into a shell from vim and then fg to get back to vim after finishing with the shell.

Resources