Vim copy to system clipboard using register not working (Mac computer) - macos

I have been spending some time looking for the solution. I have reinstalled Vim on my mac for several times using MacPorts. The vim --version command show that +clipboard and +xterm_clipboard, so I should be good to go. However, when I type "+yy or "*yy inside vim, the :reg command show that the register changed to the current line, but when I do paste outside vim, the content still did not change. Everything in vim I can tolerate to trade off its super flexibility, however, this copy/paste which is frequently used but extremely difficult in vim really driving me crazy...

I've found that if I add set clipboard=unnamed to my .vimrc, then pasting outside of vim will paste the contents of the * register. For + you might try set clipboard=unnamedplus.

Problem solved. I am always using system vim, which is /opt/local/bin/vim. I think there was some glitch going on there. So I installed MacVim, and link vim to MacVim by adding the following code to my bash profile (~/.bash_profile)
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'
Registers work perfectly with MacVim. Even though vim --version reveals that it is +clipboard but -xterm_clipboard.

For me, it was a matter of updating the vim that ships with OS X (7.3) via homebrew to 7.4.

Related

Vim commands do not respond anymore

Since yesterday, after I updated my macbook (system update, iterm update, oh_my_zsh and homebrew update), my Vim editor (the system one) does not quit anymore after typing :q or :x.
Most of the commands like saving don't work either, I sometimes can access the :help but I also can't quit it. I tried to install macvim in replacement but when I open it inside the command line with mvim -v I got the same issue.
The only way I found to quit it is to put it in the background with Ctrl+Z and force kill it, otherwise it won't close. I tried to find the solution online but most of the topics are about how to close it when it's working (for beginners) or are only about macvim.

Tabstops in Ultisnips not working properly with zsh

I recently switched from bash to zsh and now the tabstops in my Ultisnips-snippets aren't working properly anymore.
I didn't change anything in my snippet files and after I encountered the problem for the first time, I went back to bash, started vim from there and the snippets worked as intended again.
I have these to snippets
snippet ( iA
($1)$0
endsnippet
snippet mk wA
$$1$$0
endsnippet
If I run vim from bash and type mk, it will expand to
$Cursor$
(I will denote the cursor position by Cursor). Then I can type f( and it will expand to
$f(Cursor)$
If I press x and then tab it will take me to
$f(x)Cursor$
(I will call this previous step S). Pressing tab again I will arrive at
$f(x)$Cursor
Running vim from zsh however, I can still do the steps until S but if I then press tab, it will stay at
$f(x)Cursor$
and start inserting tabs after that. If I only do mk however and type something else without brackets, for example ab
$abCursor$
and then press tab, it will work as expected and get me to
$ab$Cursor
Does anybody have an idea what's going on here? What can I do if I want to keep using zsh and Ultisnips? If I run bash -c 'vim file.txt', vim will work really slowly and lag a lot, so that is not really an option.
Any help would be appreciated.
Edit: Apparently the problem has something to do with what version of vim I'm using. I use macOS and the problem I described happens when I use the default vim version. If I use a custom-compiled version of vim, it works as expected. And as it turns out I have some config file that tells bash to use the custom-compiled version, whereas zsh still uses the default one. I also tried it on my PC (running Ubuntu) and with the vim version installed there, it also worked. So I guess, I'll use my custom-compiled vim to avoid this problem...
But does anybody know, what vim setting could be responsible for this? If I'm not mistaken my custom-compiled version is just the huge-feature version of vim.

IPython in Emacs py-shell: TAB completion not working & windows get killed

I've switched from ipython 0.10-11.1 to 1.1.0
Now, using Emacs together with the new ipython version I run into the following two problems:
1) Tab completion in Emac's ipython py-shell (C-c !) stopped working for me. Say, if I try to complete 'pl' into 'plot' and so pl<Tab>, the only thing I get in the minibuffer is
Can't find completion for "pl" based on line pl
There are many similar reports about this on the web, however none of the fixes I found solve the issue for me. In particular the additions to ~/.emacs/init.el suggested at http://www.emacswiki.org/emacs/PythonProgrammingInEmacs, in section IPython just don't 'do' anything.
2) When I start the py-shell on a any given buffer foo.py, which is open within one of several Emacs subwindows, then, all other subwindows, except for the one corresponding to foo.py and the newly started (ipython) py-shell get closed.
Both of these issues where absent in ipython 0.10-11.1. Anyone has an idea?
My Emacs version: GNU Emacs 23.2.1. My ipython.el version: defconst ipython-version "0.11" from https://github.com/ipython/ipython/tree/master/docs/emacs
Completion from a (I)Python-shell is just TAB
C-c ! from inside a shell should open another shell, but seems broken indeed, resp. it's not available.
https://bugs.launchpad.net/python-mode/+bug/1234539
Fixed in trunk meanwhile.
BTW to open a second shell from inside, C-u M-x python should work.
Did you set py-python-command-args accordingly?
Assume plot needs option -pylab.
Troubleshooting:
Start with Emacs -Q from the directory where python-mode.el lives.
Open python-mode.el and evaluate it.
Open a --maybe empty-- file with ending ".py".
Python-mode should be switched on.
M-x python RET
a regular Python-shell should appear.
M-x ipython RET
an IPython-shell should open.
Always call (I)Python-shell from a python-mode activated already.
Otherwise shipped python.el or other stuff might come between.
Link shows TAB-completion with IPython-1.1.0 at work:
https://launchpadlibrarian.net/152211804/ex.png
The previous answer does not provide any clue for how to get TAB-completion to work with IPython-1.1.0 and GNU Emacs 23.2.1. In fact the troubleshooting steps, starting from a bare-bones Emacs, do not lead to an IPython-shell with working TAB-completion. Moreover the image at https://launchpadlibrarian.net/152211804/ex.png claiming TAB-completion at work with IPython-1.1.0 depicts an Emacs 24.3.50.1, rather than an Emacs 23.2.1 which I was referring to in my question.
For me the solution was: get rid of IPython-1.1.0 reinstall IPython 0.10-11.1.
(That leaves you without the more recent notebook feature - which is fine if Emacs is at the core of your Python workflow anyway)

Terminal in OSX Lion looks different after unknown command

I spent some time today installing Ruby, Rails and other web development stuff through homebrew and rvm. But somewhere i must have put the wrong command in the terminal since my terminal on OS X Lion (same with both standard terminal and iTerm2) now looks weird.
How do I get rid of that red tilde and black arrow and get it back how it looks as default?
As I am a beginner at terminal commands I would appreciate your help.
it seems like PS1 has been changed.
what you can do now is to change it back, or simply delete it to return to default.
in terminal, do the following:
cd ~
grep "export PS1" .*
then you will see some outputs, it might be in .profile or .bashrc, (just ignore the history one)
you can use whatever to open the file. or just open .filename in terminal, delete the line with export PS1, save, relogin. the problem shall be resolved.

vim replaces lines when I move to a new line

I'm using Terminal.app on Mac 10.6.6 and want to upgrade vim. Should I install it in /usr/local?
I'm asking because my native vim install is messed up for some reason. Sometimes, when I open it and move up and down, the whole line changes to another line on the screen, like dancing chairs. But if I type :q it quits fine because nothing actually gets changed (cause I'm just moving the cursor around), but I can't see what I'm doing because when I move to a new line, that line gets replaced with another line about 6 lines below, but it's random.
$TERM = xterm-color
I installed Mercurial & ack via CPAN (for which I installed File:Next) yesterday, so maybe that did it. I have MacVim, but I want vim to work too cause I use it for Git, etc.
Try running vim -u "NONE" to load your Vim without your .vimrc, this might be the culprit in this case. If everything works like it should you can try re-enabling things one by one so you can see what caused it.
If you want to update your Vim I can recommend homebrew which has a so called formula with a regularly updated Vim.
Put the mvim script that came with MacVim in your $PATH and use it on the terminal with the -v option or a symbolic link named vim.
Also, use TERM=dtterm for Terminal.app. Programs will behave better.

Resources