set relativenumber
set number
set clipboard=unnamedplus
vnoremap p "_dp
vnoremap P "_dP
set ignorecase
set smartcase
set incsearch
set scrolloff=8

let mapleader=" "

"plugins
set quickscope
set which-key
set notimeout
set easymotion " install easymotion and acejump plugin
set surround

set multiple-cursors " https://github.com/JetBrains/ideavim/wiki/IdeaVim%20Plugins#multiple-cursors-extends-multicursor-support


nnoremap <leader>, :action IdeaVim.ReloadVimRc.reload<CR>

nnoremap <SPACE> <Nop>
nnoremap <leader>t :action Terminal.OpenInTerminal<CR>
nnoremap <leader>q :action QuickJavaDoc<CR>
nnoremap <leader>f :action Find<CR>
nnoremap <leader>r :action Replace<CR>
" broken in latest version of idea vim?
"map f <Plug>(easymotion-bd-f)
"map <leader>f <Plug>(easymotion-bd-w)

nnoremap J mzJ`z
nnoremap S ht lr<cr>k$

vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv

" --------------- multiple cursors ---------------
"map <leader>l V<Action>(ReformatCode)" Remap multiple-cursors shortcuts to match terryma/vim-multiple-cursors
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
nmap g<C-n> <Plug>NextOccurrence
xmap g<C-n> <Plug>NextOccurrence
xmap <C-x> <Plug>SkipOccurrence
xmap <C-p> <Plug>RemoveOccurrence

" Note that the default <A-n> and g<A-n> shortcuts don't work on Mac due to dead keys.
" <A-n> is used to enter accented text e.g. ñ
" Feel free to pick your own mappings that are not affected. I like to use <leader>
nmap <leader><C-n> <Plug>AllWholeOccurrences
xmap <leader><C-n> <Plug>AllWholeOccurrences
nmap <leader>g<C-n> <Plug>AllOccurrences
xmap <leader>g<C-n> <Plug>AllOccurrences
" --------------- end multiple cursors ---------------
