-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.ideavimrc
134 lines (97 loc) · 3.53 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
" search for actions: :actionlist <patter>
set number " line numbers
set hlsearch " highlight search occurrences
set ignorecase " ignore case in search patterns
set smartcase " no ignore case when pattern is uppercase
set incsearch " show search results while typing
set wrapscan " searches wrap around the end of the file
set gdefault " substitute all occurrences in line per default
set history=10000 " keep x lines of command line history
set scrolloff=5 sidescrolloff=10 " keep some lines before and after the cursor visible
set clipboard=unnamedplus,unnamed,ideaput " integrate with system clipboard
" https://github.com/JetBrains/ideavim/wiki/%22set%22-commands
set multiple-cursors
set commentary
set surround " emulate vim-surround plugin
set ideajoin
set ideastatusicon=disabled
" set <leader> to <space>
let mapleader = " "
" edit ideavim config
nnoremap <leader>vv :e ~/.ideavimrc<CR>
nnoremap <leader>vr :source ~/.ideavimrc<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NEO-Layout
" simple closing and saving
nnoremap ö :action SaveAll<CR>
nnoremap <leader>ö :action SaveAll<CR>
nnoremap ä :action Exit<CR>
nnoremap ü :q<CR>
nnoremap <leader>ü :action CloseAllEditorsButActive<CR>
" replay q/f macro
" ß is on the right side next to q
" Q was ex mode
nnoremap ß @q
vnoremap ß @q
nnoremap Q @f
vnoremap Q @f
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fix some vim annoyances
" make Y behave like D and C, yanking till end of line
map Y y$
" don't overwrite register when pasting over selection
" vnoremap p pgvy
" paste over rest of line
" nnoremap <leader>p v$<Left>pgvy
nnoremap <leader>p v$<Left>p
" don't lose selection when indenting
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
" TODO: smart home
nmap <Home> ^
imap <silent> <Home> <C-O>^
""""""""""""""""""""""""""""""""""""""""""""""""""""
" Custom bindings
" clear search highlighting
nnoremap <leader>/ :nohls<return><esc>
" " TODO: toggle chars at end of line
nnoremap <leader>, mZA,<Esc>`Z
nnoremap <leader>; mZA;<Esc>`Z
" " highlight current word
nnoremap h mZ*`Z
""""""""""""""""""""""""""""""""""""""""""""""""""""
" IDEA specific
nmap <leader>? :action GotoAction<CR>
" change font size
nmap + :action EditorIncreaseFontSize<CR>
nmap - :action EditorDecreaseFontSize<CR>
nmap <leader>= :action EditorResetFontSize<CR>
" code navigation
" https://youtrack.jetbrains.com/issue/VIM-44
nnoremap <c-o> :action Back<cr>
nnoremap <c-i> :action Forward<cr>
nmap <leader>e :action GotoFile<CR>
nmap <leader>a :action FindInPath<CR>
nmap gr :action ShowUsages<CR>
nmap gi :action GotoImplementation<CR>
nmap gs :action GotoSuperMethod<CR>
nmap l :action NextTab<CR>
nmap L :action PreviousTab<CR>
nmap <C-p> :action ParameterInfo<CR>
imap <C-p> <C-o>:action ParameterInfo<CR>
nmap <leader>n :action GotoNextError<CR>
map gh <Action>(ShowErrorDescription)
nmap <leader>ri :action Inline<CR>
nmap <leader>rr :action RenameElement<CR>
nmap <leader>rev :action IntroduceVariable<CR>
vmap <leader>rev :action IntroduceVariable<CR>
nmap <leader>rem :action ExtractMethod<CR>
vmap <leader>rem :action ExtractMethod<CR>
nmap <leader>rm :action Move<CR>
nmap <leader>ro :action OptimizeImports<CR>
nmap <leader>rG :action Generate<CR>
nmap <leader>f :action ReformatCode<CR>
nmap <, :action MoveElementLeft<CR>
nmap >, :action MoveElementRight<CR>
nmap <leader>gr :action Vcs.RollbackChangedLines<CR>