set rnu
set surround
set iskeyword+=$
set vb
set ignorecase smartcase

" Moving blocks of text in visual mode
vnoremap < <gv
vnoremap > >gv

" Select all text
map <Space>a ggVG

" reload
nnoremap <Space>vs :source ~/.ideavimrc<CR>

" Copy until the end of the line
noremap Y y$

" clipboard
noremap <space>y "*y
noremap <space>Y "*Y
noremap <space>p "*p
noremap <space>P "*P

" refactoring
nnoremap <space>rf :action RenameFile<cr>
nnoremap <space>rr :action RenameElement<cr>
nnoremap <space>ll :action ReformatCode<cr>

" actions
nnoremap ;;        :action CommentByLineComment<cr>
nnoremap <space>b  :action ToggleLineBreakpoint<cr>
nnoremap <space>oi :action OptimizeImports<CR>

nnoremap ee :action SearchEverywhere<cr>
nnoremap \\\\ :action SearchEverywhere<cr>
nnoremap <tab> :action Switcher<cr>

" gotos
nnoremap gi :action GotoImplementation<cr>
nnoremap gs :action GotoSuperMethod<cr>
nnoremap gu :action ShowUsages<cr>

" unimpaired mappings
nnoremap [<space> O<esc>j
nnoremap ]<space> o<esc>k
nnoremap q[ :action PreviousOccurence<cr>
nnoremap q] :action NextOccurence<cr>
nnoremap m[ :action MethodUp<cr>
nnoremap m] :action MethodDown<cr>
nnoremap c[ :action VcsShowPrevChangeMarker<cr>
nnoremap c] :action VcsShowNextChangeMarker<cr>

" blank lines
nnoremap <space>j :set paste<CR>m`o<Esc>``:set nopaste<CR>
nnoremap <space>k :set paste<CR>m`O<Esc>``:set nopaste<CR>
nnoremap space<down> <space>j
nnoremap space<up> <space>k