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

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

Related

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.

Is there a VSCODE equivalent for the Vi 'z' command?

In the Vi editor, one can issue a 'z' command to relocate the current line at the top of the page. I cannot yet see a similar option available in VSCODE.
Does anyone know if such an option is available in VSCODE, please?
NOTE: I have taken note of the Vim extensions, but I am not looking for a solution based upon installing an extension. Thanks.
Take a look at this VIM extension for Vscode which may contain what you are looking for

Cursor overwrite mode in vscode?

I can't seem to find any way to put the cursor into 'overwrite' mode - as in when you press the insert key and newly typed characters overwrite the existing characters inline. I haven't found any reference anywhere online to the omission or inclusion of such a feature in vscode, but it seems to be a fairly commonly used feature. Does this exist?
I too was missing the overtype mode in Visual Studio Code, so I went ahead and wrote an Overtype extension to add the behavior!
You can install it by opening the command palette and entering:
ext install overtype
Update: As of this writing, VS Code still does not have overtype built in, and the original extension seems to no longer be maintained. There is a more up-to-date fork here.
It seems to be working fine for me both ways I can switch it with shift + i on latest VS Code and macOS system.
For me, I think it's because of an extension called Vim (Vim emulation for Visual Studio Code). I was tired of this problem. Just going through all the extensions and settings, Finally I found this solution. By uninstalling this Vim extension I was free of this error.

Emacs can't work with ibus to input chinese

My Emacs editor can't work with ibus chinese input method, ibus shows "No input window" when cursor is on Emacs.
I run Emacs with alias like LC_CTYPE="zh_CN.UTF-8" emacs, It actually works before, but I have no idea why it doesn't work now, maybe some system update I think.
About my system: Gentoo Linux with Gnome3, I installed Emacs23 and Emacs24, and both of them can't work with ibus now.
PS: Ibus works on other programs, Emacs can display chinese characters well.
It seems the problem only happen on Gentoo. Because system update clear up some fonts. The solution is to install the missing fonts:
emerge media-fonts/font-adobe-75dpi x11-apps/bdftopcf media-fonts/font-alias media-fonts/font-util
Then after logout and re-login, I can use input method again.
I solve this problem via installing ibus.el and this seems like emacs GTK UI's problem.
make sure that ibus is configured correctly by opening the default text editor for your distribution (Mousepad, Leafpad...?), typing control-space and seeing if you can enter Chinese. If you cant you may have to install a Chinese input method or add an input method in the ibus settings.
next make sure you have the emacs, ibus mode installed. If you are using a Debian based distribution, the package you want to install will be listed as 'ibus-el'.
After installing ibus-el usually control-space will activate and allow you to cycle through your input methods; however, on some of my machines I have to help emacs to get ibus mode started by typing M-x ibus-mode.