my personal dotfiles managed by dotbot, zinit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
5.7 KiB

" see more https://blog.einverne.info/post/2020/12/my-idea-vimrc-config.html
4 years ago
" enable plugin
4 years ago
set easymotion
set surround
set multiple-cursors
set nu
" 相对行号
set rnu
" set clipboard=unnamed,autoselect
4 years ago
" Use comma as leader key, there are other modifier keys in this config,
" like space, \, t(in normal mode for toggle something),
" g(in normal mode for goto somewhere)
4 years ago
let mapleader = ","
let g:mapleader = ","
" https://github.com/JetBrains/ideavim/blob/master/doc/set-commands.md
4 years ago
set hlsearch
set incsearch
2 years ago
set scrolloff=2
4 years ago
set ignorecase
set smartcase
" 当前模式
4 years ago
set showmode
set history=10000
4 years ago
" source ~/.vimrc
2 years ago
" map r to reload ideavimrc in normal mode
noremap <space>r <ESC>:source ~/.ideavimrc<cr>
4 years ago
" general
nnoremap <Leader>f :<C-u>action ReformatCode<CR>
nnoremap <Leader>g :<C-u>action FindInPath<CR>
vnoremap <Leader>g :<C-u>action FindInPath<CR>
nnoremap <Leader>r :<C-u>action RenameElement<CR>
nnoremap <Leader>o :<C-u>action RecentProjectListGroup<CR>
nnoremap <Leader>d :<C-u>action ChooseDebugConfiguration<CR>
nnoremap <Leader>w :<C-u>action CloseAllEditorsButActive<CR>
" screen management
" Vertical split screen
nnoremap <Leader>\ <C-w>v
nnoremap <Leader>- <C-w>s
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
4 years ago
" Redo
nnoremap U <C-r>
" go to somewhere (g in normal mode for goto somewhere)
nnoremap ga :<C-u>action GotoAction<CR>
4 years ago
nnoremap gc :<C-u>action GotoClass<CR>
4 years ago
nnoremap gd :<C-u>action GotoDeclaration<CR>
nnoremap gs :<C-u>action GotoSuperMethod<CR>
nnoremap gi :<C-u>action GotoImplementation<CR>
nnoremap gf :<C-u>action GotoFile<CR>
nnoremap gm :<C-u>action GotoSymbol<CR>
4 years ago
nnoremap gl :<C-u>action JumpToLastChange<CR>
4 years ago
nnoremap gu :<C-u>action ShowUsages<CR>
nnoremap gt :<C-u>action GotoTest<CR>
4 years ago
nnoremap gp :<C-u>action FindInPath<CR>
nnoremap gr :<C-u>action RecentFiles<CR>
4 years ago
" cmd + [ and cmd + ]
" nnoremap gh :<C-u>action Back<CR>
" nnoremap gl :<C-u>action Forward<CR>
4 years ago
" code editing
nnoremap == :<C-u>action ReformatCode<CR>
vnoremap == :<C-u>action ReformatCode<CR>
" nnoremap \i :<C-u>action OptimizeImports<CR>
" vnoremap \i :<C-u>action OptimizeImports<CR>
4 years ago
" nnoremap \r :<C-u>action RenameElement<CR>
nnoremap q :<C-u>action ShowIntentionActions<CR>
4 years ago
nnoremap cc :<C-u>action CommentByLineComment<CR>
vnoremap cc :<C-u>action CommentByLineComment<CR>
" show information
nnoremap <C-I> :<C-u>action QuickJavaDoc<CR>
" 在 Tab 间切换 Alt/Option + h/l
nnoremap <space>h gT
nnoremap <space>l gt
4 years ago
" Ctrl+Shift+Tab Ctrl+Tab
nnoremap <c-s-tab> gT
nnoremap <c-tab> gt
" clear the search buffer when hitting return
nnoremap <space><cr> :nohlsearch<cr>
4 years ago
" show information
nnoremap <C-I> :<C-u>action QuickJavaDoc<CR>
4 years ago
" options
nnoremap cow :action EditorToggleUseSoftWraps<cr>
nnoremap col :action EditorToggleShowWhitespaces<cr>
4 years ago
nnoremap ta :action Annotate<cr>
nnoremap tb :action ToggleLineBreakpoint<cr>
nnoremap tm :action ToggleBookmark<cr>
4 years ago
nnoremap tp :action ActivateProjectToolWindow<CR>
4 years ago
" actions
nnoremap <space>q :action CloseContent<cr>
nnoremap <space>w :action CloseContent<cr>
4 years ago
nnoremap <space>Q :action ReopenClosedTab<cr>
nnoremap <space>\ :action VimFilePrevious<cr>
nnoremap <space>e :action SearchEverywhere<cr>
nnoremap <space>E :action Switcher<cr>
nnoremap <space>t :action FileStructurePopup<cr>
nnoremap <space>T :action GotoSymbol<cr>
4 years ago
nnoremap <space>a :action Annotate<cr>
4 years ago
nnoremap <space>b :action ToggleLineBreakpoint<cr>
nnoremap <space>u :action FindUsages<cr>
nnoremap <space>k :action HighlightUsagesInFile<cr>
" Run and debug
4 years ago
nnoremap \r :action RunClass<cr>
nnoremap \R :action Run<cr>
nnoremap \d :action DebugClass<cr>
nnoremap \D :action Debug<cr>
nnoremap \c :action CheckStyleCurrentFileAction<cr>
" unimpaired mappings
nnoremap [<space> O<esc>j
nnoremap ]<space> o<esc>k
nnoremap [q :action PreviousOccurrence<cr>
nnoremap ]q :action NextOccurrence<cr>
4 years ago
nnoremap [m :action MethodUp<cr>
nnoremap ]m :action MethodDown<cr>
nnoremap [c :action VcsShowPrevChangeMarker<cr>
nnoremap ]c :action VcsShowNextChangeMarker<cr>
" built-in navigation to navigated items works better
4 years ago
" nnoremap <c-o> :action Back<cr>
" nnoremap <c-i> :action Forward<cr>
4 years ago
" but preserve ideavim defaults
nnoremap g<c-o> <c-o>
nnoremap g<c-i> <c-i>
" built in search looks better
" nnoremap / :action Find<cr>
" but preserve ideavim search
nnoremap g/ <ESC>:action FindInPath<cr>
noremap ' <ESC>:action Replace<cr>
noremap g' <ESC>:action ReplaceInPath<cr>
nnoremap [[ :action MethodUp<cr>
nnoremap ]] :action MethodDown<cr>
4 years ago
" easy motion"
map , <Plug>(easymotion-prefix)
"Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
"Use upper target labels and type as a lower case
let g:EasyMotion_use_upper = 0
" move to character
nmap f <Plug>(easymotion-s2)
xmap f <Plug>(easymotion-s2)
omap f <Plug>(easymotion-s2)
" move to word
nmap F <Plug>(easymotion-bd-w)
xmap F <Plug>(easymotion-bd-w)
omap F <Plug>(easymotion-bd-w)
" move to line
" nmap gl <Plug>(easymotion-bd-jk)
" xmap gl <Plug>(easymotion-bd-jk)
" omap gl <Plug>(easymotion-bd-jk)
" acejump"
" Press `f` to activate AceJump
nnoremap f :<C-u>action AceAction<CR>
" Press `F` to activate Target Mode
" 在 Target 模式下会跳转到目标,并选中目标整个Word"
nnoremap F :<C-u>action AceTargetAction<CR>
" Press `g` to activate Line Mode
4 years ago
" nnoremap g :action AceLineAction<CR>
" kick intellij commands
" nnoremap R :<C-u>action ChooseRunConfiguration<CR>
nnoremap D :<C-u>action ChooseRunConfiguration<CR>
" nnoremap F5 :<C-u>action StepInto<CR>
" nnoremap F6 :<C-u>action StepOver<CR>
" nnoremap F8 :<C-u>action Resume<CR>
" window
nnoremap s; :<C-u>action CloseActiveTab<CR>
nnoremap so :<C-u>action MoveEditorToOppositeTabGroup<CR>
" multiple cursors
" <A-n>, <A-n>, <A-p>, g<A-n>