-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
148 lines (123 loc) · 3.09 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
scriptencoding utf-8
" vim
let g:mapleader=' '
let g:maplocalleader='-'
nnoremap ; :
""" Plugins --------------------------------
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
""" Plugin settings -------------------------
let g:argtextobj_pairs="[:],(:),<:>"
""" Idea specific settings ------------------
set ideajoin
set ideastatusicon=gray
set idearefactormode=keep
" Keep search pattern at the center of the screen.
nnoremap <silent> n nzz
nnoremap <silent> N Nzz
nnoremap <silent> * *zz
nnoremap <silent> # #zz
nnoremap <silent> g* g*zz
nnoremap <silent> g; g;zz
nnoremap <silent> g, g,zz
" 去掉上次搜索高亮
nnoremap <silent><leader>/ :nohls<cr>
" files
nnoremap <leader>qa :qa<cr>
nnoremap <leader>w :w<cr>
nnoremap <leader>wq :wq<cr>
nnoremap <leader>v :e ~/.vimrc<cr>
nnoremap <leader>cd :cd %:p:h<cr>
cmap w!! w !sudo tee >/dev/null %
"nnoremap <leader>h <c-w>h
"nnoremap <leader>l <c-w>l
"nnoremap <leader>k <c-w>k
"nnoremap <leader>j <c-w>j
nnoremap <leader>n :bn<cr>
nnoremap <leader>p :bp<cr>
" jump
noremap <c-j> 15gj
noremap <c-k> 15gk
" CTRL+A moves to start of line in command mode
cnoremap <C-a> <home>
" CTRL+E moves to end of line in command mode
cnoremap <C-e> <end>
" move current line down
noremap <silent>- :m+<CR>
" move current line up
noremap <silent><c-_> :m-2<CR>
" move visual selection down
vnoremap <silent>- :m '>+1<CR>gv=gv
" move visual selection up
vnoremap <silent><c-_> :m '<-2<CR>gv=gv
" replace word under cursor
nnoremap <leader>; :%s/\<<C-r><C-w>\>//<Left>
" switch between last two files
nnoremap <leader><Tab> <c-^>
" Correct spell
cab Qa qa
cab W w
cab Wq wq
cab Wa wa
cab X x
" No surround sound
set noerrorbells
set novisualbell
set t_vb=
" For indent
set wrap
set autoindent
set copyindent
set smartindent
set smarttab
set shiftround
vnoremap < <gv
vnoremap > >gv
" Format
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Encoding setting
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
" Search and Case
set gdefault " this makes search/replace global by default
set ignorecase
set smartcase
set hlsearch
set incsearch
set fileignorecase
set showcmd
" Fold
"nnoremap zc @=((foldclosed(line('.')) < 0) ? 'zc' :'zo')<CR>
"nnoremap zo @=((foldclosed(line('.')) < 0) ? 'zc' :'zo')<CR>
nnoremap zr zR
" Other
set backspace=indent,eol,start
set virtualedit=block
set wildmenu
set showmatch
set matchtime=2
set title
set autoread
set clipboard=unnamedplus,unnamed
map <leader>j :action GotoNextError<CR>
map <leader>k :action GotoPreviousError<CR>
map ]g :action GotoNextError<CR>
map [g :action GotoPreviousError<CR>
map <leader>rn :action RenameElement<CR>
map gd :action GotoDeclaration<CR>
map gi :action GotoDeclaration<CR>
map gr :action FindUsages<CR>
map <leader><leader>b <Plug>(easymotion-b)
map <leader><leader>e <Plug>(easymotion-e)
map <leader><leader>n <Plug>(easymotion-n)
map <leader><leader>s <Plug>(easymotion-s)
map <leader><leader>f <Plug>(easymotion-f)
map <leader><leader>w <Plug>(easymotion-w)
map <leader><leader>W <Plug>(easymotion-W)