Is there an neovim version of vimdiff - neovim

I've started using nvim (neovim) recently. It generally works well, but when I run vimdiff, I noticed that I got the startup errors I got when I ran regular vim. I've fixed those so that both vim and nvim run without errors on my system, so vimdiff works fine now. But it makes me wonder: is there a neovim version of vimdiff? Or should I just maintain both vim and neovim so that regular vim works fine for vimdiff?

Yeah, you can use the -d option to open nvim in diff mode.

I noticed a question about this was posted on redit: https://www.reddit.com/r/neovim/comments/6rvsa2/nvimdiff/
The dialog there confirms that there is no corresponding nvimdiff that is shipped. The solution suggested there is to add an alias in your bashrc file:
alias vimdiff='nvim -d'
I'll do this.

Related

Histfile in integrated terminal not the same as normal terminal

I just lost my terminal history in VS Code. I noticed it when trying to do a reverse search in the Integrated Terminal (CTRL+R).
To debug, I ran this command:
echo $HISTFILE
This gives me:
/var/folders/ky/ltbvkg9s1239m5c9bccj5xtc0000gn/T/johndoe-code-zsh/.zsh_history
I would expect the normal path of my ZSH history is shown instead, like I get in iTerm2 when running the same command.
/Users/johndoe/.zsh_history
I believe this is a bug with VSCode's ZSH shell integration, that has already been resolved on the Insiders version.
Here is the offending line (note the HISTFILE without $):
I've seen it merged into the release/1.74 branch so hopefully, a v1.74.1 is not too far away. In the meanwhile, you can switch to Insiders (side-by-side installation) or turn off shell integration as suggested in the other answer.
Try turning off the shell integration that's enabled by default ("terminal.integrated.shellIntegration.enabled") and then restart the terminal.
https://i.stack.imgur.com/1Ger0.png
I fixed the problem by just adding this two lines at the bottom of my ~/.zshrc file.
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

I am trying to use :g in Vim doesn't work "Command :g[lobal] is not yet implemented" i get in the status line

I wanted to try vim for a bit, and get used to it... i got stuck with trying to replicate Ctrl+D functionality of VScode... so I've tried couple Google solutions.
This is What I've tried when I got that error:
:g/oldword/norm newword
I see lots of people do search patterns like this, but it's annoying I get this message, without being able to find solution on google :D
I know I can solve this issue with /word then cgn newword and then just repeat with . operator, BUT, I want to be able to use the global command for searching patterns and stuff, for other purposes too, and it stresses me out that I can't make it work!
Here is the error I am getting.
Any help is extremely appreciated / welcome! Thanks.
Edit: Forgot to mention: We are talking about Vim for VScode, not the gvim installation stuff. Will try to install that too, and update the question.
Edit2: Okay so apparently, after instalilng gvim (from official site) and ran it through vim command in cmd prompt, the official vim can run the :g commands.
Like (for example) if you want to search for <a> and replace it with <router-link> you can do so by: :g/<a>/norm ciw<router-link>
Which means:
:g/<a>/norm run a global (file) search for pattern <a>
ciw - change in word
<router-link> the replacement pattern for <a>
Note: The same should be done for </a> after that :D
The problem still exists tho.
While the native vim exe (outside of vscode) works and can run these stuffs, I still need to fix the vscode one (the extension that is). It is defo nice to have syntax highlighting and correction.
What you are using is not Vim. It is a Vim emulator which, like all Vim emulators, can't be expected to be either complete or accurate. Its only relationship with Vim is that it tries and fails to imitate it.
Some of the Vim stuff you will find on the internet will work in that VSCode extension exactly as it does in Vim, some of it will work but partially or differently, and most of it, like :g, will simply not work.
There is nothing you can do about that except, maybe, contributing to the project.
If you want support for the global command in VSCode, install Neovim and the VSCode extension for it:
for those who expected this to work but it doesn't, it's possibly because you need to have installed neovim (firstly) and then vscode-neovim extension (secondly) https://marketplace.visualstudio.com/items?itemName=asvetliakov.vscode-neovim
Source: https://github.com/VSCodeVim/Vim/issues/2346
The easiest way to get this working is to enable neovim in the VS Code Vim extension you're using.
Once you have installed Neovim on your operating system, you can enable it within VSCode inside the Preferences: User Settings window:
Enable the Vim: Enable Neovim option (vim.enableNeovim)
Set the path to Neovim inside the Vim: Neovim Path setting (vim.neovimPath)
Restart VSCode
Source: https://www.barbarianmeetscoding.com/boost-your-coding-fu-with-vscode-and-vim/integrating-vscode-with-neovim/#enabling-neovim-inside-vscode

VSCode on Linux Mint, integrated terminal not able to type anything

Hi I'm running Linux Mint 19 and I have just installed vscode using the snapd package manager. I've not used vscode on linux before as my usual editor is emacs. However, on a fresh new install of vscode, the integrated terminal does not work, there is just a non blinking cursor in the top left of the screen, but no prompt and no keyboard strokes are registering. This appears to be a common problem as there are a lot of posts about it if googled, but they are all for Windows versions and none of the solutions that I'm able to try do anything. I've tried to open a new terminal window, but the same thing happens I just get two terminal windows that I now cannot use. I've also tried checking the box that says Code-runner: Run In Terminal, but that does nothing either. What can I do to get this to work please, I looks to me like it is just not connected to either a bash or Zsh(which I normally use). Any help on this would be appreciated.
Instead of starting vscode with its default shell script (usually located on /usr/share/code/bin/code), the integrated terminal only works for me when starting it directly from the compiled binary (typically found on /usr/share/code/code, which is the same as the launcher created by the installer:
/usr/share/code/code --no-sandbox --unity-launch %F
While I searched for a solution in the past I've also noticed that lots of folks solved similar problems just by adding --disable-gpu flag, so might be worth checking out as well.

zsh autocompletion appears to only work with built in commands

I'm new to zsh, just switched over from fish. I'm trying to get autocomplete working so it displays argument/flag options for commands upon pressing tab.
Currently this works, but it only appears to work for built in commands. For example, it works for ls, grep, git, etc. but does not work for programs I have added myself. For example, fd-find, exa, and nvm all do not work.
For nvm, I have enabled the nvm plugin using Oh My Zsh. I know the plugin is working in general, because nvm itself is working (and it wasn't before enabling the plugin).
For fd-find, I see the auto-completion file in /usr/share/zsh/vendor-completions/_fd
For exa, I manually downloaded and placed the autocompletion file in /usr/local/share/zsh/site-functions/_exa as instructed by the site.
All 3 of these programs do not show me the typical arguments/flags autocomplete menu the way built in commands do. I'm not sure what is wrong.
I echoed the fpath environment variable to make sure /usr/local/share/zsh/site-functions was in there. It is, along with /usr/local/share/zsh/site-functions/
When I run which nvm, I get:
_nvm () {
# undefined
builtin autoload -XUz
}
Which is actually what I get for all of _nvm, _exa, _fd.
Not sure what else to try.
Any suggestions for how to get autocomplete working properly?
Other info: I'm on a System76 Darter Pro laptop running Pop!_OS.
I found a fix that worked for me. After searching through zsh issues related to autocomplete on github, this solution worked for me. Credit was given to the original source of the solution on stackexchange.
The solution was simply to remove all zcompdump files:
rm ~/.zcompdump*
After running the above command, autocomplete works and expands out the possible flags/arguments for non-builtin programs!

Neovim error: E492: Not an editor command: PlugInstall

OS: Ubuntu 18.04.3 LTS
I just installed neovim using sudo apt-get install neovim and added the folder and file ~/.config/nvim/vim.init. At this moment the file has no content, but when I open up nvim and type :PlugInstall I get error: E492: Not an editor command: PlugInstall. I am clueless, what is going wrong?
I think you are trying to use vim-plug without previously installing it.
I changed my plug#begin to
call plug#begin('~/.local/share/nvim/site/autoload/plug.vim')
and it worked for me now
I followed this and it worked: https://github.com/junegunn/vim-plug/wiki/tutorial
I also wrote call plug#begin('~/.config/nvim/plugged) and made a directory at that location. Then the reload command is also source ~/.config/nvim/init.vim where init.vim is the configuration file. And then I just ran :PlugInstall and it worked :D
I got this error too, but in my case I was typing :pluginstall instead of the case-sensitive :PlugInstall and you have to use the correct case or it won't work. Oddly, :PlugUpdate was able to work before :PlugInstall but that was just because I typed the case correctly.
I see I have the vim.plug correctly installed here
~/.vim/autoload/plug.vim
I also created a "plugged" folder here and I see this is where vim-plug put the downloaded files from running :PlugInstall
.vim/plugged
To be overly pedantic, I typed 'cd' to get to the user directory, then cd .vim to go into my dotted .vim folder, then "mkdir plugged" to create the plugged directory. Not sure if this was 100% necessary or if :PlugInstall would have created it by itself.
I also needed to :source ~/.vimrc between adding addition plug line items and typing :PlugInstall, so make sure you "source" or you can also completely quit and restart your Vim so it will reload your .vimrc file, otherwise it won't know anything about your file edits.
I'm on a Mac. I installed vim-plug for standard vim and this gave me this file
~/.vim/autoload/plug.vim
My .vimrc is this:
" add line numbers
set number
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" Make sure you use single quotes
Plug 'tomasiser/vim-code-dark'
Plug 'tpope/vim-sensible'
call plug#end()
I had the same problem and come here for leave my contribution ( I hadn't find this solution in anywhere ). In my case, it's caused by permissions in my linux. I always start my vim for ocults archives with:
sudo vim .vimrc
In this case, the Vim just use the default commands ( I don't know why but I think this is by the security ). If you just run:
vim .vimrc
All the user commands will be able.
In my case, I had multiple terminal windows open. I still had the Vim window open after installing vim-plug in another window. Solution was to close and re-open Vim.
Instead of
call plug#begin()
I did
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Worked 100%
If you have followed the steps in https://github.com/junegunn/vim-plug, but still didn't work.
Try run ':source ~/.config/nvim/vim.init' in vim (not source ~/.config/nvim/vim.init in shell).
Make sure git is installed.
In my case, I was trying to do :PlugInstall in a docker container and did not have git installed. I installed git, and it worked.