-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_ideavimrc
128 lines (102 loc) · 3.9 KB
/
dot_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
" Search settings
set incsearch hlsearch ignorecase smartcase gdefault
set ideajoin " use the IDE's join/J behavior
set selectmode=ideaselection " use select mode only when IDE sets a selection
set notimeout
set clipboard+=unnamedplus " use system clipboard
set clipboard+=ideaput " use idea's pasting logic
set scrolloff=1 " pad scrolling with one line
set showmode " show current mode in statusbar
set showcmd " show partial command in statusbar
set visualbell " removes errorbells
set relativenumber number " show number and relative number
" Stay in the mode in which the editing started
set idearefactormode=keep
set paste
" ys<motion|text object><desired char> surround something
" S<desired char> surround when in visual mode
" ds<existing char> deletes existing surround
" cs<existing char><desired char> changes existing surround with desired
set surround
" https://youtrack.jetbrains.com/issue/VIM-1970
set highlightedyank
set argtextobj
let g:argtextobj_pairs="(:),{:},<:>"
set ideavimsupport+=dialog
set ideaenabledbufs+=singleline
set quickscope
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
let g:qs_primary_color = '#e64553'
let g:qs_secondary_color = '#fe640b'
let g:qs_accepted_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '{', '}', '[', ']', '<', '>']
"" Remap space as leader key
let mapleader = " "
map <Leader>rc :source ~/.ideavimrc<CR>
" Use system clipboard by default for y and p operations
nnoremap yy "+yy
vnoremap y "+y
nnoremap p "+p
vnoremap p "+p
nnoremap P "+P
vnoremap P "+P
" Search for selected text
xnoremap * "zy/<C-R>z<CR>
xnoremap # "zy?<C-R>z<CR>
" Clear highlights
nnoremap <Esc> <Esc>:noh<CR>
" Move text up and down
inoremap <A-j> :action MoveLineDown<CR>
inoremap <A-k> :action MoveLineUp<CR>
map <A-j> :action MoveLineDown<CR>
map <A-k> :action MoveLineUp<CR>
vnoremap <A-j> :action MoveLineDown<CR>
vnoremap <A-k> :action MoveLineUp<CR>
map <C-s> :write<CR>
""" Indent
map < <<
map > >>
vnoremap < <gv
vnoremap > >gv
""" Source Code Navigation
map gi :action GotoImplementation<CR>
""" Tabs
map H :action PreviousTab<CR>
map L :action NextTab<CR>
" nnoremap <leader>b :action RecentFiles<CR>
map q :action CloseContent<CR>
" Workaround for unifying navigation history:
" https://youtrack.jetbrains.com/issue/VIM-44/Unify-navigation-history-between-ideavim-and-idea"
nmap <C-o> <Action>(Back)
nmap <C-i> <Action>(Forward)
map <leader>q <Action>(CloseAllEditorsButActive)
map <leader>x <Action>(HideAllWindows)
map <Leader><Esc> <Action>(ClearAllNotifications)
" Focus project window
set NERDTree
map <leader>e :NERDTreeFocus<CR>
""" Searching
map <c-a> :action GotoAction<CR>
sethandler <C-p> n:vim i-x:ide
map <c-p> :action GotoFile<CR>
" Vim search is simply outclassed here
map / <Action>(Find)
nnoremap ' <ESC>:action Replace<CR>
nnoremap <C-F> :action FindInPath<CR>
vnoremap <C-F> :action FindInPath<CR>
nmap <silent> <leader>1 1gt<CR>
nmap <silent> <leader>2 2gt<CR>
nmap <silent> <leader>3 3gt<CR>
nmap <silent> <leader>4 4gt<CR>
nmap <silent> <leader>5 5gt<CR>
nmap <silent> <leader>6 6gt<CR>
nmap <silent> <leader>7 7gt<CR>
nmap <silent> <leader>8 8gt<CR>
nmap <silent> <leader>9 9gt<CR>
nnoremap <C-.> :action ShowIntentionActions<CR>
nnoremap <C-/> :action CommentByLineComment<CR>
vnoremap <C-/> :action CommentByLineComment<CR>
inoremap <C-/> <Esc>:action CommentByLineComment<CR>
nnoremap <A-/> :action CommentByBlockComment<CR>
vnoremap <A-/> :action CommentByBlockComment<CR>
inoremap <A-/> <Esc>:action CommentByBlockComment<CR>
vnoremap = :action ReformatCode<CR>