-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ideavimrc
210 lines (169 loc) · 6.48 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
200
201
202
203
204
205
206
207
208
209
210
"" .ideavimrc
" Based off of: https://www.cyberwizard.io/posts/the-ultimate-ideavim-setup/
" Enable IdeaVim plugins https://jb.gg/ideavim-plugins
"Map IDE actions to IdeaVim -- https://jb.gg/abva4t
" Base Settings
"" ========================================================
let mapleader = " "
set scrolloff=8
set linenumber
set relativenumber
set showmode
set showcmd
set smartcase
set incsearch
set hlsearch
set ignorecase
set visualbell
set noerrorbells
" Use system clipboard
set clipboard+=unnamed
"" Plugin Settings
"" ========================================================
set surround
set highlightedyank
set nerdtree
" Easymotion settings
set easymotion
set notimeout
" Which-key settings
set which-key
let g:WhichKey_FontSize = 18
let g:WhichKey_CommandColor = "#41ead4"
let g:WhichKey_PrefixColor = "#f335b2"
let g:WhichKey_SortOrder = "by_key_prefix_first"
let g:WhichKeyDesc_leader = "<leader> Leader key"
let g:WhichKeyDesc_easymotion_prefix = "<leader><leader> Easymotion"
"" Key mappings
"" ========================================================
" Clear highlighting
map <esc><esc> :noh<CR><esc>
" Tab navigation
nnoremap H :tabprev<CR>
nnoremap L :tabnext<CR>
" Navigate windows (without the set handlers, it will move the cursor down one line)
sethandler <c-h> a:vim
sethandler <c-l> a:vim
sethandler <c-j> a:vim
sethandler <c-k> a:vim
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
" Move current line / block with alt + j/k ala vscode
inoremap <A-j> <esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
map <A-k> <action>(MoveLineUp)
map <A-j> <action>(MoveLineDown)
" Centering while highlighting
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
" Easy visual indentation
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
" Methods
nnoremap [[ :action MethodUp<CR>
nnoremap ]] :action MethodDown<CR>
" Go to
nmap gd <Action>(GotoDeclaration)
nmap gy <Action>(GotoTypeDeclaration)
nmap gi <Action>(GotoImplementation)
nmap gu <Action>(ShowUsages)
nmap gt <Action>(GotoTest)
nmap gb <Action>(Back)
nmap gf <Action>(Forward)
let g:WhichKeyDesc_g = "g Goto key"
let g:WhichKeyDesc_goto_declaration = "gd Goto declaration"
let g:WhichKeyDesc_goto_typedeclaration = "gy Goto TypeDeclaration"
let g:WhichKeyDesc_goto_implementation = "gi Goto Implementation"
let g:WhichKeyDesc_goto_usages = "gu Show Usages"
let g:WhichKeyDesc_goto_test = "gt Goto Test"
let g:WhichKeyDesc_goto_back = "gb Go Back"
let g:WhichKeyDesc_goto_forward = "gf Go Forward"
" Open NERDTree (use q to exit)
map <leader>e :NERDTreeToggle<CR>
" Jump around with easymotion
map <leader>/ <Plug>(easymotion-s)
" Comment lines
map <leader>c <action>(CommentByLineComment)
" Close active tab
map <leader>q <action>(CloseContent)
let g:WhichKeyDesc_leader = "<leader>e Open file explorer"
let g:WhichKeyDesc_easymotion = "<leader>/ Jump with Easymotion"
let g:WhichKeyDesc_comment = "<leader>c Comment line"
let g:WhichKeyDesc_close_tab = "<leader>q Close active tab"
" UI/Toggles
map <leader>un :set number!<cr>
map <leader>ur :set relativenumber!<CR>
let g:WhichKeyDesc_toggle = "<leader>u Toggle"
let g:WhichKeyDesc_toggle_number = "<leader>un Toggle number"
let g:WhichKeyDesc_toggle_relativenumber = "<leader>ur Toggle relativenumber"
" Folding
map <leader>zc :action CollapseAllRegions<CR>
map <leader>zo :action ExpandAllRegions<CR>
let g:WhichKeyDesc_fold = "<leader>z Folding"
let g:WhichKeyDesc_fold_all = "<leader>zc Fold all regions"
let g:WhichKeyDesc_unfold_all = "<leader>zo Unfold all regions"
Window splits
map <leader>wv <Action>(SplitVertically)
map <leader>ws <Action>(SplitHorizontally)
map <leader>wu <Action>(Unsplit)
map <leader>wm <Action>(MoveEditorToOppositeTabGroup)
let g:WhichKeyDesc_window = "<leader>w Window splits"
let g:WhichKeyDesc_window_split_vertically = "<leader>wv Split vertically"
let g:WhichKeyDesc_window_split_horizontally = "<leader>ws Split horizontally"
let g:WhichKeyDesc_window_split_unsplit = "<leader>wu Unsplit"
let g:WhichKeyDesc_window_split_move_editor = "<leader>wm Move editor to opposite tab group"
" Display options
map <leader>dd <action>(ToggleDistractionFreeMode)
map <leader>dz <action>(ToggleZenMode)
map <leader>df <action>(ToggleFullScreen)
let g:WhichKeyDesc_display = "<leader>d Display options"
let g:WhichKeyDesc_zen_mode = "<leader>dz Toggle Zen mode"
let g:WhichKeyDesc_df_mode = "<leader>dd Toggle Distraction-Free mode"
let g:WhichKeyDesc_fullscreen = "<leader>df Toggle full screen"
" Refactoring
map <leader>rn <Action>(RenameElement)
map <leader>rm <Action>(ExtractMethod)
map <leader>rv <Action>(IntroduceVariable)
map <leader>rf <Action>(IntroduceField)
map <leader>rs <Action>(ChangeSignature)
map <leader>rr <Action>(Refactorings.QuickListPopupAction)
let g:WhichKeyDesc_refactoring = "<leader>r Refactoring menu"
let g:WhichKeyDesc_refactoring_rename = "<leader>rn Rename element"
let g:WhichKeyDesc_refactoring_method = "<leader>rm Extract method"
let g:WhichKeyDesc_refactoring_variable = "<leader>rv Introduce variable"
let g:WhichKeyDesc_refactoring_field = "<leader>rf Introduce field"
let g:WhichKeyDesc_refactoring_signature = "<leader>rs Change signature"
let g:WhichKeyDesc_refactoring_all = "<leader>rr Open refactorings list"
" Search
map <leader>sa <action>(GotoAction)
map <leader>sc <action>(GotoClass)
map <leader>sf <action>(GotoFile)
map <leader>sl <action>(RecentLocations)
map <leader>sr <action>(RecentFiles)
map <leader>ss <action>(GotoSymbol)
map <leader>st <Action>(FindInPath)
map <leader>su <Action>(FindUsages)
let g:WhichKeyDesc_search_nav = "<leader>s Search"
let g:WhichKeyDesc_search_nav_actions = "<leader>sa Search actions"
let g:WhichKeyDesc_search_nav_classes = "<leader>sc Search classes"
let g:WhichKeyDesc_search_nav_files = "<leader>sf Search files"
let g:WhichKeyDesc_search_nav_recent_file = "<leader>sr Search recent files"
let g:WhichKeyDesc_search_nav_recent_locations = "<leader>sl Search recent locations"
let g:WhichKeyDesc_search_nav_symbols = "<leader>ss Search symbols"
let g:WhichKeyDesc_search_nav_usages = "<leader>su Search Usages"
let g:WhichKeyDesc_search_nav_text = "<leader>st Search text"
" Git windows
map <leader>gc <Action>(CheckinProject)
map <leader>gs <Action>(ActivateVersionControlToolWindow)
map <leader>gb <Action>(Git.Branches)
let g:WhichKeyDesc_git = "<leader>g Git operations"
let g:WhichKeyDesc_git_commit = "<leader>gc Git commit dialog"
let g:WhichKeyDesc_git_status = "<leader>gs Git status dialog"
let g:WhichKeyDesc_git_branches = "<leader>gb Git branches list"