IdeaVim 配置

需要的插件

  • IdeaVim
  • IdeaVimExtension

我的配置

syntax on

# 行号设置
set number
set relativenumber

" 将tab替换为相应数量的空格
set expandtab
" 使用系统剪切板
set clipboard+=unnamedplus
" 使用idea 的行连接方式
set ideajoin
set ignorecase
set idearefactormode=keep

let mapleader=' '

set easymotion
set surround

" multiple-cursors start
set multiple-cursors
vmap <C-j> <Plug>NextWholeOccurrence
vmap g<C-j> <Plug>NextOccurrence
vmap <C-x> <Plug>SkipOccurrence
vmap <C-k> <Plug>RemoveOccurrence
vmap <S-C-j> <Plug>AllWholeOccurrences
vmap g<S-C-j> <Plug>AllOccurrences
" multiple-cursors end

" Which-key
set which-key
set notimeout

" redo
map U <C-r>

" NERDTree config
set NERDTree
map tt :NERDTreeToggle<CR>
map tc :NERDTreeClose<CR>
map tf :NERDTreeFocus<CR>

map H ^
map L $

" Actions
map <leader>g <Action>(EditorCompleteStatement)
map <leader>x <Action>(ShowIntentionActions)

map <leader>s <Action>(SearchEverywhere)
map <leader>f <Action>(FindInPath)
" 跳转到类
map <leader>o <Action>(GotoClass)

" 显示文件结构
map <leader>m <Action>(FileStructurePopup)
" 展示类继承关系
map <leader>h <Action>(TypeHierarchy)
" 复制一行
map <leader>d <Action>(EditorDuplicate)
" 复制选中的行
vmap <leader>d <Action>(EditorDuplicateLines)
map <leader>n <Action>(Generate)
map <leader>e <Action>(GotoNextError)

" 重命名 文件
map <leader>A <Action>(RenameFile)
" 重命名 变量、类名
map <leader>a <Action>(RenameElement)

map <leader>r <Action>(RunClass)
map <leader>R <Action>(DebugClass)
map <leader>b <Action>(ToggleLineBreakpoint)
map <leader>/ <Action>(CommentByLineComment)
vmap <leader>/ <Action>(CommentByBlockComment)

" 退出
map <leader>c <Action>(CloseContent)
map <leader>C <Action>(CloseAllEditors)

map == <Action>(ReformatCode)

" 跳转相关配置
map gd <Action>(GotoDeclaration)
map gu <Action>(GotoSuperMethod)
map gi <Action>(GotoImplementation)
map ga <Action>(GotoAction)
map gt <Action>(GotoTest)

" 抽取方法
map me <Action>(ExtractMethod)
map mi <Action>(ImplementMethods)
map mo <Action>(OverrideMethods)

map <s-tab> <Action>(PreviousTab)
map <tab> <Action>(NextTab)

" Refactor
map mr <Action>(Refactorings.QuickListPopupAction)
map <leader>ip <Action>(IntroduceParameter)
map <leader>iv <Action>(IntroduceVariable)
map <leader>ic <Action>(IntroduceConstant)
map <leader>if <Action>(IntroduceField)

" 窗口分割
map <c-\> <Action>(SplitVertically)
map <c--> <Action>(SplitHorizontally)
map <c-m> <Action>(MoveEditorToOppositeTabGroup)

sethandler <c-j> a:vim
sethandler <c-k> a:vim

" 窗口之间跳转
nmap <c-h> <c-w>h
nmap <c-j> <c-w>j
nmap <c-k> <c-w>k
nmap <c-l> <c-w>l

" 终端
sethandler <c-t> a:vim
map <c-t> <Action>(Terminal.OpenInTerminal)
map <leader>t <Action>(ActivateTerminalToolWindow)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • ideavim键盘流 最后更新于2019-12-06 作为一个vimer,不管使用什么IDE或者编辑器,安装完成后...
    比轩阅读 34,568评论 15 26
  • 在IDEA Intellij小技巧和插件一文中简单介绍了一下IdeaVim插件。在这里详细总结一下这个插件在日常编...
    BakerZhang阅读 4,513评论 0 9
  • 01. VIM 配置 02. Neovim 配置 03. IdeaVim 进阶配置 04. VsVim 配置 简介...
    Whyn阅读 20,770评论 0 4
  • 01. VIM 配置 02. Neovim 配置 03. IdeaVim 进阶配置 04. VsVim 配置 前言...
    Whyn阅读 4,659评论 0 2
  • 1. 常用插件 IdeaVim 截止至 2021.03.07 日,插件最后更新时间:2021.05.04IdeaV...
    TroyLiu阅读 556评论 0 1