How to delete empty lines on visual studio code with the vim mode - vim

I've been trying to delete many empty lines from a huge file. On other editors with vim, or vim itself, I could just do:
:%s/\n\n/\n/g
But neither if I use \r or \t it doesn't work. Seems like some vim features are missing on the editor. Is there any configuration to make that work or another way to do that?

To have advanced Vim functionality work within VScode, you can leverage its Neovim integration.
First, you'll have to install Neovim. For instructions, check out: https://github.com/neovim/neovim/wiki/Installing-Neovim
Then, adjust the following settings in your user configuration:
// Use neovim on backend. (only works for Ex commands right now). You should restart VScode after enable/disabling this for the changes to take effect. NOTE: Neovim must be installed (v0.2.0) and neovimPath must be set the executable in order for this setting to work. Otherwise, vscodevim will crash.
"vim.enableNeovim": true,
// Path to run neovim executable. For example, /usr/bin/nvim, or C:\Program Files\Neovim\bin\nvim.exe
"vim.neovimPath": "nvim",
Restart VScode. Now you can use Vim Ex commands, since the commands are sent to a headless Neovim instance that's running in the background. You can even use installed Vim plugin functions to a certain degree.

Related

nvim finds the function but vim does not

I am using a vim/nvim plugin asyncrun that enables an API call that works fine in nvim if I implement it in ~/.config/nvim/init.vim using a line:
call asyncrun#run("", "cwd", "firefox")
Now this same line does not work for vim if I try to use it inside ~/.vimrc. I always get a warning:
Unknown finction: asyncrun#run
What needs to be changed in order for this to also work for vim?
Following the #doopNudles comment I also clarify that vim plugin is manually installed in the folder ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim. I install all my vim plugins the same way (using the vim v8 native ability to detect plugins).
The problem was that ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim has one extra folder!
It works if I delete the extra folder asyncrun.vim like this ~/.vim/pack/my-plugins/start/vim-asyncrun/plugin/asyncrun.vim

How to i run vim on windows command line or on python

in the tutorial, the teacher used Linux whilst i use windows which is quite different and i don't understand why he could use vim and i cant since I've followed every instruction. here's the code he used vim first_python_program.py
if you want to use vim on Windows, just install it from the official website.
Then you can use it by opening cmd and typing vim <path_to_your_file>. (don't forget to replace <path_to_your_file> with your actual file).

Yank command is not working in vim editor

I want to copy code from vi editor to clipboard so that I can paste it in the browser. I know the command gg"*yG and it's working when I open the code like vim code.py, but when I open like vi code.py, it doesn't work.
But normally when I type vi, it opens vim. I thought vi and vim are same command now, both referring to improved version of vi editor. Then why is this happening.
Summarizing from your comments, it seems like you have installed two versions of vim; one probably via your OS's installation procedures and one via homebrew.
vi is symlinked to the default installation, which was compiled without +clipboard, while vim would execute the binary from homebrew (because that's how your $PATH is configured), which with compiled with clipboard support.

Is it possible to install the Vim-LaTeX suite in cmder?

I use LaTeX (pdfLaTeX) and Vim quite often. I started with teXworks as a text editor for LaTeX, but since I found about the Vim-LaTeX suite I am trying to switch to Vim for everything.
However, I use cmder to run a bash shell in a windows computer, which comes with its own version of Vim installed, and I cannot manage to install the Vim-LaTeX suite on cmder.
First I download the folder, then extract it with 7-zip. I change the .vimrc as indicated in the website, and I check it is read when Vim starts. From here I have tried:
Pasting the files into the Vim74 folder in cmder/.../Vim/Vim74/ replacing the existing duplicates, restarting the terminal (Total disaster, Vim crashes).
Pasting the files into the Vim74 folder in cmder/.../Vim/Vim74/ without replacing the existing duplicates, restarting the terminal (Total disaster, Vim crashes, again).
Creating a ~/vimfiles/folder and putting the plugin on it (No effect).
I understand that installing a suite in cmder is different from doing it in windows or *nix systems, but I can't quite spot how to do it right.
Has anybody successfully installed the Vim-LaTeX suite in cmder? Is there any particular way of doing it?
Many thanks for your help!

vim and latex-box

I installed the vim plugin latex-box but I am having trouble getting it to compile my Latex file. The docs say it uses latexmk to do the compiling, and I have that installed and it works when called by itself.
But when I use the plugin's \ll command to compile I get an error that says 'cannot run latexmk in background without a VIM server'. I cannot find an explanation of why this error would occur in the plugin documentation.
EDIT:
I found a solution to this issue, but ran into others.
To fix this, you need to install the full version of vim (which is different depending on your OS) which will include things like server support. I suggest doing this even if you don't use this plugin because it will fix not been able to copy/paste from/to vim. In (K)ubuntu, install the package vim-gtk.
Start vim like this vim --servername SOMETHING file.tex
After doing this, the servername error went away and the compilation went through but the output from latexmk shows up on top of the file I'm editing. It doesn't overwrite it, it's just displayed on top of the text. When I move the cursor and vim highlights a word or bracket, that appears back on the screen. The only quick way I found to get rid of the compiler output is to scroll the file up and back down, that makes the text appear again.
You can ask vim to redraw the screen like this:
:redraw!
Append that command after running your latex command.

Resources