-
Notifications
You must be signed in to change notification settings - Fork 30
/
dot_ideavimrc
162 lines (133 loc) · 3.68 KB
/
dot_ideavimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
"==========================================
" Email: hxzhenu@gmail.com
" Author: https://github.com/zhaohongxuan
" Desc: my ideavim config file
"==========================================
" set leader key
nnoremap <SPACE> <Nop>
let mapleader = " "
" search
set hlsearch
set incsearch
set smartcase
set ignorecase
set showmode
set scrolloff=0
" plugins
set ideamarks
set easymotion
set surround
set argtextobj
set multiple-cursors
set textobj-entire
set vim-paragraph-motion
" *ai* *ii* *aI* *iI*
set textobj-indent
set matchit
" Remap multiple-cursors shortcuts for Mac
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
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
set exchange
set highlightedyank
set textobj-entire
set keep-english-in-normal-and-restore-in-insert
set NERDTree
set ReplaceWithRegister
" basic key mapping
nnoremap L $
vnoremap L $
vnoremap H ^
nnoremap H ^
nnoremap ; :
nnoremap ` ,
inoremap jk <esc>
" nerdtree
" override default keymap
let g:NERDTreeMapCloseDir = 'h'
let g:NERDTreeMapActivateNode = 'l'
map <leader>e :action SelectInProjectView<CR>
map <leader>r :NERDTreeFocus<CR>
""" Idea specific settings ------------------
set ideajoin
set idearefactormode=keep
" clear the highlighted search result
" nnoremap <Leader>sc :nohlsearch<CR>
" easymotion
map s <Plug>(easymotion-s)
map <leader>f <Plug>(easymotion-s)
" 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
noremap <leader>wv <C-W>v
nnoremap <leader>w\| <C-W>v
" copy and paste
noremap <Leader>y "*y
noremap <Leader>p "*p
noremap <Leader>P "0p
vnoremap Y "+y
" Tab operation
nnoremap tn gt
nnoremap tp gT
" 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>
" Quit normal mode
nnoremap <Space>q :action CloseProject<CR>
nnoremap <Space>Q :qa!<CR>
" edit vimrc
nnoremap <leader>ve :e ~/.ideavimrc<CR>
nnoremap <leader>vw :w!<CR>
nnoremap <leader>vs :action IdeaVim.ReloadVimRc.reload<CR>
" intellij built in key map
nnoremap <leader>a :action GotoAction<CR>
nnoremap <leader>b :action ShowBookmarks<CR>
nnoremap <leader>c :action GotoClass<CR>
nnoremap <leader>s :action SearchEverywhere<CR>
nnoremap <leader>gc :action Git.CompareWithBranch<CR>
nnoremap <leader>gb :action Git.Branches<CR>
nnoremap <leader>ga :action Annotate<CR>
nnoremap <leader>gh :action Vcs.ShowTabbedFileHistory<CR>
nnoremap <leader>r :action RecentFiles<CR>
" build and compile code
nnoremap <leader>mr :action Maven.Reimport<CR>
"toggle something
"toggle track vim action Id
nnoremap ta :action VimFindActionIdAction<CR>
" run and debug
nnoremap ,d :action Debug<CR>
nnoremap ,r :action Run<CR>
nnoremap ,c :action CompileDirty<CR>
nnoremap ,b :action ToggleLineBreakpoint<CR>
nnoremap ,v :action ViewBreakpoints<CR>
nnoremap ,s :action Stop<CR>
" navigation
nnoremap gs :action GotoSuperMethod<CR>
nnoremap gb :action JumpToLastChange<CR>
nnoremap gi :action GotoImplementation<CR>
nnoremap gd :action GotoDeclaration<CR>
nnoremap gf :action FileStructurePopup<CR>
" code actions
nnoremap U :action FindUsages<CR>
nnoremap R :action RenameElement<CR>
nnoremap == :action ReformatCode<CR>:action OptimizeImports<CR>
vnoremap = :action ReformatCode<CR>
nnoremap -- :action OptimizeImports<CR>
nnoremap cc :action CommentByLineComment<CR>
vnoremap cc :action CommentByLineComment<CR>