Yesterday, I upgraded to MacOS Sierra and it broke my clipboard functionality in my tmux + neovim setup.
Here is the behavior:
I can use the standard ctrl+c, ctrl+p to copy/paste between system <-> vim
I can yank/paste between two VIM instances when NOT in a tmux session
I cannot yank/paste between two VIM instances when in a tmux session
Whenever I use the clipboard in vim within a tmux session, I get the following vim error:
clipboard: error:
My .vimrc is huge, but here's what I think might be relevant:
set clipboard=unnamed
In my .tmux.conf (also truncated for brevity):
set -g prefix ` # use tilde key as prefix
bind ` send-key ` # insert tilde by pressing twice
set -g history-limit 100000 # set buffer size
set -s escape-time 0 # fix escape key in vim
set -g allow-rename off # keep window names static
set -g default-terminal "screen-256color" # set the TERM to 256 colors
set -g base-index 1 # start window count at 1
set -g pane-base-index 1 # start pane count at 1
set -g default-shell $SHELL # use zsh as shell
EDIT: This appears to be related to the bug reported here:
https://github.com/tmux/tmux/issues/543
https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/issues/53
This seem to be a regression on macOS Sierra. A solution that worked for me has been mentioned by Josh McGinnis https://github.com/tmux/tmux/issues/543:
brew install reattach-to-user-namespace
Ensure the following is set in .tmux.conf:
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
In .vimrc or ~/.config/nvim/init.vim (for Neovim):
set clipboard=unnamed
Now all is well and I can copy/paste between system <-> vim sessions using vim keybindings and/or system ctrl+c / ctrl+p.
Upgrading brew + vim + tmux fixed this for me:
brew update
brew upgrade vim
brew upgrade tmux
Notes:
I am not using Neovim but hopefully this will help anyway
This may take a while depending on how slow your machine is
When I did this brew upgraded ruby for me and it complained that it wouldn't overwrite the existing symlinks so I had to manually run: brew link --overwrite ruby
Tmux complained about the following setting after the upgrade. I just commented it out: # set-option -g status-utf8 on
I had a warning about needing the new xcode tools so I ran the following and accepted the GUI prompts: xcode-select --install (In hindsight this may mess up my react-native install :/. Buyer beware)
When first running brew update brew complained it didn't have write access to /usr/local so I made myself the owner of /usr/local NON-RECURSIVE. After the update brew told me I could change the owner back to root:wheel.
I saw the same upon upgrading to Sierra. In my case it stemmed from having the YankRing plugin installed.
Adding the following to my .vimrc fixed it for me:
"-------------------------------------------------------------
" Fix for YankRing bug
"-------------------------------------------------------------
let g:yankring_clipboard_monitor=0
Related
I installed Vim on my MacBook today (using brew install vim), but I am having a problem: vim --version tells me that there is no Python 3, which I need. I already reinstalled the newest version of Python from their website, then did brew delete vim and brew cleanup and reinstalled Vim, but I'm still having the same problem. Online, I saw the option to use the flag --with-python3 when installing, but when I try that, I get told that this flag doesn't exist. Now I don't know what to do. Do I need to install Python via Homebrew? I also found some people online saying that there are versions of Vim compiled without Python, and that you can compile Vim yourself. Do I need to do that? How?
I should add: I'm very new to this, so if you post your answers or maybe need some more information from me, please explain in detail so I can understand.
I'm a new too.
First, use brew to remove vim you should input brew uninstall vim.Then try to reinstall vim.
For instance, if you wanted to recompile Vim 8 with Python 3 support on Linux, you can try do the following:
$ git clone https://github.com/vim/vim.git
$ cd vim/src
$ ./configure --with-features=huge --enable-python3interp
$ make
$ sudo make install
So,
I include this answer to "Way 0" and "Way 1".
_______________________________________________________________---Way 0 Begin---(:
Way 0:
we should reinstall python3 and VIM,
1.run the below on terminal
brew reinstall python3
the upstairs shows that we reinstall python3 to make sure that needed by VIM.
2.continue run on terminal
brew uninstall vim
the upstairs shows that uninstall vim only if you previously installed it
3.run on terminal
brew install vim
the upstairs shows that reinstall vim via Homebrew
4.run on terminal
4.1 directly use $SHELL command
alias vim=/usr/local/bin/vim
4.2 or bash 's profile(if you use bash as SHELL)
echo 'export PATH="/usr/local/opt/vim/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
4.3 OR zsh configuration file(if you use zsh as SHELL)
edit your zsh configuration file ~/.zshrc via
vim ~/.zshrc
and add the below to TOP line(just use i to enter editing status,
then use ":wq" to quit editing status and save file):
export VIM_HOME=/usr/local/Cellar/vim/8.2.2100/
export PATH=$PATH:$VIM_HOME/bin
and active that config
source ~/.zshrc
(Both 4.1 or 4.2 or 4.3 are the same function.)
the upstairs 4.1/4.2/4.3 shows that we let shell command vim using HomebrewVIM not the defaultVIM.
We know the default VIM functional file is located at /usr/bin/vim,
while homebrew VIM functional file is located at /usr/local/bin/vim;
And default VIM support Python2 with not supporting Python3,
but homebrew VIM support Python3(That's also we needed!).
Let's look at Homebrew VIM:
Homebrew will install VIM vim at /usr/local/Cellar/vim,
create soft link vim under /usr/local/opt,
and Homebrew VIM 's functional file vim is located at /usr/local/bin/vim, also linked to /usr/local/Cellar/vim.
5.exit terminal and restart terminal or even restart mac, input
the below on terminal
vim --version | grep "python3"
checkout whether the symbol bdfore "python3" is + or Not?
"+" means VIM support python3, but "-" Not.
____________________________________________________________---Way 0 END---:)
____________________________________________________---Way 1 Start---(::
Way 1:
First, you need to use this to checkout whether VIM support Python3 or not?
vim --version | grep python
you may see the terminal output liking:
+conceal +linebreak -python3 +visual
as the upstairs shows: that Mac default installed VIM DO NOT SUPPORT Python3.
And that default installed VIM of Mac is not been installed via "brew".
Now, we could not use liking "brew remove" to delate that default installed VIM of Mac,
and it's also why your action
"brew delete vim and brew cleanup and reinstalled Vim"
DO NOT FUNCTION!
Second,
we need to know where that fu-king default installed VIM with not supporting python3,
which vim
output:
/usr/bin/vim
mostly shows like the upstairs(depends default macOS).
Even we use "--with-python3 " to install VIM with supporting
Python3at a long time, but Now Homebrew ONLY recognize "python -V"'s version.
SO we NEED to manually let default python to be python3.
Open your terminal and input:
alias python="python3"
then checkout python that that version whether is python3 or not:
python -V
then, we found that "python -V" shows "Python 3.9.12".
Third,
That's time to use Homebrew to install VIM.
brew install vim
After installing HomebrewVIM, we need to make sure where is HomebrewVIM,
differ from that default installed VIM of Mac:
which vim
output:
/usr/local/bin/vim
Please restart Your Mac, restart Your Terminal and reenter your terminal!!!
Please restart Your Mac, restart Your Terminal and reenter your terminal!!!
Please restart Your Mac, restart Your Terminal and reenter your terminal!!!
then, we need to checkout whether that HomebrewVIM supports Python3 or Not:
vim --version | grep python
output:
+conceal +linebreak +python3 +visual
Successful!
__________________________________________________---Way 1 Terminal---::)
END!
The current vim i'm using is 7.3 version.
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 14 2016 16:06:49)
Compiled by root#apple.com
I tried to update vim to 8.0 by the command:
git clone https://github.com/vim/vim.git
cd vim/src
make
However, it doesn't work. It's still vim 7.3.
You may have compiled vim, but the vim that's first in your path is still the system vim. You can show that using:
$ which vim
/usr/bin/vim
You can either call your compiled vim directly (probably in a folder called dist or bin), or put it in a place that is before /usr/bin in your $PATH variable. The easiest way to get an up-to-date vim on OS X is to use Homebrew:
$ brew install vim --with-override-system-vi
Trying
brew install vim --override-system-vim
didn't work for me either.
Upgrade Homebrew to latest version and then use
brew upgrade vim
vim --version
$ brew install vim --with-override-system-vi
Sounds dumb but most importantly close the terminal and then reopen it to see the new version of vim $ vim --version.
You are missing the final step for installing from source after running make:
sudo make install
That should install it to your path.
I am new to Vim but am determined to learn it. I am on OS X El Capitan and have tried upgrading Vim 7.3 to 7.4 using several options but with no success.
I have used brew install with --with-system-override-vim option but although I can see that vim 7.4 is installed when I start my Vim editor it again reverts back to 7.3 version only.
Can anyone please guide me through the process of making sure that the system version is upgraded to 7.4.
Pretty sure homebrew installs vim under /usr/local/bin/
You really shouldn't overwrite the system vim, you should an alias to your .bash_profile file,
alias vim='/usr/local/bin/vim'
The other option would be to "hide" the current vim
mv /usr/bin/vim /usr/bin/vim73
And then when you run the vim command it won't find it under /usr/bin/ and will look in /usr/local/bin/
#dursk answer is correct, but I didn't have "/usr/local/bin/vim". My solution was to upgrade to latest version of MacVim it's 8.0 now ( http://macvim-dev.github.io/macvim/) install MacVim via .dmg file
after adding line below to .bash_profile file in user root folder
alias vim="/Applications/MacVim.app/Contents/MacOS/Vim"
After should run command source ~/.bash_profile to update bash_profile settings
Don't replace the system vi/vim in /usr/bin. Instead, use homebrew to install a newer version of vim:
brew update
brew install vim
That will install a newer vim to /usr/local/bin/vim. Make sure that your $PATH has /usr/local/bin before /usr/bin. You would probably also want to add a symlink for vi in /usr/local/bin as well:
ln -s /usr/local/bin/vim /usr/local/bin/vi
which vim # verify that it is /usr/local/bin/vim
which vi # verify that it is /usr/local/bin/vi
Vim on terminal, Ubuntu 14.04.
While messing with vim syntax files and color files, I accidentally deleted all vim file from /usr/share/
I originally installed vim with sudo apt-get install vim
To get back the files, I tried:
sudo apt-get remove, install, update, upgrade, and hg clone https://vim.googlecode.com/hg/ vim and make. The files I got with make doesn't seem to do much for me and are not identical to what I had before with get install vim in usr/share/ folder
with apt-get install, normal vim works but no syntax, color or other available things that was in vim file are all missing.
How do I completely reinstall vim / get back the default files?
Thanks
Just found it,
sudo apt-get purge vim
sudo apt-get install vim
seems to fix it for me. I spent unnecessarily too long on this to find a solution. Oh, well.
I'm using MINGW on a Windows 7 machine to ssh to an EC2 instance (Ubuntu) on which I would like to use vim as my text editor. If I run vim test.txt, enter Insert mode, and type this is a test, however, vim interprets each of the spaces in that sequence as an integer:
Does anyone know what could possible cause this? I tried updating vim with sudo apt-get install vim and was told I already had the most up to date vim. Any suggestions others can offer would be greatly appreciated.
I ended up purging and then reinstalling vim:
Purge to remove the package config files: sudo apt-get purge vim
Clean out any personalizations: rm -Rf ~/.vim ~/.vimrc ~/.viminfo
Reinstall Vim again: sudo apt-get install vim
That solved the problem, but I'm still interested to know what could possibly have created the issue. (Why would the space bar create increasing integer runs on a fresh EC2 instance? Is this some strange key mapping issue?)