>  Q&A  >  본문

ubuntu - VIM键盘映射使用了终端的热键

自己编写的键盘映射失灵,而且vim正在使用bash的热键,
导致我的vim现在的操作是这样的
插入模式下
ctrl-w 删除光标前的一个单词
ctrl-L 打出了^L
CTRL-J 换行

怎么才能正常配置使用键盘映射
我的vim有两个插件,youcompleteme,vundle
我的系统是ubuntu gnome

我自己的vimrc是这样

"基本设置
set nu
set tabstop=4
set bg=dark
set expandtab
set cursorline
set softtabstop=4
set hls
set shiftwidth=4
set fdm=syntax
set foldlevelstart=99
set autoindent
au filetype c,cpp set cindent
"键盘映射
map <S-Right> <Esc>:tabn<CR>
imap <S-Right> <Esc>:tabn<CR>i
map <S-Left>  <ESC>:tabp<CR>
imap <S-Left>  <ESC>:tabp<CR>i
map <C-o>     <Esc>:tabnew 
imap <C-o>     <Esc>:tabnew 
map <F5>      <Esc>:w<CR>:!g++ % -o %<<CR>
imap <F5>      <Esc>:w<CR>:!g++ % -o %<<CR>
map <C-F5>    <Esc>:w<CR>:!g++ % -o %< && ./%<<CR>
imap <C-F5>    <Esc>:w<CR>:!g++ % -o %< && ./%<<CR>
map <C-s>   <Esc>:w<CR>
imap <C-s>  <Esc>:w<CR>i
map <C-w> <Esc>:wq<CR>
imap <C-w> <Esc>:wq<CR>
"颜色
set t_Co=256
color darkburn
"vundle设置
set nocompatible
set backspace=2
filetype off                  " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required! 
Bundle 'gmarik/vundle'
" My bundles here:
" original repos on GitHub
Bundle 'Valloric/YouCompleteMe'
"Bundle 'tpope/vim-fugitive'
"Bundle 'Lokaltog/vim-easymotion'
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
"Bundle 'tpope/vim-rails.git'
" vim-scripts repos
"Bundle 'L9'
"Bundle 'FuzzyFinder'
" non-GitHub repos
"Bundle 'git://git.wincent.com/command-t.git'
" Git repos on your local machine (i.e. when working on your own plugin)
"Bundle 'file:///Users/gmarik/path/to/plugin'
" ...
filetype plugin indent on     " required!
"YCM设置
set completeopt=longest,menu "关掉补全的预览
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' "默认配置
let g:ycm_confirm_extra_conf = 0 "不需手动确认

bash的配置文件我没有做任何更改
求问这个问题要怎么设置才能解决

巴扎黑巴扎黑2714일 전609

모든 응답(1)나는 대답할 것이다

  • 怪我咯

    怪我咯2017-04-21 10:57:52

    내가 작성한 키보드 매핑이 실패했고 vim이 bash 단축키를 사용하고 있습니다.
    내 vim의 현재 작업은 다음과 같습니다
    삽입 모드
    ctrl-w는 커서 앞의 단어를 삭제합니다
    Ctrl-L 입력 ^L
    CTRL-J 줄바꿈

    실제로 vim은 bash 단축키를 사용하지 않고 자체 기본 단축키를 사용합니다:h i_CTRL-w. 여기서 올바른 접근 방식은 noremap을 사용하여 기본 단축키를 재정의하는 것입니다.

    으아악

    다른 키 조합도 비슷합니다. Ctrl-w는 기본적으로 창 탐색에 중요한 단축키이며 개인적으로 이를 재정의하는 것을 권장하지 않습니다.

    회신하다
    0
  • 취소회신하다