Skip to content

Instantly share code, notes, and snippets.

@Lincest
Last active August 11, 2024 02:45
Show Gist options
  • Save Lincest/a275e3aa6ef3882ae90b9d8f0a8eae71 to your computer and use it in GitHub Desktop.
Save Lincest/a275e3aa6ef3882ae90b9d8f0a8eae71 to your computer and use it in GitHub Desktop.
.ideavimrc
" 一些基础设置
set number
set relativenumber
set ruler
set laststatus=2
set hlsearch
set incsearch
set showmode
set showcmd
" 模式查找忽略大小写
set ignorecase
set smartcase
" 共享系统剪切板
set clipboard = unamed
" 设置leader为空格
let mapleader = "\<space>"
" 启动插件
set easymotion
set surround
set commentary
set multiple-cursors
" ============multiple-cursors的默认配置修改==================
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
nmap g<C-n> <Plug>NextOccurrence
xmap g<C-n> <Plug>NextOccurrence
nmap <C-x> <Plug>SkipOccurrence
xmap <C-x> <Plug>SkipOccurrence
nmap <C-p> <Plug>RemoveOccurrence
xmap <C-p> <Plug>RemoveOccurrence
nmap <S-C-n> <Plug>AllWholeOccurrences
xmap <S-C-n> <Plug>AllWholeOccurrences
nmap g<S-C-n> <Plug>AllOccurrences
xmap g<S-C-n> <Plug>AllOccurrences
" ============multiple-cursors的默认配置修改==================
" 一些自定义map
noremap <leader>[ %
noremap <leader>] %
noremap H ^
noremap L $
" ================= 窗口管理 =====================
" 常用操作: <C-w>hjkl切换窗口 <C-w>v/s 垂直/水平切分窗口 <C-w>c关闭窗口(关闭窗口和底下所有的tab) gt/gT tab页切换
" 上一个tab
noremap J gT
" 下一个tab
noremap K gt
" 关闭tab
noremap <C-w>x :tabclose<CR>
" macos windows 切换
noremap <D-j> <C-w>h
noremap <D-k> <C-w>l
" windows window 切换
noremap <A-j> <C-w>h
noremap <A-k> <C-w>l
" ================= 窗口管理 =====================
" 自动格式化(空格+等号)
nnoremap <leader><leader>= :action ReformatCode<CR><esc>
" 开启输入法自动切换
:set keep-english-in-normal
" 这将在切换回来的时候保持原来的状态
" :set keep-english-in-normal-and-restore-in-insert
" --- IDE中的actions ----
" ==================================================
" `:actionlist` 查看所有action
" ==================================================
" 各种跳转到定义
nnoremap gu :action GotoImplementation<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>
" 在「ALL」中搜索
nnoremap <Leader>se :action SearchEverywhere<CR>
" Find搜索
nnoremap <leader>/ :action Find<CR>
" 注释
nnoremap <leader>cc :action CommentByLineComment<CR>
" 查找action
nnoremap <leader>? :action GotoAction<CR>
" 在当前目录(项目)下查找
nnoremap <leader>fp :action FindInPath<CR>
" 代码检查
nnoremap <leader>ic :action InspectCode<CR>
" 自动删除无效导入
nnoremap <leader>oi :action OptimizeImports<CR>
" 展开右键菜单
nnoremap <leader>pm :action ShowPopupMenu<CR>
" 重命名当前文件
nnoremap <leader>rf :action RenameFile<CR>
" 选择运行方式
nnoremap <leader>rc :action ChooseRunConfiguration<CR>
" 查看这个函数/变量..被谁使用, 谁定义
nnoremap <leader>su :action ShowUsages<CR>
" 跳转到下一个错误
nnoremap <leader>nn :action GotoNextError<CR>
nnoremap <leader>nb :action GotoPreviousError<CR>
" 重命名当前变量/函数..
nnoremap <leader>rn :action RenameElement<CR>
" 查看git的annotate
nnoremap <leader>sa :action Annotate<CR>
" 在当前目录下打开terminal
nnoremap <leader>st :action ActivateTerminalToolWindow<CR>
" 查看路径
nnoremap <leader>sp :action ShowFilePath<CR>
" 在目录树中定位当前文件
nnoremap <leader>fl :action SelectInProjectView<CR>
" ====================== debug ========================
" 选择运行方式
nnoremap <leader>rc :action ChooseRunConfiguration<CR>
" 打断点和查看断点
nnoremap <leader>bb :action ToggleLineBreakpoint<CR>
nnoremap <leader>br :action ViewBreakpoints<CR>
" debug的各个选项
nnoremap <leader>si :actino StepInto<CR>
nnoremap <leader>so :action StepOut<CR>
nnoremap <leader>sv :action StepOver<CR>
nnoremap <leader>rC :action RunToCursor<CR>
" ====================== debug ========================
set ideajoin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment