在打开的文件上激活Vim更改命令

时间:2018-02-12 14:12:50

标签: vim

有些时候在vim active command c中的任何类型之前打开文件时,所以如果我输入一些例如j的移动命令,vim就会执行cj。可能是什么问题?

.vimrc

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set number
syntax on

" show command in bottom bar
set showcmd

" Sets how many lines of history VIM has to remember
set history=500

" To enable file type detection
filetype plugin on
filetype indent on " maybe delete if indent plugins installed

" Set to auto read when a file is changed from the outside
set autoread

" Set 7 lines to the cursor - when moving vertically using j/k
set so=7

" visual autocomplete for command menu
set wildmenu

" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
    set wildignore+=.git\*,.hg\*,.svn\*
else
    set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif

" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l

" Highlight search results
set hlsearch
"
" search as characters are entered
set incsearch

" highlight matches
set hlsearch

" brackets highlighting
hi MatchParen cterm=bold ctermbg=none ctermfg=magenta

" magic regexp
set magic

" Show matching brackets when text indicator is over them
set showmatch

" How many tenths of a second to blink when matching brackets
set mat=2

" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500

" Enable syntax highlighting
syntax enable

set background=dark

" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8

" Use Unix as the standard file type
set ffs=unix,dos,mac

" Enable 256 colors palette in Gnome Terminal
if $COLORTERM == 'gnome-terminal'
    set t_Co=256
endif

" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile

" Always show the status line
set laststatus=2

" Delete trailing white space on save, useful for some filetypes ;)
fun! CleanExtraSpaces()
    let save_cursor = getpos(".")
    let old_query = getreg('/')
    silent! %s/\s\+$//e
    call setpos('.', save_cursor)
    call setreg('/', old_query)
endfun

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" Use spaces instead of tabs
set expandtab

" Be smart when using tabs ;)
set smarttab

" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2

" Linebreak on 500 characters
set lbr
set tw=500

set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Editing mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Ladder
let mapleader=","

" Go to normal mode
inoremap jj <ESC>

" Reload Vim Config
map <leader>S :source ~/.vimrc<CR>

" Disable highlight when Escape
nnoremap <silent> <Esc> :nohlsearch<Bar>:echo<CR>

" Re-Open Previously Opened File
nnoremap <Leader><Leader> :e#<CR>

" Buffer
" Next buffer
nmap <C-l> :bnext<CR>
" Prev buffer
nmap <C-k> :bprevious<CR>

1 个答案:

答案 0 :(得分:2)

问题在于:

nnoremap <Esc> :<cr> 

事实上,问题可以通过映射来重现:

nnoremap <silent> <F3> :nohlsearch<Bar>:echo<CR>

要修复它,请在地图中avoid the Esc key。例如,使用 F3 代替:

{
    responseText : {
      "success":true,
      "code":0,
      "error":null,
      "total":1,
      "data":[
        {
          "DATE":"2018-02-07",
          "1.1":"10","1.2":"3"
        },
        {
          "DATE":"2018-03-04",
          "1.1":"1",
          "1.2":"5"
        }
      ]
    }
};
相关问题