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.

169 lines
4.7 KiB

4 years ago
" enable plugin
4 years ago
set easymotion
set surround
set clipboard=unnamed,autoselect
4 years ago
let mapleader = ","
let g:mapleader = ","
set hlsearch
set incsearch
set scrolloff=5
4 years ago
set ignorecase
set smartcase
set showmode
set history=10000
4 years ago
" source ~/.vimrc
" general
nnoremap <Leader>e :<C-u>action SearchEverywhere<CR>
vnoremap <Leader>e :<C-u>action SearchEverywhere<CR>
nnoremap <Leader>s :<C-u>action FileStructurePopup<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>
" Vertical split screen
nnoremap <Leader>wv <C-W>v
vnoremap <Leader>wv <C-W>v
nnoremap <Leader>ws <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
" vnoremap ,r :<C-u>action RecentFiles<CR>
4 years ago
" Redo
nnoremap U <C-r>
" go to 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>
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>
" cmd + [ and cmd + ]
" nnoremap gh :<C-u>action Back<CR>
" nnoremap gl :<C-u>action Forward<CR>
4 years ago
" code editing
nnoremap <Leader>f :<C-u>action ReformatCode<CR>
4 years ago
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>
" easy window navigation
" nnoremap <c-l> <c-w>l
" nnoremap <c-j> <c-w>j
" nnoremap <c-h> <c-w>h
" nnoremap <c-k> <c-w>k
" 在 Tab 间切换 Alt + h/l
nnoremap <a-h> gT
nnoremap <a-l> gt
" 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>
" 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 tp :action ActivateProjectToolWindow<CR>
4 years ago
" actions
nnoremap <space>q :action CloseContent<cr>
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>
" code navigation
nnoremap <space>] :action GotoImplementation<cr>
nnoremap <space>[ :action GotoSuperMethod<cr>
nnoremap <space>u :action FindUsages<cr>
nnoremap <space>gt :action GotoTest<cr>
nnoremap <space>k :action HighlightUsagesInFile<cr>
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>
" code refactoring
4 years ago
" nnoremap <space>rr :action RenameElement<cr>
4 years ago
" unimpaired mappings
nnoremap [<space> O<esc>j
nnoremap ]<space> o<esc>k
nnoremap [q :action PreviousOccurence<cr>
nnoremap ]q :action NextOccurence<cr>
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/ /
" 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>