Created
September 6, 2022 21:17
-
-
Save subfuzion/1ce83c3496e17646dbfd46aa327a5970 to your computer and use it in GitHub Desktop.
My JetBrains vim configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sethandler <C-B> a:vim | |
sethandler <C-F> a:vim | |
sethandler <C-J> a:vim | |
sethandler <C-K> a:vim | |
sethandler <C-L> a:vim | |
sethandler <C-N> a:vim | |
sethandler <C-P> a:vim | |
sethandler <C-R> a:vim | |
sethandler <C-V> a:vim | |
sethandler <C-W> a:vim | |
sethandler <C-^> a:vim | |
"==================================================================== | |
" Leader key | |
"==================================================================== | |
" Remap the leader key. | |
" let g:mapleader = "\<space>" | |
let g:mapleader = ";" | |
"==================================================================== | |
" Sane editor settings | |
"==================================================================== | |
set novisualbell | |
set noerrorbells | |
"==================================================================== | |
" Behavior | |
"==================================================================== | |
" Shorten from default 2 seconds. | |
set timeoutlen=1000 | |
" Use jj to esc in insert mode. | |
inoremap jj <esc> | |
" Highlight matches when searching. | |
" Use <esc><esc> to clear. | |
set hlsearch | |
" Redraw screan and clear search highlighted items. | |
" http://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting#answer-25569434 | |
" nnoremap <silent> <c-L> :nohlsearch<cr><c-L> | |
nnoremap <silent> <esc><esc> :nohlsearch<cr><c-L> | |
" Forward and back. | |
nnoremap J <c-f> | |
nnoremap K <c-b> | |
" H and L move the cursor to top and bottom of the screen, but | |
" the following scrolls the buffer contents so that the line under | |
" the cursor is shifted to the top, middle, or bottom. | |
nnoremap T zt | |
nnoremap M zz | |
nnoremap B zb | |
"==================================================================== | |
" Buffers | |
"==================================================================== | |
" Go to next buffer. | |
nnoremap <silent> <leader>n :bn<cr> | |
inoremap <silent> <leader>n <esc>:bn<cr> | |
" Go to previous buffer. | |
nnoremap <silent> <leader>p :bp<cr> | |
inoremap <silent> <leader>p <esc>:bp<cr> | |
" Toggle buffer (switch between current and last buffer). | |
nnoremap <silent> <leader>bb <C-^> | |
" Close buffer. | |
nnoremap <silent> <leader>d :bd<cr> | |
inoremap <silent> <leader>d <esc>:bd<cr> | |
" Kill buffer (ignore edits). | |
nnoremap <silent> <leader>d! :bd!<cr> | |
inoremap <silent> <leader>d! <esc>:bk<cr> | |
" List buffers and select. | |
nnoremap <silent> <leader>bl :ls<cr>:buffer<space> | |
inoremap <silent> <leader>bl <esc>:ls<cr>:buffer<space> | |
" Select buffer. | |
" Press <tab> after <leader>b to execute right away. | |
nnoremap <silent> <leader>b :buffer<space> | |
" Go to buffer number | |
" =================== | |
" => enter #<enter> to go to buffer # quickly, where # is 1..9 | |
let c = 1 | |
while c <= 9 | |
execute "nnoremap " . c . " :b" . c ."<cr>" | |
let c += 1 | |
endwhile | |
" => enter <leader># to go to buffer #, where # is 1..9 | |
let c = 1 | |
while c <= 9 | |
execute "nnoremap <leader>" . c . " :b" . c ."<cr>" | |
let c += 1 | |
endwhile | |
" => enter #b to go to buffer #, where # is 1..99 | |
let c = 1 | |
while c <= 99 | |
execute "nnoremap " . c . "b :b" . c . "<cr>" | |
let c += 1 | |
endwhile | |
"==================================================================== | |
" Windows | |
"==================================================================== | |
" Close window. | |
nnoremap <silent> <leader>c :close<cr> | |
inoremap <silent> <leader>c <esc>:close<cr> | |
" Improved keyboard navigation. | |
nnoremap <leader>hh <c-w>h | |
nnoremap <leader>jj <c-w>j | |
nnoremap <leader>kk <c-w>k | |
nnoremap <leader>ll <c-w>l | |
inoremap <silent> <leader>hh <esc><c-w>h | |
inoremap <silent> <leader>jj <esc><cr><c-w>j | |
inoremap <silent> <leader>kk <esc><c-w>k | |
inoremap <silent> <leader>ll <esc><c-w>l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My personal vim configuration: .vimrc