Created
March 26, 2025 04:25
-
-
Save azdanov/6ed97a7057a7619d3556dc5f3001b795 to your computer and use it in GitHub Desktop.
IdeaVim configuration based on AstroNvim mappings
This file contains hidden or 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
" .ideavimrc configuration based on AstroNvim mappings | |
" Enable IdeaVim plugins | |
set ideajoin | |
set highlightedyank | |
set surround | |
set nerdtree | |
set which-key | |
set matchit | |
set commentary | |
" Set leader keys | |
let mapleader=" " | |
let maplocalleader="," | |
" Basic mappings | |
set timeoutlen=5000 | |
set notimeout | |
" make the popup appear much slower | |
let g:WhichKey_DefaultDelay = 400 | |
" set if the sorting should be case-sensitive or not | |
let g:WhichKey_SortCaseSensitive = "false" | |
" close the popup and don't process formerly typed keys | |
let g:WhichKey_ProcessUnknownMappings = "false" | |
" set if the Vim actions should be shown | |
let g:WhichKey_ShowVimActions = "false" | |
set undolevels=10000 | |
" Enable relative line numbers | |
set number | |
set relativenumber | |
" Search settings | |
set ignorecase | |
set smartcase | |
set incsearch | |
set hlsearch | |
" Quality of life settings | |
set clipboard+=unnamed | |
set clipboard+=ideaput | |
set scrolloff=0 | |
set showmode | |
set showcmd | |
set shiftround | |
set idearefactormode=keep | |
set ideavimsupport+=dialog | |
set ideaenabledbufs+=singleline | |
" Neovim mappings | |
" https://neovim.io/doc/user/vim_diff.html#_default-mappings | |
nnoremap Y y$ | |
inoremap <C-U> <C-G>u<C-U> | |
inoremap <C-W> <C-G>u<C-W> | |
" Q isn't exactly the same. | |
nnoremap Q @@ | |
" Neovim settings that differ from Vim | |
" https://neovim.io/doc/user/diff.html | |
" https://github.com/mikeslattery/nvim-defaults.vim/blob/main/plugin/.vimrc | |
set backspace=indent,eol,start | |
set formatoptions=tcqj | |
set listchars=tab:>\ ,trail:-,nbsp:+ | |
set shortmess=filnxtToOF | |
" Workaround for unifying navigation history: | |
" https://youtrack.jetbrains.com/issue/VIM-44/Unify-navigation-history-between-ideavim-and-idea" | |
nmap <C-o> <Action>(Back) | |
nmap <C-i> <Action>(Forward) | |
" Basic operations | |
nnoremap <C-s> :w!<CR> | |
nnoremap <Leader>w :action SaveDocument<CR> | |
nnoremap <Leader>w :w<CR> | |
nnoremap <C-q> :q!<CR> | |
nnoremap <Leader>n :new<CR> | |
nnoremap <Leader>c :q<CR> | |
" File explorer | |
nnoremap <Leader>e :NERDTreeToggle<CR> | |
nnoremap <Leader>o :NERDTreeFocus<CR> | |
" Splits | |
nmap <leader><Bar> <action>(SplitVertically) | |
nmap <leader>- <action>(SplitHorizontally) | |
nmap <C-h> <C-w>h | |
nmap <C-j> <C-w>j | |
nmap <C-k> <C-w>k | |
nmap <C-l> <C-w>l | |
nmap <C-Down> <action>(StretchSplitToBottom) | |
nmap <C-Left> <action>(StretchSplitToLeft) | |
nmap <C-Right> <action>(StretchSplitToRight) | |
nmap <C-Up> <action>(StretchSplitToTop) | |
" Move Lines | |
nmap <A-j> <Action>(MoveLineDown) | |
imap <A-j> <Esc><Action>(MoveLineDown)i | |
nmap <A-k> <Action>(MoveLineUp) | |
imap <A-k> <Esc><Action>(MoveLineUp)i | |
" Buffers | |
nmap [b <Action>(PreviousTab) | |
nmap ]b <Action>(NextTab) | |
nnoremap <Leader>fb <C-^> | |
nmap <Leader>c <Action>(CloseContent) | |
nmap <Leader>bC <Action>(CloseContent) | |
nmap <Leader>bc <Action>(CloseAllEditorsButActive) | |
" Escape and Clear hlsearch | |
nmap <esc> :nohlsearch<CR> | |
nmap <Leader>ur :nohlsearch<CR> | |
" Keywordprg | |
nmap <Leader>K <Action>(ShowHoverInfo) | |
" Comments | |
nmap <Leader>/ <Action>(CommentByLineComment) | |
vmap <Leader>/ <Action>(CommentByLineComment) | |
" New File | |
nmap <Leader>n Action(NewElementSamePlace) | |
" Quickfix | |
nmap <Leader>xq <Action>(ActivateProblemsViewToolWindow) | |
nmap [q <Action>(GotoPreviousError) | |
nmap ]q <Action>(GotoNextError) | |
" Format | |
nmap <Leader>lf <Action>(Format) | |
vmap <Leader>lf <Action>(Format) | |
" Diagnostics | |
nmap <Leader>ld <Action>(ShowErrorDescription) | |
nmap <Leader>lD <Action>(ActivateProblemsViewToolWindow) | |
nmap ]d <Action>(GotoNextError) | |
nmap [d <Action>(GotoPreviousError) | |
nmap ]e <Action>(GotoNextError) | |
nmap [e <Action>(GotoPreviousError) | |
nmap ]w <Action>(GotoNextError) | |
nmap [w <Action>(GotoPreviousError) | |
" Spelling | |
nmap <Leader>us :setlocal spell!<CR> | |
" Wrap | |
nmap <Leader>uw :setlocal wrap!<CR> | |
" Toggle Relative Number | |
nmap <Leader>uL :set relativenumber!<CR> | |
" Toggle Line Numbers | |
nmap <Leader>ul :set number!<CR> | |
" Toggle Background | |
nmap <Leader>ub <Action>(QuickChangeScheme) | |
" Git | |
nmap <Leader>gg <Action>(ActivateCommitToolWindow) | |
nmap <Leader>gb <Action>(Annotate) | |
nmap <Leader>gB <Action>(Vcs.Show.Log) | |
nmap <Leader>gf <Action>(Vcs.ShowTabbedFileHistory) | |
nmap <Leader>gl <Action>(Vcs.Show.Log) | |
" Quit All | |
nmap <Leader>qQ <Action>(Exit) | |
" Inspect Pos | |
nmap <Leader>ui <Action>(ActivateStructureToolWindow) | |
" Terminal | |
nmap <Leader>ft <Action>(ActivateTerminalToolWindow) | |
nmap <C-'> <Action>(ActivateTerminalToolWindow) | |
" Split | |
nmap \ <c-w>s | |
nmap | <c-w>v | |
" Delete Window | |
nmap <Leader>q <Action>(CloseContent) | |
" Tabs are treated as saved layouts | |
" Tabs | |
nmap ]t <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout) | |
nmap [t <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout) | |
" LSP Keymaps | |
nmap gd <Action>(GotoDeclaration) | |
nmap gr <Action>(FindUsages) | |
nmap <Leader>lR <Action>(FindUsages) | |
nmap gI <Action>(GotoImplementation) | |
nmap gy <Action>(GotoTypeDeclaration) | |
nmap gD <Action>(GotoDeclaration) | |
nmap gK <Action>(ShowHoverInfo) | |
nmap <Leader>lh <Action>(ParameterInfo) | |
nmap <Leader>r <Action>(RefactoringMenu) | |
vmap <Leader>r <Action>(RefactoringMenu) | |
nmap <Leader>lr <Action>(RenameElement) | |
nmap <Leader>la <Action>(ShowIntentionActions) | |
vmap <Leader>la <Action>(ShowIntentionActions) | |
" Bufferline | |
nmap <Leader>bl <Action>(CloseAllToTheLeft) | |
nmap <Leader>br <Action>(CloseAllToTheRight) | |
" Notifications | |
nmap <Leader>uD <Action>(ClearAllNotifications) | |
" Telescope Keymaps | |
nmap <Leader>ff <Action>(GotoFile) | |
nmap <Leader>fw <Action>(FindInPath) | |
nmap <Leader>fC :history<cr> | |
nmap <Leader>fb <Action>(Switcher) | |
nmap <Leader>gc <Action>(Vcs.Show.Log) | |
nmap <Leader>fr :registers<cr> | |
nmap <Leader>lD <Action>(ActivateProblemsViewToolWindow) | |
nmap <Leader>fh <Action>(HelpTopics) | |
nmap <Leader>fk :map<cr> | |
nmap <Leader>fm <Action>(ShowDocumentation) | |
nmap <Leader>fs <Action>(GotoSymbol) | |
nmap <Leader>fc <Action>(FindWordAtCaret) | |
nmap <Leader>ft <Action>(QuickChangeScheme) | |
" DAP Keymaps | |
nmap <Leader>da <Action>(ChooseRunConfiguration) | |
nmap <Leader>db <Action>(ToggleLineBreakpoint) | |
nmap <Leader>dB <Action>(AddConditionalBreakpoint) | |
nmap <Leader>dc <Action>(Resume) | |
nmap <Leader>dC <Action>(ForceRunToCursor) | |
nmap <Leader>di <Action>(StepInto) | |
nmap <Leader>dj <Action>(GotoNextError) | |
nmap <Leader>dk <Action>(GotoPreviousError) | |
nmap <Leader>dl <Action>(Debug) | |
nmap <Leader>do <Action>(StepOut) | |
nmap <Leader>dO <Action>(StepOver) | |
nmap <Leader>dp <Action>(Pause) | |
nmap <Leader>dr <Action>(JShell.Console) | |
nmap <Leader>dt <Action>(Stop) | |
" DAP UI Keymaps | |
nmap <Leader>de <Action>(EvaluateExpression) | |
vmap <Leader>de <Action>(EvaluateExpression) | |
nmap <Leader>du <Action>(ActivateDebugToolWindow) | |
" Neotest Keymaps | |
nmap <Leader>tl <Action>(Run) | |
nmap <Leader>tr <Action>(RunClass) | |
nmap <Leader>ts <Action>(ShowTestSummary) | |
nmap <Leader>tS <Action>(Stop) | |
nmap <Leader>tt <Action>(RunClass) | |
nmap <Leader>tT <Action>(RunAllTests) | |
nmap <Leader>tw <Action>(ToggleTestWatch) | |
nmap <Leader>td <Action>(ChooseDebugConfiguration) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment