该部分还未整理完成,用于自己做记录。
let mapleader=' '
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmode
set number
" set relativenumber
set scrolloff=3
set history=100000
set clipboard=unnamed
" clear the highlighted search result
nnoremap <Leader>? :action GotoAction<CR>
nnoremap gi :action GotoDeclaration<CR>
nnoremap gu :action GotoImplementation<CR>
" Quit normal mode
nnoremap <Leader>q :q<CR>
nnoremap <Leader>Q :qa!<CR>
" Move half page faster
nnoremap <Leader>d <C-d>
nnoremap <Leader>u <C-u>
" Insert mode shortcut
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-d> <Delete>
" Yank to the end of line
nnoremap Y y$
" quit ==> close current window
nnoremap <Leader>q <C-W>w
" Window operation
nnoremap <Leader>ww <C-W>w
nnoremap <Leader>wd <C-W>c
nnoremap <Leader>wj <C-W>j
nnoremap <Leader>wk <C-W>k
nnoremap <Leader>wh <C-W>h
nnoremap <Leader>wl <C-W>l
nnoremap <Leader>ws <C-W>s
nnoremap <Leader>w- <C-W>s
nnoremap <Leader>wv <C-W>v
nnoremap <Leader>w\| <C-W>v
" Tab operation
nnoremap K gt
nnoremap J gT
" ==================================================
" Show all the provided actions via `:actionlist`
" ==================================================
" built in search looks better
nnoremap / :action Find<CR>
" but preserve ideavim search
nnoremap <Leader>/ /
nnoremap <Leader>;; :action CommentByLineComment<CR>
nnoremap <Leader>bb :action ToggleLineBreakpoint<CR>
nnoremap <Leader>br :action ViewBreakpoints<CR>
nnoremap <Leader>cv :action ChangeView<CR>
nnoremap <Leader>cd :action ChooseDebugConfiguration<CR>
nnoremap <Leader>sp :action ShowFilePath<CR>
nnoremap <Leader>fp :action FindInPath<CR>
nnoremap <Leader>ic :action InspectCode<CR>
nnoremap <Leader>mv :action ActivateMavenProjectsToolWindow<CR>
nnoremap <Leader>oi :action OptimizeImports<CR>
nnoremap <Leader>pm :action ShowPopupMenu<CR>
nnoremap <Leader>rc :action RunToCursor<CR>
nnoremap <Leader>rC :action ChooseRunConfiguration<CR>
nnoremap <Leader>rf :action RenameFile<CR>
nnoremap <Leader>rr :action Rerun<CR>
nnoremap <Leader>se :action SearchEverywhere<CR>
nnoremap <Leader>su :action ShowUsages<CR>
nnoremap <Leader>tc :action CloseActiveTab<CR>
nnoremap <Leader>si :action StepInto<CR>
nnoremap <Leader>tb :action ToggleLineBreakpoint<CR>
" ==================================================
" Insert mode
" ==================================================
" Quit insert mode
inoremap jk <Esc>
" inoremap jj <Esc>
" inoremap kk <Esc>
" Insert mode shortcut
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
" 行尾加;并换行
inoremap ;<Cr> <Esc>A;<Cr>
" 行尾加;不换行
inoremap ;; <Esc>A;
" 给一个单词加"
inoremap ;' <Esc>viw<Esc>a'<Esc>hbi'<Esc>lEa
" ==================================================
" Visual mode
" ==================================================
" 打开终端
vnoremap <Leader>tl y<CR>:action ActivateTerminalToolWindow<CR>
" 注释
vnoremap <Leader>cc :action CommentByLineComment<CR>
" 快速跳转
vnoremap <Leader>j <C-d>
vnoremap <Leader>k <C-u>
" 跳转到行首/行尾
vnoremap H "^"
vnoremap L "$"
set clipboard+=ideaput
" Quit visual mode
vnoremap v <Esc>
" ==================================================
" Normal mode
" ==================================================
" 快速跳转
nnoremap <Leader>j <C-d>
nnoremap <Leader>k <C-u>
" 退出并保存
nnoremap q :wq<Cr>
" Redo
nnoremap U <C-r>
" 移动至行首、行尾
nnoremap H "^"
nnoremap L "$"
" 跳转到上个位置/下个位置
nnoremap <Leader>h <C-o>
nnoremap <Leader>l <C-i>
" 注释
nnoremap <Leader>cc :action CommentByLineComment<CR>
" 标签跳转
nnoremap J gT
nnoremap K gt
" 窗口切换
nnoremap <tab> <C-w>
" Project search
nnoremap <Leader>ps :action SearchEverywhere<CR>
nnoremap <Leader>of :action GotoFile<CR>
" Terminal
nnoremap <Leader>ot Vy<CR>:action ActivateTerminalToolWindow<CR>
nooremap <leader>ct :action negativeTerminalToolWindow<CR>
" 定义相关
nnoremap ga :action GotoAction<CR>
nnoremap gc :action GotoClass<CR>
nnoremap gi :action GotoDeclaration<CR>
nnoremap gf :action GotoFile<CR>
nnoremap gs :action GotoSymbol<CR>
nnoremap gu :action Vcs.Log.CompactReferencesView<CR>
" 整理格式
nnoremap <Leader>rf :action ReformatCode<CR>
" 打断点
nnoremap <Leader>sb :action Debugger.FocusOnBreakpoint<CR>
" 跳转到下一个错误
nnoremap <Leader>nn :action GotoNextError<CR>
nnoremap <Leader>nb :action GotoPreviousError<CR>
" 重命名
nnoremap <Leader>rn :action RenameElement<CR>
" 取消高亮
nnoremap <Leader>ch :nohlsearch<CR>
" 文件保存
nnoremap <Leader>fs :w<CR>
" 查找使用的地方
nnoremap <Leader>fu :action FindUsages<CR>
" 查找相关
" 创建动作
nnoremap <Leader>ga :action GotoAction<CR>
" 查找类
nnoremap <Leader>gc :action GotoClass<CR>
" 查找定义
nnoremap <Leader>gd :action GotoDeclaration<CR>
" 查找文件
nnoremap <Leader>gf :action GotoFile<CR>
" 查找引用
nnoremap <Leader>gi :action GotoImplementation<CR>
" 查找符号
nnoremap <Leader>gs :action GotoSymbol<CR>
" 创建测试等
nnoremap <Leader>gt :action GotoTest<CR>