vim-go icon indicating copy to clipboard operation
vim-go copied to clipboard

Some weird characters are printed onto the screen

Open tchap opened this issue 12 years ago • 26 comments

When I use the arrow keys to move around in the command mode, from time to time some weird characters are printed, like

^[OA args.B = &data.BenchmarkOptions{
^[OA     RandomOutput: true,
}

Started happening after I installed vim-go...

tchap avatar May 14 '14 09:05 tchap

I'm getting this as well. Using terminal mvim. It's not isolated with arrow keys, though. I've seen hjkl appear (visually, not in the file) while navigating around.

bcarrell avatar May 14 '14 12:05 bcarrell

I've found those two things:

http://stackoverflow.com/questions/6987317/while-moving-the-cursor-across-a-vim-process-open-in-a-tmux-session-every-now-a http://vim.wikia.com/wiki/Fix_arrow_keys_that_display_A_B_C_D_on_remote_shell

Probably a setting is leading to this behavior. It's only happening in Terminal. I need time to further investigate it because I've never encountered this on iterm2 mac os x

fatih avatar May 14 '14 12:05 fatih

If it helps, my version information is:

❯ mvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 12 2014 16:35:33)
MacOS X (unix) version
Included patches: 1-258
Compiled by Homebrew
...

My .vimrc is located here: https://github.com/bcarrell/dotfiles/blob/master/vimrc

I usually run macvim in a terminal/tmux setting with mvim -v within iterm2. Thanks fatih.

bcarrell avatar May 14 '14 13:05 bcarrell

image

There's a screenshot I captured of it occurring. The l appeared while navigating the current line in normal mode; it will persist if I enter insert mode. If I navigate to the line above or below, it'll disappear, but while I'm on the line it'll seem to stay until I actually edit the line.

bcarrell avatar May 14 '14 13:05 bcarrell

I'm seeing this on Ubuntu 14.04 w/Terminator and console vim.

It seems to have started sometime around May 12th.

schmichael avatar May 15 '14 18:05 schmichael

Since I reproduce this issue anytime, I did a quick bisect and identified the possible cause of the problem, in the context of vim-go.

I think the cause of this issue is automatically showing type info.

Commit f7954356aa70 adds go-info goodness to vim-go. Since go-info is not called automatically, the weird characters does not pop out of nowhere, unless you bind space character to go-info and pressing the space button like a monkey.

Commit 238cabea6a62 automatically shows type info (go-info) with 500ms delay. Since the issue arises from go-info, frequently calling it made the weird characters popping out more often.

Commit c38a9df84d1d decreases the latency (300ms) to automatically call go-info. After this commit, gathering the type info is more snappy but weird characters are popping out more and more frequently.

A quick workaround is to disable auto_type_info by adding "let g:auto_type_info=0" to your vimrc.

I hope this information helps the author to identify the main cause of the issue.

igungor avatar May 15 '14 18:05 igungor

@igungor thanks for the detailed report. I'll change the behavior to non automatic and give the option for people to enable it (like me). At least it would solve the problem in the short term.

fatih avatar May 15 '14 21:05 fatih

Please confirm. If it doesn't solve we should check somewhere else for a solution.

fatih avatar May 15 '14 21:05 fatih

Confirmed that disabling auto type info fixes it for me.

schmichael avatar May 15 '14 22:05 schmichael

A question everyone: Do you happen to use zsh and not bash? I have had this problem occurring in vim in mac+iterm2 and ubuntu+urxvt, unrelated to writing go and using vim-go at all:

https://groups.google.com/forum/#!topic/vim_use/UVxDG3lMQ0U/discussion

The common thing between these two setups was zsh + oh-my-zsh

In any case @fatih I'm using an updated vim-go version an still having this annoying garbage characters.

oryband avatar Apr 05 '15 07:04 oryband

Maybe youcompleteme or someother plugin is causing updates on cursor move just like vim-go did before this issue was fixed, and is polluting the screen in its place.

oryband avatar Apr 05 '15 07:04 oryband

i am also facing the same issue, in Ubuntu as well as Mac

vimalk78 avatar Nov 16 '16 19:11 vimalk78

I have a similar issue with macOS + iTerm + zsh + oh-my-zsh.

For me the only thing that makes it go away is disabling neocomplete. It seems that after pressing the ., something takes too much time, so I see garbage characters displayed. In my case, the easiest way to reproduce is when I type a package name that is not imported yet, and then I start typing a function name really fast. If I wait about a second after typing the dot, it doesn't really happen.

Additionally, if I try to correct a function name, there is a noticeable delay between pressing the backspace and the removal of the character from the screen.

tamasd avatar Jan 15 '17 20:01 tamasd

I am having the same issue.

I noticed that if i scroll the screen so that the escape sequences are no longer in the window, then when I scroll back, they are gone.

I have auto type info also on.

JuanCabre avatar Jan 20 '17 15:01 JuanCabre

I facing with a similar problem when using auto completion, every time I write code which is completable like (t testing.T) e.g T when T appears I can't do anything else, even opening the file again once I go to the code the error comes again avoiding me to write anything else,

Pls see the pic below screen shot 2017-03-21 at 12 49 07 am

I already disabled auto_type_info but the error persists, shall I open an new issue?

rafaeljesus avatar Mar 21 '17 04:03 rafaeljesus

I found myself a temporary solution for this autocmd FileType go set omnifunc= even losing completion features at least I can write code 🙂

rafaeljesus avatar Mar 21 '17 15:03 rafaeljesus

I also encountered this problem. My environment is macOS + iTerm2 I used neocomplete for autocomplete.

I will report that I could avoid the problem by deleting $GOPATH/bin/gocode or disabling neocomplete. In addition, the report of @rafaeljesus was effective.

To me the cause of this problem seemed to be a conflict between gocode and neocomplete.

My vimrc:

if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'altercation/vim-colors-solarized'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'fatih/vim-go'
Plug 'kchmck/vim-coffee-script'
Plug 'mattn/sonictemplate-vim'
Plug 'Shougo/neocomplete.vim'
Plug 'tpope/vim-fugitive'
Plug 'udalov/kotlin-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-syntastic/syntastic'
call plug#end()

" Basics
set backspace=indent,eol,start
set directory=~/tmp,/var/tmp,/tmp
set hlsearch
set laststatus=2
set noshowmode
set ruler
set whichwrap=b,s,h,l,<,>,~,[,]

" Indents
set shiftwidth=4
set tabstop=4

" altercation/vim-colors-solarized
set background=dark
let g:solarized_termcolors = 256
colorscheme solarized

" fatih/vim-go
let g:go_fmt_command = "goimports"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_generate_tags = 1
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:go_list_type = "quickfix"

" Shougo/neocomplete.vim
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_auto_select = 1

" vim-airline/vim-airline-themes
let g:airline_theme = 'solarized'
let g:airline_solarized_bg = 'dark'

" vim-syntastic/syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

Screenshot: 2017-06-16 19 04 02

178inaba avatar Jun 16 '17 09:06 178inaba

Had this issue with zsh/oh-my-zsh. Using vanilla bash solved this issue (amongst others) that I was having with vim.

kuiro5 avatar Jun 20 '17 17:06 kuiro5

I am experiencing the problem in vanilla BASH, Terminator. Disabling same_id highlighting solves the problem.

syifan avatar Jun 27 '17 00:06 syifan

I'm having the same issue on OSX 10.12.6, ITerm2 3.1.5, vim-go, YCM. Here's vimrc:

set tabstop=4
set shiftwidth=4
set expandtab
set number
set backspace=indent,eol,start

vnoremap <C-c> :w !pbcopy<CR><CR> 
noremap <C-v> :r !pbpaste<CR><CR>

set background=dark

set laststatus=2

filetype plugin indent on

" attempt to fix issue with characters from vim normal mode getting crapped
" out onto the screen
let g:auto_type_info=0

call plug#begin('~/.vim/plugged')

Plug 'Valloric/YouCompleteMe'
Plug 'fatih/vim-go'
Plug 'w0rp/ale'

call plug#end()

EDIT: I can confirm this actually has nothing to do with vim-go - I still get this behavior with the plugin disabled and I also get it in both normal terminal as well as iterm2. I disabled all the plugins and it still happens although less frequently. Seems to happen when the process is interrupted.

kregan77 avatar Feb 14 '18 15:02 kregan77