" Find more examples here: https://jb.gg/share-ideavimrc
let mapleader = " "

" Default Settings
"set scrolloff=5
set rnu
set number
set incsearch
set wrap

" Plugins
set ideajoin

Plug 'tpope/vim-commentary'

Plug 'tpope/vim-surround'

Plug 'preservim/nerdtree'
nmap <leader>tr :NERDTreeFocus<cr>

Plug 'easymotion/vim-easymotion'
let g:EasyMotion_do_mapping = 0
set easymotion
nmap gw <Plug>(easymotion-bd-w)

" Keymaps
nmap <leader>bd :bd<cr>
nmap { :bp<cr>
nmap } :bn<cr>
nmap <leader>w <c-w>
nmap <leader>fs :w<cr>

" Move lines in visual mode
vmap J :m '>+1<CR>gv=gv
vmap K :m '>-2<CR>gv=gv

" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
nmap <leader>if :<Action>(ReformatCode)<cr>
nmap <leader>ib :<Action>(ToggleLineBreakpoint)<cr>
nmap <leader>ir :<Action>(IdeaVim.ReloadVimRc.reload)<cr>
nmap <leader><leader> :<Action>(SearchEverywhere)<cr>
nmap <leader>it :<Action>(ActivateTerminalToolWindow)<cr>
nmap <leader>/ :<Action>(FindInPath)<cr>
nmap gy :<Action>(GotoTypeDeclaration)<cr>
nmap <leader>rn :<Action>(RenameElement)<cr>

" Harpoon Binds
nmap <c-e> <Action>(ShowHarpoon)<cr>
nmap <leader>a :<Action>(AddToHarpoon)<cr>
nmap <c-g> :<Action>(GotoHarpoon1)<cr>
nmap <c-h> :<Action>(GotoHarpoon2)<cr>
nmap <c-b> :<Action>(GotoHarpoon3)<cr>
nmap <c-n> :<Action>(GotoHarpoon4)<cr>
nmap <c-m> :<Action>(GotoHarpoon5)<cr>
nmap <c-t> :<Action>(GotoHarpoon6)<cr>
nmap <c-y> :<Action>(GotoHarpoon7)<cr>
nmap <c-,> :<Action>(GotoHarpoon8)<cr>

" Curisve Binds
map <leader>d <Action>(Debug)

map <leader>er <Action>(:cursive.repl.actions/run-top-sexp)
map <leader>ef <Action>(:cursive.repl.actions/load-file)
vmap <leader>E <Action>(:cursive.repl.actions/run-last-sexp)

map <leader>rn <Action>(RenameElement)

nmap W <Action>(:cursive.actions.paredit/forward)
nmap B <Action>(:cursive.actions.paredit/backward)
nmap ( <Action>(:cursive.actions.paredit/backward-up)
nmap ) <Action>(:cursive.actions.paredit/forward-up)
nmap >) <Action>(:cursive.actions.paredit/slurp-forwards)
nmap <) <Action>(:cursive.actions.paredit/barf-forwards)
nmap <( <Action>(:cursive.actions.paredit/slurp-backwards)
nmap >( <Action>(:cursive.actions.paredit/barf-backwards)
nmap >e <Action>(:cursive.actions.paredit/move-form-down)
nmap <e <Action>(:cursive.actions.paredit/move-form-up)
