Tabstops in Ultisnips not working properly with zsh - bash

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.

Related

Duplicated characters and non-updating input using tmux in zsh

First off:
I'm using tmux 2.5 installed via homebrew on OS X 10.12, in iTerm 2 (though the problem appears in Terminal.app as well). My tmux.conf is on Github, along with my zshrc.
The problem: Seemingly out of nowhere, I started seeing an issue with typing in the prompt. Typing keys once will display them twice, and backspacing will move the cursor forward and redraw characters already present on the line. This only happens inside of a tmux session, and not inside my "regular" terminal.
Here's a gif of the issue. In this gif, I type 1234567890, then hit backspace 9 times, and type ls. Note that 0 only shows up once, and lls with a duplicated l runs the ls command as expected.
Hopefully I just hit a weird key combo on accident, but I've been stuck on this for a while.
Thanks for any help!
Installing tmux-256color for macOS as in this guide solves the problem.
Running the following as mentioned in a github issue solved the problem for me:
brew install ncurses
$(brew --prefix)/opt/ncurses/bin/infocmp tmux-256color > ~/tmux-256color.info
tic -xe tmux-256color tmux-256color.info
infocmp tmux-256color | head
I'm also running into this issue as well. I encountered the problem similar to #artemave, by trying to change the set -g default-terminal "screen-256color" to set -g default-terminal "tmux-256color". The goal of doing this was to gain italics, per the tmux FAQ.
#taylor's answer didn't work for me, as I didn't have that command.
I managed to determine that:
The issue doesn't occur with bash
When running a blank .zshrc, backspacing creates new blank lines, but I'm not seeing the character duplication
Using tmux-256color will successfully give italic fonts
Using TERM=xterm-256color and TERM=konsole-256color does not change the above effects
Using xfce4terminal (0.8.9.1), Konsole (19.12.3), or URXVT (9.22) doesn't change the above behavior
I wasn't able to really "fix" the issue, as the even going down to a blank .tmux.conf wasn't able to change anything. Instead, I just needed to change it to anything else. xterm-256color was suggested in this issue, but I found nearly anything else would work fine.
I'll keep working on it and update this answer if I find anything else.
Edit: This tmux issue is the exact issue we're running into. I'll see if the solutions there work
https://github.com/tmux/tmux/issues/597
Edit 2: I've submitted a GitHub issue with tmux. No real results yet, but it does offer some guidance on things to check on.
The problem seems to be fixed after commenting out this line from my tmux.conf:
set -g default-command "reattach-to-user-namespace -l zsh"
I also had to manually run tmux kill-server instead of relying on just re-sourcing my conf file.
When I find some time, I'll look more into what went wrong here...

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.

Fish shell on windows outputs question mark before each prompt

I just switched to a windows machine and I'm trying to get fish configured correctly. I installed it through the default route, as a shell selected through cygwin setup. It seems to be working fine, but when I directly access fish.exe or run fish.exe through IntelliJ, it outputs a ? before very prompt:
I googled and found this on fish documentation FAQ:
I'm seeing weird output before each prompt when using screen. What's wrong?
Quick answer:
Run the following command in fish:
echo 'function fish_title;end' > ~/.config/fish/config.fish
Problem solved!
The long answer:
Fish is trying to set the titlebar message of your terminal. While
screen itself supports this feature, your terminal does not.
Unfortunately, when the underlying terminal doesn't support setting
the titlebar, screen simply passes through the escape codes and text
to the underlying terminal instead of ignoring them. It is impossible
detect and resolve this problem from inside fish since fish has no way
of knowing what the underlying terminal type is. For now, the only way
to fix this is to unset the titlebar message, as suggested above.
Note that fish has a default titlebar message, which will be used if
the fish_title function is undefined. So simply unsetting the
fish_title function will not work
So it appears that intelliJ and cmd (fish.exe runs in cmd.exe if you access it directly) do not support setting the title bar, so they just output the character to the terminal instead. However, their suggested solution does not work. I've tried various options like echoing an empty string or a space, but nothing gets rid of that darn question mark.
Has anyone else run into this and found a solution?
Notes:
It doesn't have this behavior when using fish through mintty.exe,
most likely since that terminal supports setting the title, but I really prefer
to use the terminal inside intelliJ instead of having it in a
separate window.
It didn't have this problem when I used fish through IntelliJ on Ubuntu or MacOSX, it appears to be isolated to Windows

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)

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