Yank command is not working in vim editor - vim

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.

Related

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).

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

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.

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!

How to fix VIM system clipboard usage in Mountain Lion

set clipboard+=unnamed is one of my favorite .vimrc configs. Thanks to it, yanks and deletes are copied to my system clipboard and I can easily paste them to other applications.
However, when I upgraded to Mountain Lion, this setting broke down.
Do you know how to fix this problem?
The version of Vim provided by Apple has always been lacking useful features, +clipboard among them, but also Python and Ruby support or X11-related capabilities.
The solution has always been to install an up-to-date Vim yourself. There are many ways to do that. From relatively painless to rather involved:
Install MacVim and put the bundled mvim script in your path. After that $ mvim filename will open MacVim and $ mvim -f filename will open MacVim's Vim executable in the terminal. Use an alias if you want to keep typing $ vim filename.
Use Homebrew or MacPorts.
Install from the sources.

Vim at Ubuntu 11.04: Working with clipboard of Unity

The problem is, the old-way method to work with X11 clipboard (through "plus" register) doesn't work in Unity. Has anyone met the problem? And how it was solved?
The problem solves itself after GVim installation. Then "plus" register works as it should be.
Even if you do not have gvim installed or xterm_clipboard enabled, you may use xsel to manage your clipboard (install it via apt-get).
I hope my script will help you: https://github.com/FUT/config-files/blob/master/vim-dotfiles/vim/settings/clipboard.vim
Use :
sudo apt-get install vim-gtk
This will install vim with clipboard support.Run as before: vim
I don't know the unity desktop but I know that it is based on gnome libraries. So if you can use dbus to interact with unitys clipboard, you may consider writing a shell script which uses dbus to set the clipboard content. This script can in turn receive its input from vim if you assign a map to a filter command. Of course this works similarly if you know any other commandline utility which can set the clipboard content.
I used to have the following maps in .vimrc for the old dcop and klipper (the KDE clipboard) which you might customize:
:vmap k :w! $HOME/.vimclip<CR>:silent execute "!dcop klipper klipper setClipboardContents \"$(cat $HOME/.vimclip)\" &>/dev/null &"<CR>:redraw!<CR>
:nmap z :silent execute "!dcop klipper klipper getClipboardContents > $HOME/.vimclip"<CR>:r $HOME/.vimclip<CR>:redraw!<CR>
E.g. to copy press k after making a selection in visual mode. Note, that it copies and pasts line wise.
I have faced the problem again after while. Must say I use vim in GNOME Terminal, not GVim that is also installed.
What is interesting the plus register stopped working approximately at the same time on different computers of mine.
First I though it was a bug because the graphical version was installed as before. But at the end I just started GVim and tested the plus register there. It was working. After that the register began working in the terminal too.
So if you meet the problem again, when you have already installed GVim, just start it. This should help.

Resources