In vim7, I can see a history of previous commands with q: and if I want to use any of those commands, I can navigate to the particular line and hit <CR>. In vim8, hitting <CR> does not do anything. Am I missing something?
If I start vim with vim -u NONE and try to view previous commands with q:, it doesn't list any commands even though I have just executed one.
Apparently, it was a bug in Vim which has been fixed with patch 8.0.0208
Related
I have installed Vim on my mac, I have no .vimrc nor .vim/ folder. It is a clean vim installation.
I try to use a command like :grep foo as you see in the video but I don't get results and get only the Press ENTER or type command to continue that breaks the flow and make vim unusable.
Here is a demo: https://streamable.com/ulf0z4
What it can be?
I tested some things like:
set cmdheight=2
set shortmess=a
on nvim instance that I have on the same mac, but the results are the same.. I don't know where to start to debug the problem. Any help?
you have to specify which files you want to apply grep on. :grep foo ./*
grep fills the quickfix list which can be accessed with :copen
read :h silent to avoid the error message.
:h redraw might be interesting as well.
I wish I could mimic original VIM behaviour by running scripts in the background and not in the internal Neovim terminal emulator.
Basically the reason is that I cannot seem to get colors to work properly, plus, I like to Ctrl+Z (put the editor in the background) and check what was the output of the last command.
Anyway I can configure nvim to do the same as vim in this regard?
Here is the comparison:
EDIT: My tests are run by using :! ./vendor/bin/phpunit {file}
VIM
NVIM
EDIT
By "Background" I mean, not async, in the background while Neovim is on the "top". I mean, to place the editor in the background (like when we do ctrl+z, and then run the tests "on top". Then I hit a key and Neovim comes back to the top.
In other words, I want to configure nvim in a way that when I run a test, it is the same as doing CTRL-Z; execute test.
Sorry, this may be super confusing :D
Instead of using :!{cmd}, I'd encourage you to experiment with running the tests via the :te[rminal] {cmd} command:
:te ./vendor/bin/phpunit {file}
That way the output from phpunit will be captured in a terminal buffer. You can switch between the terminal buffer and the test file using <C-^> (or :b#). Or you can open the terminal buffer and the test file side by side in separate windows. When you're finished with the terminal buffer, you can delete it using :bwipeout {num}.
One cool feature of terminal buffers is that if you place your cursor on a filepath and press gf, Vim will open the specified file. Better still, you use gF, then Vim will open the file at the specified line/column number, if those are present.
For more info, look up :help terminal in Neovim.
In newest version(HEAD version in github repo) of vim with terminal feature enabled.
You can run current file in background with following command:
:terminal ++hidden ./%
for neovim
You may need to install some plugin like:
https://github.com/tracyone/neomake-multiprocess
or
https://github.com/skywind3000/asyncrun.vim
If you are using tmux, you can
https://gist.github.com/tracyone/65cffd685fc9b9308e50c1a1783d1fb0
You could use :silent !./vendor/bin/phpunit {file} to run the script background.
Every time I switch back to vim window, it shows the list, if current cursor on an empty line, it shows error: E349: No identifier Under Cursor.
The only workaround for this problem that I've discovered so far was to run tmux and then run vim inside one of tmux's panes.
According to https://unix.stackexchange.com/a/480138 ,
it is the FocusIn/FocusOut mode that can be disabled with:
echo -ne '\e[?1004l'
I encountered this problem when I would lose an ssh connection, so tmux on the remote server that enabled FocusIn/FocusOut mode would not be able to disable it. If I opened a vim on my local machine, vim would receive those events. If the FocusIn/FocusOut mode is not the default for your terminal, you can also disable it with:
reset
That list looks a lot like the output of :ilist! Plugin or [I with the cursor on Plugin or ]I with the cursor on the first Plugin. See if you don't have that somewhere in your vimrc (that you should append to your question, by the way).
The error message is likely caused by :help gd or :help gD.
It caused by the wincent/terminus plugin.
Fixed
Append let g:TerminusFocusReporting=0 to .vimrc
Alt-tabbing into Terminal sends a ^] command to VIM. To ignore that command, put
nnoremap ^] <Nop>
in your .vimrc file
I had to fix by removing the line set ttymouse= from my .vimrc.
You may need to set ttymouse to an appropriate value, see :h ttymouse.
I appeared in the 3.12 version of iterm2, and now it disappears after upgrading to 3.15
is there a way to use vim/vi in the vim command line? Sometimes I write a long
command in vim such as:
:!./script /home/user/pet --flag=1
and I want to change for instance "user" by "other". What I usually do is to
navigate the command line with right arrow which is time consuming and even more
when I want to go to the beginning of the line. I would like to have something
like "0" to go there or w/b to move by words. Or use j/k to go to the next/previous
command.
Thanks.
:h cedit
in command line, type ctrl-F(default) to enter command window.
or in normal mode type q:
(for search, type q/)
Vim has a feature called the "commandline window". You can enter it with Control-F by default when you're already on the commandline, or q: from normal mode, edit the commandline using vim commands, and press enter to execute. It also contains your command history so that you can yank previous commands if you like. See :help cmdline-window for more information.
I'm not aware how you can use Vim commands to edit a command directly on the command line, but if you enter the command window q: you get can use regular Vim editing to edit commands.
From there you can execute commands by hitting <CR> or use Ctrl-C to copy the command to the regular command line.
If you run set -o vi you will have vim capabilities in your command line. Just put 'set -o vi' in your .bashrc file or equivalent to have it by default.
I'm aware that much like a bash prompt in Vim you can press : and get a list of all the history commands by pressing up and down.
But is there a way to export this command history into a buffer?
:history will show you a history of your commands.
Edit:
In normal mode, q: will open your history in a new buffer.
you can check all the commands by looking into .viminfo in your home folder or :history inside vim