" Basic settings
set ideajoin
" Enables IntelliJ IDEA-like joining lines.
set surround
" Enables surround plugin functionality.
set multiple-cursors
" Enables multiple cursor functionality.
set incsearch
" Enables incremental search, highlighting matches as you type.
" Leader key configuration
let mapleader = " "
" Sets the spacebar as the leader key.
" Surround plugin mappings for visual mode
vmap s S
" Maps 's' to the 'S' command in visual mode for surround actions.
" System clipboard integration mappings
" These mappings allow you to yank to and paste from the system clipboard.
vmap <leader>y
"+y " Yank selection to the system clipboard in visual mode.
vmap <leader>d
"+d " Delete selection to the system clipboard in visual mode.
nmap <leader>y
"+yy " Yank current line to the system clipboard in normal mode.
nmap <leader>p
"+p " Paste from the system clipboard below the cursor in normal mode.
nmap <leader>P
"+P " Paste from the system clipboard above the cursor in normal mode.
vmap <leader>p
"+p " Paste from the system clipboard in visual mode, replacing the selection.
vmap <leader>P
"+P " Paste from the system clipboard before the selection in visual mode.
" Action mappings
" These mappings trigger various IntelliJ IDEA actions from normal mode.
nmap <leader>q <action>(CloseEditor)
" Close the current editor tab.
nmap <leader>i <action>(Generate)
" Open the 'Generate' menu (e.g., to generate code).
nmap <leader>m <action>(Git.Menu)
" Open the 'VCS' menu for Git actions.
nmap <leader>s <action>(QuickChangeScheme)
" Change the color scheme quickly.
nmap <leader>/ <action>(ShowErrorDescription)
" Show the description of the current error.
nmap <leader>e <action>(GotoNextError)
" Go to the next error in the file.
nnoremap <leader><leader> <C-Tab>
" Map double leader press to switch between tabs.
nnoremap <c-\> :action MoveTabRight<CR>
" Move the current tab to the right.
nnoremap <c-m> :action MoveEditorToOppositeTabGroup<CR>
" Move editor to the opposite group.
nnoremap <c--> :action SplitHorizontally<CR>
" Split the window horizontally.
" Handler settings
" These settings define which mode (IDEA or Vim) handles specific Ctrl-key combinations.
sethandler <c-g> a:ide
" IDEA handles Ctrl-G
sethandler <c-w> a:vim
" Vim handles Ctrl-W
" ... (similarly for other Ctrl-key combinations)
" Vim window navigation mappings
nnoremap <c-h> <c-w>h
" Move to the window to the left.
nnoremap <c-l> <c-w>l
" Move to the window to the right.
nnoremap <c-j> <c-w>j
" Move to the window below.
nnoremap <c-k> <c-w>k
" Move to the window above.
" Tab navigation mappings
nnoremap <TAB> :action PreviousTab<CR>
" Go to the previous tab.
nnoremap <s-TAB> :action NextTab<CR>
" Go to the next tab.
nnoremap <leader>t :action ActivateTerminalToolWindow<CR>
" Open or focus on the terminal window.
" Multi-cursor mappings
map mc <A-n>
" Start multi-cursor from the current cursor position with Alt-N.
map mx <A-x>
" Remove a cursor or cancel multi-cursor mode with Alt-X.
map mp <A-p>
" Skip the next occurrence with Alt-P.
" Running and debugging mappings
nnoremap ,r :action Rerun<CR>
" Rerun the last run configuration.
nnoremap ,c :action RunClass<CR>
" Run the current class.
nnoremap ,b :action ToggleLineBreakpoint<CR>
" Toggle a breakpoint on the current line.
nnoremap ,d :action ContextDebug<CR>
" Start debugging in the current context.
" NERDTree settings
set NERDTree
" Enable NERDTree functionality.
let g:NERDTreeMapActivateNode='l'
" Press 'l' to open a directory or file in NERDTree.
let g:NERDTreeMapJumpParent='h'
" Press 'h' to move to the parent directory in NERDTree.