vim自定义快捷键
下面是我搞的一个快捷键映射,比较符合 windows 的习惯
"" Source your .vimrc
"source ~/.vimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching.
set incsearch
" Don't use Ex mode, use Q for formatting.
map Q gq
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r <Action>(ReformatCode)
"" Map <leader>d to start debug
"map <leader>d <Action>(Debug)
"" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)
" Find more examples here: https://jb.gg/share-ideavimrc
" 设置 tab缩进"
set tabstop=4 " 设置Tab长度为4空格
set shiftwidth=4 " 设置自动缩进长度为4空格
set autoindent " 继承前一行的缩进方式,适用于多行注释
set smartindent
set laststatus=2
"显示命令"
set showcmd
" 开启实时搜索
set incsearch
" 搜索时大小写不敏感
set ignorecase
syntax enable
set nu
set showmatch
set timeoutlen=500
set clipboard+=unnamed
" CTRL-X and SHIFT-Del are Cut
vnoremap <C-X> "+x
vnoremap <S-Del> "+x
" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
" CTRL-V and SHIFT-Insert are Paste
map <C-V> "+gP
map <S-Insert> "+gP
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+
" 按f 直接进入 行首, t 表示 tail ,到行尾
map f ^
map t $
"J 和 j一样,原来的 vim的命令不习惯
map J ^
map K $
" H 直接跳到行首
map H gg
" shift + l 跳到文件末尾
map L G
set whichwrap=h,l,b,s,<,>,[,]
"关闭讨厌的铃声
set vb t_vb=
imap jk jk
" insert模式下 ee = esc退出
imap ee <Esc>
" insert模式 按 qq = esc
imap qq <Esc>
" normal模式 按 c 转命令模式
nmap c :
" 原来要 按两次,我这里一次等于翻一页
nmap [ <PageUp>
nmap ] <PageDown>
无插件版快捷键
上面的 会覆盖原来的快捷键,下面是最新总结的快捷键
" -- hl"
" " afasasfaff
"
set nocompatible
set tabstop=4
set shiftwidth=4
set autoindent
set number
syntax enable
set ignorecase
set incsearch
" set timeoutlen=350
set whichwrap=h,l,b,s,<,>,[,]
set showmatch
filetype plugin indent on
set clipboard+=unnamed
cnoremap qq x
" 按下 l 会自动切换为!
cnoremap q; q!
cnoremap q' q!
cnoremap ql q!
" 命令模式再按:或者 tab 会退出,不需要按esc切换
cnoremap : <ESC>
cnoremap <Tab> <ESC>