Vim at Ubuntu 11.04: Working with clipboard of Unity - vim

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.

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

Git bash, using VIM 8.1 on Windows :Term command. Node REPL not working correctly

I'm working on a corporate network (windows pc) with little access to tools like tmux, cmder etc.. however after recent update to git bash, we have access to Vim v8.1 which has a terminal built in.
I can load up vim and the type :term to load up a terminal... it works for standard terminal operations such as ls or git push etc.. but when you run node it seems to crash. And it doesn't render the node repl prompt.
Anyone know how I can get this working? (As predicted it works on the mac)... this is really useful to test out an algorithm quickly without leaving vim.
I also tried just typing !node to execute outside of vim and this has the same effect.
Any clues would be much appreciated.
Many thanks
Kevin
I figured it out...
You just type node -i for interactive (This isn't needed on the vim 8.1 on the mac)

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.

disable "Press ENTER or type command to continue" in terminal

I know how to disable this inside Vim, I am curious is it possible to disable this at all when running vim in terminal.
e.g.
tdi#piesek:~$ vim
ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need to compile YCM before using it. Read the docs!
Press ENTER or type command to continue
My scenario is that I install vim and Vundle plugins automatically via saltstack for all users (vim +PluginInstall +qall). Some plugins, however need more love, e.g. YouCompleteMe, which gives this message.
I would like to force vim to 'go on' even when there are some things that keep on wanting ENTER pressed.
If you know the commands (in your ~/.vimrc) who trigger the message, you can prepend :silent! in front of it. This will suppress any output and errors.
For general messages, you can try :set nomore.
cd ~/.vim/bundle/YouCompleteMe
./install.py
Fixed this problem for me, I have Ubuntu 14 as OS and CMake installed, previously..
I tried it by deleting one by one.And I find that set syntax cause the problem..not sure if is the culprit.
So you can delete it to solve the problem.

Why can't this menu item work?

I got this in my vimrc:
:so menu_format.vim
and in menu_format.vim, this:
"... other menu items that work
menu Format.nbsp_space <ESC>:%s# # #gec<CR> //(the 1st blank is 0xa0, the 2nd is 0x20)
"... other menu items that work
On Windows it works (been using it for a while), but on Linux Mint 17 vim gives:
E319: Sorry, the command is not available in this version.
I tried %s# # #gec on command line, it worked, too!
I knew how to fix this: %s#[\xa0]# #gec would do. I just wanted to know why there is such a difference, and it made me doubt the portability of my vim scripts.
BTW, I built vim (7.4.560) on both Linux and Windows with the same configuration, both use the same menu_format.vim.
It looks like you only have the minimal version of Vim named vim-tiny; it only provides a minimal vi-compatible implementation. The E319 implies that the :menu command is not available, the :substitute does look fine and should work.
To get the full Vim (and graphical GVIM), install the following package:
$ sudo apt-get install vim-gnome

Resources