在vim中,使用Command-T时Ctrl+S(水平分割)无法正常工作。

11

我无法使水平分割工作。按下Ctrl+Enter没有任何反应,按下Ctrl+S也没有反应。

我已经搜索了一段时间,到目前为止,我找到的唯一解决方案都与OSX相关。

在Arch Linux和Ubuntu上都出现了同样的问题(但配置也相同)。

我没有使用Janus或类似的东西,只是一个非常基本的配置。

set t_Co=256
set tabstop=2
set expandtab
set shiftwidth=2
set fileencoding=utf-8
set encoding=utf-8
set termencoding=utf-8
set showcmd
filetype plugin indent on
"color molokai
syntax enable
autocmd! BufNewFile * silent! 0r ~/.vim/skel/tmpl.%:e
set laststatus=2 " Always show the statusline

set backspace=indent,eol,start  " backspace through everything in insert mode

"" Searching
set hlsearch                    " highlight matches
set incsearch                   " incremental searching
set ignorecase                  " searches are case insensitive...
set smartcase                   " ... unless they contain at least one capital letter

call pathogen#infect()
colorscheme jellybeans
" use comma as <Leader> key instead of backslash
let mapleader=","

" Double <Leader> to switch between buffers
nnoremap <leader><leader> <c-^>
" double percentage sign in command mode is expanded
" to directory of current file - http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>

map <leader>f :CommandTFlush<cr>\|:CommandT<cr>
map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr>

[~]$ ls .vim/bundle
rbenv:system command-t jellybeans.vim snipmate-snippets tlib_vim vim-addon-mw-utils vim-powerline vim-snipmate

我希望有人能够解决这个问题,这真的很令人沮丧。

我不完全确定出了什么问题,但它偶尔会工作,但现在根本不起作用。

按CTRL+S没有任何反应,shift+enter只是在当前缓冲区正常打开它,ctrl+enter只是在Command-T中跳转到搜索结果列表。

1个回答

19
在大多数终端中,Vim无法区分Enter和与CtrlShift组合的按键,遗憾的是这些只在GVIM中有效。

终端的流量控制命令可能会干扰Ctrl-S和Ctrl-Q键;这可以通过以下方式进行修复(在终端中,不是在Vim中!):

stty start undef stop undef

在 ~/.bashrc,~/.zshrc 等文件中。


1
我现在非常喜欢你。我已经断断续续地努力解决这个问题至少几个月了。我一直没有它过。另外,我是个白痴。我之前在我的.bashrc中输入了stty -ixon -ixoff来尝试修复它..而我正在使用zsh :/ - flexd
1
@KitHo 它关闭了终端的流控制。流控制是让您按CTRL-S停止终端流(冻结它)并按Ctrl-Q恢复的功能。或者反过来,我已经禁用了它们,所以我记不清哪个做什么了 :-) - flexd
这是一个完美的解决方法。谢谢。 - Mert Alnuaimi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接