ideavim 插件配置
set scrolloff=3 " 3 lines above/below cursor when scrolling
" 突出显示当前行
set cursorline
" 在状态栏显示正在输入的命令
- set showcmd
- " Emulated Plugins
- set surround
- " Use Idea to join lines smartly
- set ideajoin
- " Multiple cursors support
- set multiple-cursors
" VIM 的默认寄存器和系统剪贴板共享
- set clipboard+=unnamed
- set history=100000
" select 模式下复制
- if has("clipboard")
- vnoremap <C-C> "+y
- endif
" 修改 leader 键
- let mapleader = ' '
- imap ,. <Esc>
- vmap ,. <Esc>
" 设置文内智能搜索提示
" 高亮 search 命中的文本
set hlsearch
" 打开增量搜索模式, 随着键入即时搜索
set incsearch
" 搜索时忽略大小写
set ignorecase
" 有一个或以上大写字母时仍大小写敏感
set smartcase
" 去掉搜索高亮
- nnoremap <leader>/ :nohls<CR>
- " clear the highlighted search result
- nnoremap <Leader>sc :nohlsearch<CR>
- " These create newlines like o and O but stay in normal mode
- nmap zj o<Esc>k
- nmap zk O<Esc>j
- " key bindings for quickly movign between Windows
- " h left, l right, k up, j down
- nmap <leader>h <c-w>h
- nmap <leader>l <c-w>l
- nmap <leader>k <c-w>k
- nmap <leader>j <c-w>j
- " Move half page faster
- nnoremap <leader>d <C-d>
- nnoremap <leader>u <C-u>
- " Tab operation
- nnoremap tn gt
- nnoremap tp gT
- " Closing tabs
- nmap tx :action CloseContent<cr>
- nmap tX :action ReopenClosedTab<cr>
- " Move to the start of line
- nnoremap H ^
- " Move to the end of line
- nnoremap L $
- " Redo
- nnoremap U <C-r>
- " Yank to the end of line
- nnoremap Y y$
- nmap <leader>b :action Back<cr>
- nmap <leader>f :action Forward<cr>
- nmap <leader>c :action GotoClass<cr>
- nmap <leader>sp :action FileStructurePopup<cr>
- nmap <leader>ed :action ShowErrorDescription<cr>
- nmap == :action ReformatCode<cr>
- " Switches between .cc and .h file!
- nmap <leader>s :action GotoRelated<cr>
- "Won't work in visual mode (with vmap) for some reason.
- " Use default map of <c-/> for that.
- nmap gcc :action CommentByLineComment<cr>
- nmap ;; :action CommentByLineComment<cr>
- nmap gzz :action CommentByBlockComment<CR>
- " Terminal
- nmap <leader>T :action ActivateTerminalToolWindow<cr>
- " Errors
- nmap <leader>q :action GotoNextError<cr>
- nmap <leader>Q :action GotoPreviousError<cr>
" 映射到 idea 快捷键
" 弹出输入框, 可以跳到指定类
nnoremap <Space>gc :action GotoClass<CR>
" 弹出输入框, 跳转到指定操作
nnoremap <Space>ga :action GotoAction<CR>
" 跳转到定义
nnoremap <Space>gd :action GotoDeclaration<CR>
" 跳转到实现
nnoremap <Space>gi :action GotoImplementation<CR>
" 跳转到指定的文件
nnoremap <Space>gf :action GotoFile<CR>
" 跳转到方法的声明
nnoremap <Space>gs :action GotoSuperMethod<CR>
" 跳转到测试
nnoremap <Space>gt :action GotoTest<CR>
" 跳转到变量的声明
- nnoremap <Space>gS :action GotoSymbol<CR>
- nnoremap <Leader>oi :action OptimizeImports<CR>
" 查找使用
nnoremap <Space>fu :action FindUsages<CR>
" 显示使用
- nnoremap <Space>su :action ShowUsages<CR>
- nnoremap fsp :action FileStructurePopup<CR>
- nnoremap <Leader>fp :action ShowFilePath<CR>
- nnoremap <Leader>re :action RenameElement<CR>
- nnoremap <Leader>rf :action RenameFile<CR>
- nnoremap <Leader>se :action SearchEverywhere<CR>
- nnoremap <Leader>su :action ShowUsages<CR>
- nnoremap <Leader>pm :action ShowPopupMenu<CR>
- nnoremap <Leader>tc :action CloseActiveTab<CR>
- nnoremap <leader>th :action TypeHierarchy<CR>
- nnoremap wt :action ActiveToolwindowGroup<CR>
- nnoremap wj :action ActivateStructureToolWindow<CR>
- nnoremap fip :action FindInPath<CR>
- nnoremap <leader>nc :action NewClass<CR>
- nnoremap <leader>np :action NewProject<CR>
- nnoremap <leader>nm :action NewModule<CR>
- nnoremap <leader>nf :action NewFile<CR>
" 前进, 相当似于 eclipse 中的 alt + 方向右键
nnoremap gf :action Forward<CR>
" 后退, 相当于 eclipse 中的 alt + 方向左键
nnoremap gb :action Back<CR>
" gh=go head, 映射 VIM 中的 ^
nnoremap gh ^
" gl=go last, 映射 VIM 中的 $
- nnoremap gl $
- " Windows operation
- nnoremap <Space>ww <C-W>w
- nnoremap <Space>wc <C-W>c
- nnoremap <Space>wj <C-W>j
- nnoremap <Space>wk <C-W>k
- nnoremap <Space>wh <C-W>h
- nnoremap <Space>wl <C-W>l
- nnoremap <Space>ws <C-W>s
- nnoremap <Space>w- <C-W>-
- nnoremap <Space>w+ <C-W>+
- nnoremap <Space>w= <C-W>=
- nnoremap <Space>wv <C-W>vf
来源: http://www.bubuko.com/infodetail-3790747.html