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?)
Related
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
According to this article code completion should work for any language with youcompleteme plugin. I set it up as follows in Debian Jessie:
installed vim from repository
installed youcompleteme from repository
issued 'vam install youcompleteme' in cli
After the last step vim start significantly slower, which means that it is loading the plugin. However, completion does not work.
The output of
$ vam status
Name User Status System Status
editexisting removed removed
justify installed removed
matchit removed removed
youcompleteme installed removed
Is there anything else I have to do to get youcompleteme working?
I contacted the maintainer and finally got the missing hint. As it turns out, all I had left to do was to enable filetype recognition.
In case someone else struggles with this, here are some instructions on how to setup Vim with the Debian package vim-youcompleteme.
Install vim and vim-youcompleteme packages
$ sudo apt-get install vim vim-youcompleteme
This will also install any required dependencies automatically. Afterwards you will have to issue the following command
$ vam install youcompleteme
The last command will create ~/.vim folder in your home folder. However, code completion does not work yet. Some further modifications are required. First copy the default ycm_extra_conf.py file to the newly created ~/.vim/ folder
$ cp /usr/share/doc/vim-youcompleteme/examples/ycm_extra_conf.py ~/.vim/.ycm_extra_conf.py
Then we need to tell vim to use this file for code completion in our .vim.rc and to turn on filetype recognition. The following two lines should be added to ~/.vimrc:
let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
filetype on
Now vim should be able to use code completion, e.g., with C++ files.
You should follow the installation instructions for YCM, including how to compile it:
Install development tools and CMake: sudo apt-get install
build-essential cmake
Make sure you have Python headers installed: sudo apt-get install
python-dev.
Compiling YCM with semantic support for C-family languages:
cd ~/.vim/bundle/YouCompleteMe ./install.py --clang-completer
Compiling YCM without semantic support for C-family languages:
cd ~/.vim/bundle/YouCompleteMe ./install.py
Also, I would give you the tip to use vim-plug for handling plugins.
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 Ubuntu-14.04
I compiled vim myself (to add support for YouCompleteMe), and now when I execute apt-get dist-upgrade it overwrites my version of vim (and other dependent packages) and causes vim to stop working.
How can I upgrade everything, without ruining what I have compiled myself?
It's generally a good idea to keep things which you've compiled yourself in /usr/local/. Nothing from apt will be installed there so the stuff you've put in the directory will be safe from upgrades.
The other option is to pin the vim package so that the upgrade will not install it (or any dependecies). This might work better if you apt-get source the vim, build the .deb, install it and then pin it rather than just overwriting /usr/bin/vim with your own compile.
I've removed MacVim from my /Applications/ directory but in terminal when I type vim an error is displayed: no such file or directory: /Applications/MacVim.app/Contents/MacOS/Vim
How do I go back to using the pre installed copy of vim?
Try brew uninstall macvim.
It will help if MacVim was installed with brew.
In the terminal type: which vim
That'll tell you what it's running when you type vim.
And if it's not /usr/bin/vim you're probably safe to delete it so it can find the pre installed version again.