-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
120 lines (88 loc) · 3.72 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
" IdeaVIM Commands Index
http://ideavim.sourceforge.net/vim/index.html
" Open quickfix window at bottom of screen with full-width
" :autocmd FileType qf wincmd J
botright cwindow
" Change Leader to <Space>
nnoremap <SPACE> <Nop>
let mapleader=" "
" QuickFix Window Enhancements
" p to Open Preview Window
autocmd FileType qf nnoremap <silent><buffer> p :PreviewQuickfix<cr>
" P to Close Preview Window
autocmd FileType qf nnoremap <silent><buffer> P :PreviewClose<cr>
" Automatically close the preview window when quickfix closes
" autocmd BufDelete <buffer> if &buftype == 'quickfix' | :pc! | endif " Never Worked
" autocmd FileType qf autocmd BufDelete <buffer> echom "Hey" " Console Log Example
autocmd FileType qf autocmd BufDelete <buffer> :pc!
" Undo / Redo
noremap U <C-r>
" Easy Buffer Delete
nnoremap <Leader>q :Bdelete!<CR>
nnoremap <Leader>Q :bufdo :Bdelete<CR>
" Hybrid Line Numbering
" https://jeffkreeftmeijer.com/vim-number/
:set number relativenumber
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
:augroup END
" Yank to system clipboard
map <Leader>y "+y
" Cursor Cues
set showmatch " Show matching brackets when text indicator on top of one
set cursorline " Show highlight on current line
" Status Bar / Title Bar
set ruler " Show current position
set title " Show the filename
set showcmd " Show commands when entered
" Hybrid Line Numbering
" https://jeffkreeftmeijer.com/vim-number/
:set number relativenumber
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
:augroup END
" Buffer Auto-Save / Read Options
set autoread " Automatically re-read the file when it changes on the filesystem and does not change in the buffer
" Tabbing and Shifting
set expandtab " Insert spaces when TAB is pressed.
set tabstop=4 " Render TABs using this many spaces.
set shiftwidth=2 " Indentation amount for < and > commands.
vnoremap < <gv
vnoremap > >gv
noremap <F3> :Autoformat<CR>
" Visual Mode Selection Searches
" See http://vim.wikia.com/wiki/Search_for_visually_selected_text
vnoremap // y/\V<C-R>"<CR>
"vnoremap // y/\V<C-r>=escape(@",'/\')<CR><CR>
vnoremap /? y/\V<C-R>"<CR>
" SEARCH: Formatting
"set magic " Set magic on, for regexps
set hlsearch " Highlight search pattern matches
" SEARCH: Matching Behavior
set incsearch " Make search look within strings
set ignorecase " Required for smartcase to work
set smartcase " Do case-sensitive search when target includes capitals
" SEARCH: Goto next and prev centers the screen
nnoremap n nzz
nnoremap N Nzz
" SEARCH: Shortcut for global search and replace
nnoremap <C-/> :%s/
" Register Rotation
:nnoremap <Leader>s :let @a=@" \| let @"=@+ \| let @+=@a<CR>
" Syntax Highlighting
syntax enable " enable syntax color schemes without overwriting existing highlighting rules
" QuickFix Window Enhancements
" p to Open Preview Window
autocmd FileType qf nnoremap <silent><buffer> p :PreviewQuickfix<cr>
" P to Close Preview Window
autocmd FileType qf nnoremap <silent><buffer> P :PreviewClose<cr>
" Automatically close the preview window when quickfix closes
" autocmd BufDelete <buffer> if &buftype == 'quickfix' | :pc! | endif " Never Worked
" autocmd FileType qf autocmd BufDelete <buffer> echom "Hey" " Console Log Example
autocmd FileType qf autocmd BufDelete <buffer> :pc!
" SORT A COMMA-SEPARATED LIST
:xnoremap µ '<,'>s/\%V.*\%V\@!/\=join(sort(split(submatch(0), '\s*,\s*')), ', ')