vim replaces lines when I move to a new line - macos

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.

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.

how do you enable command line editing with vim keys using mac terminal?

I'm reading this book and I really do not understand what this author is talking about. It appears that you can program your mac to go forward one character by either hitting l or ^F. I do not understand the difference between emac key stroke and vim keystroke. He also says run this command and 'place it in your $HOME/.bash_profile but I cannot figure out how to place the command in the bas_profile.
The Author is talking about make you terminal console behaves like vi, this means typing set -o vi in your terminal, the console will work similar vi. So you will be able to navigate using the motion keys of vi, use INSERT mode, x to delete, etc.
You can set that permanently if you include this command in your ~/.bash_profile file.
If you are not sure what it does, I don't recommend so.

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

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.

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.

Resources