-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ideavimrc
executable file
·200 lines (187 loc) · 6.88 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
" -------------------------
" | Yaragos IDEA VIM 配置 |
" -------------------------
"_____________________________________________________________
" 设置 -> 快捷键 -> 插件 -> IdeaVim -> vim -> 添加键盘快捷键 -> Alt+逗号
"-- 查看所有的action --" :actionlist
"-- 调用action --" :action {ACTION_NAME}<CR>
"Find more examples here: https://jb.gg/share-ideavimrc
"=============================================================
" 基础键位说明
"=============================================================
" M->cmd, A->option, C->control
" <ESC> - escape, <BS> - backspace
" 设置leader 键位
let mapleader = "\<space>"
"=============================================================
" base setting
"=============================================================
" 垂直滚动时保留5行
set scrolloff=5
" 水平滚动时保留5字符
set sidescrolloff=5
"设置行号
set number relativenumber
"禁用错误提示音
set visualbell
set noerrorbells
noremap <SPACE> <Nop>
inoremap jk <Esc>
noremap <C-[> <Esc>
"noremap < 10zh
"noremap > 10zl
noremap H ^
noremap L $
nnoremap <SPACE> <Nop>
" Map vim marks to IDEA global marks
set ideamarks
" 当“on”时,一些命令将光标移动到该行的第一个非空白处。 关闭时,光标将保留在同一列中(如果可能)
set startofline=on
" Smart join for J | 按下大写 J 时,会使用行连接功能(IDE 的功能),比如去除下方空行或连接当前行时可使用
set ideajoin
set history=200
set keep-english-in-normal-and-restore-in-insert
"=============================================================
""Plugins settings
"=============================================================
set highlightedyank
let g:highlightedyank_highlight_duration = "300"
let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"
set argtextobj
set surround
set easymotion
set NERDTree
nnoremap <C-e> :NERDTreeFocus<CR>
nnoremap <leader>e :NERDTreeToggle<CR>
set multiple-cursors
" - start: `<C-n>` start multicursor and add a virtual cursor + visual selection on the match
" + next: `<C-n>` add a new virtual cursor + visual selection on the next match
" + skip: `<C-x>` skip the next match
" + prev: `<C-p>` remove current virtual cursor + visual selection and go back on previous match
" - select all: `<A-n>` start muticursor and directly select all matches
"=============================================================
""Search | Replace
"=============================================================
set incsearch " Highlight while searching with / or ?.
set hlsearch " Keep matches highlighted.
set ignorecase smartcase " 搜索时忽略大小写,智能匹配
set wrapscan " Searches wrap around end-of-file.
nnoremap <Esc> :nohlsearch<CR> " 清除高亮
nnoremap ; :nohlsearch<CR> " 清除高亮
"visual 模式 下 按* 号 搜索 光标选中的内容(对已选中的内容进行查找)
vnoremap * "ry/<C-R>r<CR>
nnoremap <leader>/ :action Find<CR>
nnoremap <leader>? :action Replace<CR>
"=============================================================
""copy and paste
"=============================================================
set clipboard+=unnamed
set clipboard+=ideaput
"vnoremap p pgvy
vnoremap p :action $Paste<CR>
"noremap <C-c> :action $Copy<CR>
"inoremap <C-v> <ESC>:action $Paste<CR>i
noremap <leader>p "0p
noremap <leader>P "0P
"=============================================================
""window navigation
"=============================================================
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-h> <C-w>h
noremap <C-l> <C-w>l
noremap <leader>x :close<CR>
noremap \| :action SplitVertically<CR>
noremap \\ :action SplitHorizontally<CR>
noremap <c--> :action UnsplitAll<CR>
noremap <c-=> :action MaximizeEditorInSplit<CR>
noremap <c-x> :action HideAllWindows<CR>
"=============================================================
"UI
"=============================================================
nnoremap <Leader>zz :action ToggleZenMode<CR>
"list window opt
nnoremap <Leader>lw :action ActiveToolwindowGroup<CR>
" terminal
nnoremap <leader>t :action ActivateTerminalToolWindow<CR>
"=============================================================
"Menu | Show | List
"=============================================================
" 重构
noremap <leader>rl :action Refactorings.QuickListPopupAction<CR>
noremap <leader>rn :action Rename<CR>
" 展示用法
nmap <leader>fu :action FindUsages<CR>
nmap <leader>su :action ShowUsages<CR>
" VSC
nmap <leader>lv :action Vcs.QuickListPopupAction<CR>
" list
nnoremap <leader>lb :action BuildMenu<CR>
nnoremap <leader>lc :action CodeMenu<CR>
nnoremap <leader>lf :action FindMenuGroup<CR>
nnoremap <leader>ls :action ScopeViewPopupMenu<CR>
nnoremap <leader>la :action GotoAction<CR>
"=============================================================
"Jump | Goto | Find
"=============================================================
" 标签页跳转
nnoremap [t :action PreviousTab<CR>
nnoremap ]t :action NextTab<CR>
nnoremap <Tab> :action PreviousTab<CR>
nnoremap <S-Tab> :action NextTab<CR>
" 错误跳转
nnoremap [e :action GotoPreviousError<CR>
nnoremap ]e :action GotoNextError<CR>
nnoremap [u :action GotoPrevElementUnderCaretUsage<CR>
nnoremap ]u :action GotoNextElementUnderCaretUsage<CR>
nnoremap [o :action PreviousOccurence<CR>
nnoremap ]o :action NextOccurence<CR>
" 函数/方法的上下跳转
nnoremap [[ :action MethodUp<CR>
nnoremap ]] :action MethodDown<CR>
" 修改的跳转
nnoremap [c :action JumpToLastChange<CR>
nnoremap ]c :action JumpToNextChange<CR>
nnoremap gT :action TextSearchAction<CR>
nnoremap go :action GotoSuperMethod<CR>
nnoremap gd :action GotoDeclaration<CR>
nnoremap gD :action GotoTypeDeclaration<CR>
" goto impl | 查看方法实现(好用)
nnoremap gi :action QuickImplementations<CR>
nnoremap gI :action GotoImplementation<CR>
nnoremap <leader>ff :action GotoFile<CR>
nnoremap <leader>fp :action FindInPath<CR>
"=============================================================
"Edit settings
"=============================================================
nnoremap zj o<ESC>
nnoremap zk O<ESC>
noremap <C-j> :action MoveLineDown<CR>
noremap <C-k> :action MoveLineUp<CR>
"=============================================================
" 默认键位配置
"=============================================================
" IDE
sethandler <C-A> a:ide
sethandler <C-B> a:ide
sethandler <C-C> a:ide
sethandler <C-D> a:ide
sethandler <C-E> a:ide
sethandler <C-F> a:ide
sethandler <C-M> a:ide
sethandler <C-N> a:ide
sethandler <C-P> a:ide
sethandler <C-Q> a:ide
sethandler <C-S> a:ide
sethandler <C-U> a:ide
sethandler <C-V> n-v:vim i:ide
" VIM
sethandler <C-J> a:vim
sethandler <C-K> a:vim
sethandler <C-L> a:vim
sethandler <C-R> a:vim
sethandler <C-I> a:vim
sethandler <C-T> a:vim
sethandler <C-W> a:vim
sethandler <C-O> a:vim
"=============================================================