-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ideavimrc
95 lines (73 loc) · 2.17 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
" set ideajoin
" use jk instead of esc
inoremap <silent> jk <ESC>
tnoremap <silent> jk <C-\><C-n>
" Always keep the cursor in the middle of the window when typing "n" and "N"
nmap <silent> n nzzzv
nmap <silent> N Nzzzv
" better up/down
nnoremap <silent><expr> j v:count == 0 ? 'gj' : 'j'
xnoremap <silent><expr> j v:count == 0 ? 'gj' : 'j'
nnoremap <silent><expr> k v:count == 0 ? 'gk' : 'k'
xnoremap <silent><expr> k v:count == 0 ? 'gk' : 'k'
" Delete to void register and paste
xnoremap <silent> <leader>p \"_dP
" Yank to sys clipboard
nnoremap <silent> <leader>y "+y
vnoremap <silent> <leader>y "+y
nnoremap <silent> <leader>Y "+Y
" Delete to void register
nnoremap <silent> <leader>d "_d
vnoremap <silent> <leader>d "_d
" Find and Replace
nnoremap <A-s> :%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>
" Move to window using the <ctrl> hjkl keys
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" Resize window using <ctrl> arrow keys
nnoremap <C-Up> :resize +2<cr>
nnoremap <C-Down> :resize -2<cr>
nnoremap <C-Left> :vertical resize -2<cr>
nnoremap <C-Right> :vertical resize +2<cr>
" Move Lines
nnoremap <A-j> :m .+1<cr>==
nnoremap <A-k> :m .-2<cr>==
"inoremap <A-j> <esc><cmd>m .+1<cr>==gi
"inoremap <A-k> <esc><cmd>m .-2<cr>==gi
"vnoremap <A-j> :m '>+1<cr>gv=gv
"vnoremap <A-k> :m '<-2<cr>gv=gv
" Switch to Other Buffer
nnoremap <leader>bb :e #<cr>
nnoremap <leader>` :e #<cr>
" Clear search with <esc>
"imap <esc> :noh<cr><esc>
"nmap <esc> :noh<cr><esc>
" https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
nnoremap <expr> n 'Nn'[v:searchforward]
xnoremap <expr> n 'Nn'[v:searchforward]
onoremap <expr> n 'Nn'[v:searchforward]
nnoremap <expr> N 'nN'[v:searchforward]
xnoremap <expr> N 'nN'[v:searchforward]
onoremap <expr> N 'nN'[v:searchforward]
" Add undo break-points
"inoremap , ,<c-g>u
"inoremap . .<c-g>u
"inoremap ; ;<c-g>u
" save files
" inoremap <C-s> <C-o> :w<cr>
" xnoremap <C-s> :w<cr>
" nnoremap <C-s> :w<cr>
" snoremap <C-s> :w<cr>
" keywordprg
nnoremap <leader>K :norm! K<cr>
" better indenting
vnoremap < <gv
vnoremap > >gv
" new file
nnoremap <leader>fn :enew<cr>
" quit
nnoremap <leader>qq :qa<cr>
set clipboard^=ideaput
set ideajoin