This repository has been archived by the owner on Oct 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.ideavimrc
154 lines (124 loc) · 4.12 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
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set whichwrap=b,s,[,],<,>,h,l " allow cursor to wrap between lines
set mouse=nvi
" ============================================================================
" Movement
" ============================================================================
" navigation
nnoremap n h|xnoremap n h|onoremap n h|
nnoremap u k|xnoremap u k|onoremap u k|
nnoremap e j|xnoremap e j|onoremap e j|
nnoremap i l|xnoremap i l|onoremap i l|
inoremap <M-n> <Left>|cnoremap <M-n> <Left>|
inoremap <M-u> <Up>|cnoremap <M-u> <Up>|
inoremap <M-e> <Down>|cnoremap <M-e> <Down>|
inoremap <M-i> <Right>|cnoremap <M-i> <Right>|
" Delete/Backspace
nnoremap <C-d> "_dw|vnoremap <C-d> "_d|inoremap <C-d> <Delete>|cnoremap <C-d> <Delete>|
nnoremap <Delete> "_x|vnoremap <Delete> "_d|
nnoremap <Backspace> a<Left><Backspace><Right><Esc>|vnoremap <Backspace> "_d|
nnoremap <C-Backspace> a<Left><C-W><Right><Esc>|inoremap <C-Backspace> <C-w>|cnoremap <C-Backspace> <C-w>|
nnoremap <C-Delete> "_dw|inoremap <C-Delete> <C-o>"_dw|cnoremap <C-Delete> <Delete>|
nnoremap <S-Backspace> "_d^|inoremap <S-Backspace> <Backspace>|cnoremap <S-Backspace> <Backspace>|
nnoremap <S-Delete> "_d$|inoremap <S-Delete> <Delete>|cnoremap <S-Delete> <Delete>|
" Page up/down
nnoremap j :action EditorPageUp<CR>
nnoremap h :action EditorPageDown<CR>
nnoremap J :action EditorTextStart<CR>
nnoremap H :action EditorTextEnd<CR>
" Previous / next word
nnoremap l b
nnoremap y w
nnoremap <C-l> B
nnoremap <C-y> W
" Home/end of line
" 0 unchanged
nnoremap L ^|xnoremap L ^|onoremap L ^|
nnoremap Y $|xnoremap Y $|onoremap Y $|
inoremap <M-L> <Home>|cnoremap <M-L> <Home>|
inoremap <M-Y> <End>|cnoremap <M-Y> <End>|
" Map ; to :
nnoremap ; :|xnoremap ; :|
" ============================================================================
" Editing
" ============================================================================
" undo/redo
nnoremap z u
nnoremap gz U
nnoremap Z <C-r>
" insert/replace
nnoremap s i
nnoremap S I
nnoremap t a
nnoremap T A
" change
nnoremap w c
nnoremap W C
" visual
nnoremap a v
nnoremap A V
" enter, open line
nnoremap <CR> i<CR><Esc>
nnoremap <S-CR> <CR>
nnoremap <S-CR> O<Esc>
nnoremap <C-CR> o<Esc>
" copy/paste
nnoremap x x
nnoremap c y
nnoremap v gP
nnoremap X dd
nnoremap C yy
nnoremap V p
" Moving blocks of text in visual mode
vnoremap < <gv
vnoremap > >gv
" Select all text
map <Space>a ggVG
" Indent everything
noremap <Space>I ggvG=
" Indent selection in visual mode
vnoremap <Space>i =
" Indent the current line
noremap <Space>i v=
" Join lines
" nnoremap jj J
" Cut/copy/paste
nnoremap x x|xnoremap x d|
nnoremap c y|xnoremap c y|
nnoremap v gP|xnoremap v gP|
nnoremap X dd|xnoremap X d|
nnoremap C yy|xnoremap C y|
nnoremap V p|xnoremap V p|
" ============================================================================
" Editor control
" ============================================================================
" Enter the command-line mode
noremap ; :
" Reload .ideavimrc
nnoremap <Space>vs :source ~/.ideavimrc<CR>
" ============================================================================
" IDE actions
" ============================================================================
nnoremap <Space> <Nop>
nnoremap / :action Find<CR>
nnoremap <Space>c :action GotoClass<CR>
nnoremap <Space>o :action GotoFile<CR>
nnoremap <Space>s :action CloseContent<CR>
nnoremap <Space>v :action SplitVertically<CR>
nnoremap <Space>b :action SplitHorizontally<CR>
nnoremap <Space>r :action RecentFiles<CR>
nnoremap <Space>k :action FileStructurePopup<CR>
nnoremap <Space>h :action QuickJavaDoc<CR>
nnoremap <Space>Tab :action PreviousWindow<CR>
nnoremap <Space>e :action VimWindowDown<CR>
nnoremap <Space>i :action VimWindowRight<CR>
nnoremap <Space>n :action VimWindowLeft<CR>
nnoremap <Space>u :action VimWindowUp<CR>
nnoremap <Space>y :action NextTab<CR>
nnoremap <Space>l :action PreviousTab<CR>
nnoremap <Space>Y :action NextSplitter<CR>
nnoremap <Space>L :action PrevSplitter<CR>
nnoremap <S-Space>t :action ReopenClosedTab<CR>