-
Notifications
You must be signed in to change notification settings - Fork 1
/
_ideavimrc
43 lines (32 loc) · 1.45 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
"Remove all highlighting
nnoremap & :nohls<CR>
"Shows all occurences of the underlying word
nnoremap * :set hls<CR>:exec "let @/='\\<".expand("<cword>")."\\>'"<CR>
"To add a blank line below or above and keep the cursor in place
nmap <S-Enter> m`O<Esc>``
nmap <C-Enter> m`o<Esc>``
"Insert new line in insert mode without breaking current line
imap <S-Enter> <Esc><S-Enter>li
imap <C-Enter> <Esc><C-Enter>li
"If you still want to retain the visual selection after having pressed > or <,
"you can use these mappings \
vnoremap > >gv
vnoremap < <gv
" ========== Line numbers ======================================
set nu
set rnu
" Replace withjeffkreeftmeijer/vim-numbertoggle plugin
nnoremap <C-n> :call NumberToggle()<cr>
"A quick solution is to automatically switch to absolute line numbers
"whenever Vim loses focus, since we don’t really care about the relative
"line numbers unless we’re moving around.
:au FocusLost * :set number
:au FocusGained * :set relativenumber
"Tell Vim to automatically use absolute line numbers when we’re in insert mode
"and relative numbers when we’re in normal modeautocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" ========== MOVE, SEARCH & PATTERNS ===========================
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set hlsearch " highlight search terms
set incsearch " show search matches as you type