vim 在终端屏幕上显示奇怪的字符

Shr*_*yas 5 vim command-line unicode openbox 14.04

所以我只是在上网本上安装了 ubuntu 并切换到 openbox 窗口管理器。

当我在终端中打开 VIM 并j在文件顶部点击或k从文件底部点击时,似乎会出现一些奇怪的 unicode 字符。请在下面找到此屏幕截图。

编辑文件时这确实令人不安。为我屏蔽内容,直到我用光标浏览它。

任何帮助表示赞赏。谢谢

vim 奇怪的字符

小智 1

这是因为视觉铃声。您可以通过从 .vimrc 文件中删除或注释此行来解决此问题

`set visualbell`
Run Code Online (Sandbox Code Playgroud)

编辑:

我仍然不知道如何使用 Visualbell 并且不会遇到这个问题。


Joh*_*631 0

一个老问题,但我从 Tilix 更改为 Terminator 并遇到了类似的问题。我的解决方案基于第一个链接中给出的解决方案,但我需要一些额外的更改(铃声和其他解决方案对我没有帮助,我需要清除屏幕)。

这被添加到我的 virmc 的末尾。

" Solve extra characters on vim screens in terminator in Linux
" Enable different cursors based on the mode from
" https://github.com/mjedmonds/dotfiles/commit/41c1d4639d7b2b047d260602f27a80695cf73f9c
" Information on cursors to complete it from
" https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes"

if has("autocmd")
  au BufNewFile,VimEnter,BufEnter,InsertLeave * 
    \ silent execute '!echo -ne "\e[2 q"' | redraw!
  au InsertEnter,InsertChange *
    \ if v:insertmode == 'i' | 
    \   silent execute '!echo -ne "\e[6 q"' | redraw! |
    \ elseif v:insertmode == 'r' |
    \   silent execute '!echo -ne "\e[4 q"' | redraw! |
    \ endif
  au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
endif

let &t_SI = "\<Esc>P\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_SR = "\<Esc>P\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
let &t_EI = "\<Esc>P\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
Run Code Online (Sandbox Code Playgroud)