-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ideavimrc
200 lines (177 loc) · 5.4 KB
/
.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
source ~/.vimrc
" nice reads:
" - https://danidiaz.medium.com/configuring-ideavimrc-de16a4da0715
" - https://towardsdatascience.com/the-essential-ideavim-remaps-291d4cd3971b
""""""""""""""""
""" General: """
""""""""""""""""
let mapleader = " "
""""""""""""""""
""" Plugins: """
""""""""""""""""
" see https://github.com/JetBrains/ideavim/wiki/Emulated-plugins
" ys, cs, ds, S
set surround
" gcc, gc + motion, v_gc
set commentary
set highlightedyank
"""""""""""""""""""""""""""""""""""""""""
""" Things that don't work from vimrc """
"""""""""""""""""""""""""""""""""""""""""
" alternative to xnoremap <silent> p p:let @+=@0<CR>:let @"=@0<CR>
xnoremap p "_dP
" Imitating Harpoon
" Setting - only for lines. To use it with files we have to call
" :NERDTreeFind<cr> and then <A-0>...<A-9> - these have to be set in Idea
" nnoremap m1 :action SetFileBookmark1<cr>
" nnoremap m2 :action SetFileBookmark2<cr>
" nnoremap m3 :action SetFileBookmark3<cr>
" nnoremap m4 :action SetFileBookmark4<cr>
" nnoremap m5 :action SetFileBookmark5<cr>
" nnoremap m6 :action SetFileBookmark6<cr>
" nnoremap m7 :action SetFileBookmark7<cr>
" nnoremap m8 :action SetFileBookmark8<cr>
" nnoremap m9 :action SetFileBookmark9<cr>
" nnoremap m0 :action SetFileBookmark0<cr>
" Jumping - should work
nnoremap '1 :action GotoBookmark1<cr>
nnoremap '2 :action GotoBookmark2<cr>
nnoremap '3 :action GotoBookmark3<cr>
nnoremap '4 :action GotoBookmark4<cr>
nnoremap '5 :action GotoBookmark5<cr>
nnoremap '6 :action GotoBookmark6<cr>
nnoremap '7 :action GotoBookmark7<cr>
nnoremap '8 :action GotoBookmark8<cr>
nnoremap '9 :action GotoBookmark9<cr>
nnoremap '0 :action GotoBookmark0<cr>
" Vim Wordmotion, move over camelCases, under_scores, etc.
nnoremap <Leader>w [w
nnoremap d<Leader>w d[w
nnoremap c<Leader>w c[w
nnoremap y<Leader>w y[w
nnoremap v<Leader>w v[w
nnoremap <Leader>e ]w
nnoremap d<Leader>e d]w
nnoremap c<Leader>e c]w
nnoremap y<Leader>e y]w
nnoremap v<Leader>e v]w
nnoremap <Leader>b [b
nnoremap d<Leader>b d[b
nnoremap c<Leader>b c]b
nnoremap y<Leader>b y]b
nnoremap v<Leader>b v]b
nnoremap <Leader>ge ]b
nnoremap d<Leader>ge d]b
nnoremap c<Leader>ge c]b
nnoremap y<Leader>ge y]b
nnoremap v<Leader>ge v]b
" These do not work correctly :(
" nnoremap vi<Leader>w vi[w
" nnoremap yi<Leader>w yi[w
" nnoremap di<Leader>w di[w
" nnoremap ci<Leader>w di[w
""""""""""""""""""""
""" IDEA setings """
""""""""""""""""""""
" marks as bookmarks
set ideamarks
" some line join magic
set ideajoin
" disable bells
set noerrorbells
" NerdTree
set NERDTree
" enable vim as handler for the following
sethandler <C-/> a:vim
sethandler <C-a> a:vim
sethandler <C-b> a:vim
sethandler <C-c> a:vim
sethandler <C-d> a:vim
sethandler <C-e> a:vim
sethandler <C-f> a:vim
sethandler <C-g> a:vim
sethandler <C-h> a:vim
sethandler <C-j> a:vim
sethandler <C-k> a:vim
sethandler <C-l> a:vim
sethandler <C-m> a:vim
sethandler <C-n> a:vim
sethandler <C-o> a:vim
sethandler <C-p> a:vim
sethandler <C-q> a:vim
sethandler <C-r> a:vim
sethandler <C-s> a:vim
sethandler <C-t> a:vim
sethandler <C-u> a:vim
sethandler <C-v> a:vim
sethandler <C-w> a:vim
sethandler <C-x> a:vim
sethandler <C-y> a:vim
sethandler <C-z> a:vim
" Idea specific
map <C-z> <Action>(ToggleDistractionFreeMode)
" SourceCodeEditing
nnoremap <Leader>= :action ReformatCode<cr>
nnoremap <Leader>o :action OptimizeImports<cr>
nnoremap K :action QuickJavaDoc<cr>
"" Goto Stuff ""
" Data type related
" nnoremap <Leader>h :action CallHierarchy<cr>
nnoremap gb :action ShowNavBar<cr>
nnoremap gd :action GotoDeclaration<cr>
nnoremap gi :action GotoImplementation<cr>
nnoremap gp :action GotoSuperMethod<cr>
nnoremap gr :action FindUsages<cr>
nnoremap gs :action GotoSymbol<cr>
nnoremap gpt :action GotoTest<cr>
nnoremap gh :action TypeHierarchy<cr>
nnoremap gm :action FileStructurePopup<cr>
"" Show stuff
" Navigation
map <C-o> <Action>(Back)
map <C-i> <Action>(Forward)
nnoremap ]d :action GotoNextError<cr>
nnoremap [d :action GotoPreviousError<cr>
nnoremap ]q :action NextOccurence<cr>
nnoremap [q :action PreviousOccurence<cr>
nnoremap <Leader>fw :action FindInPath<cr>
nnoremap <Leader>ff :action GotoFile<cr>
nnoremap <Leader>fc :action GotoClass<cr>
nnoremap <Leader>fo :action RecentFiles<cr>
" opens current file in NerdTree
nnoremap - :NERDTreeFind<cr>
nnoremap <C-n> :NERDTreeToggle<cr>
" windows
nnoremap <Leader>/ :vsp<CR>
nnoremap <Leader>- :sp<CR>
nnoremap <C-Left> <C-w>h
nnoremap <C-Right> <C-w>l
nnoremap <C-Up> <C-w>k
nnoremap <C-Down> <C-w>j
nnoremap ZZ :action CloseAllEditors<cr>
nnoremap ZQ :action CloseAllEditors<cr>
" Runing stuff
nnoremap <Leader>rr :action Run<cr>
nnoremap <Leader>rn :action ContextRun<cr>
nnoremap <Leader>rf :action RunClass<cr>
map <C-p> <Action>(RebuildProject)
map <Leader>R <Action>(Stop)
" TODO?
" nnoremap <Leader>rt :action ActivateRunToolWindow<cr>
" nnoremap ,l :action ChooseRunConfiguration<cr>
" nnoremap <Leader>rd :action Debug<cr>
" nnoremap <Leader>D :action ContextDebug<cr>
" nnoremap <Leader>C :action DebugClass<cr>
" nnoremap <Leader>f :action RerunFailedTests<cr>
" Debugging
nnoremap <Leader>rb :action ToggleLineBreakpoint<cr>
nnoremap <Leader>rB :action EditBreakpoint<cr>
" Git Integration
nnoremap <Leader>gb :action Annotate<cr>
nnoremap <Leader>gr :action Vcs.RollbackChangedLines<cr>
nnoremap ]g :action VcsShowNextChangeMarker<cr>
nnoremap [g :action VcsShowPrevChangeMarker<cr>
" Code Actions
nnoremap crr :action ShowIntentionActions<cr>
nnoremap crf :action ReformatCode<cr>
nnoremap crn :action RenameElement<cr>