Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Last active December 20, 2022 21:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickcernis/bcb5cb7f55c07ed3de8287d163ed7c28 to your computer and use it in GitHub Desktop.
Save nickcernis/bcb5cb7f55c07ed3de8287d163ed7c28 to your computer and use it in GitHub Desktop.
IntelliJ vimrc [wip]
""" Map leader to space ---------------------
let mapleader=" "
""" Plugins --------------------------------
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
set highlightedyank
set NERDTree
set textobj-indent
""" Plugin settings -------------------------
let g:highlightedyank_highlight_color = "rgba(52, 181, 179, 255)"
let g:highlightedyank_highlight_duration = "100"
let g:argtextobj_pairs="[:],(:),<:>"
""" Common settings -------------------------
set showmode
set scrolloff=0
set incsearch
set number
"set relativenumber
set timeoutlen=650 " So keyboard multimappings work.
set visualbell " Not currently functional but maybe one day?
"set noerrorbells " Prevents bells when pressing escape in normal mode etc.
set clipboard+=unnamed " Use system clipboard.
""" Idea specific settings ------------------
set ideajoin " Smarter joining.
"set ideastatusicon=gray
"set idearefactormode=keep
"set dialogescape=off " Disable vim in dialogs. Undocumented. May be renamed.
"set nooneline " Disable vim in one-line editors. Undocumented. May be renamed.
set ideavimsupport= " Disable in other buffers like commit messages
""" Mappings --------------------------------
"set g:EasyMotion_do_mapping=0
"nmap s <Plug>(easymotion-s)
nnoremap <leader>dd :NERDTree<CR>
nnoremap <leader>dx :NERDTreeClose<CR>
" Window movement.
nnoremap <leader>wv :vsplit<CR>
nnoremap <leader>ws :split<CR>
nnoremap <leader>wd <C-W>c
nnoremap <leader>wx <C-W>c
nnoremap <leader>ww <C-W>w
nnoremap <leader>wl <C-W>l
nnoremap <leader>wh <C-W>h
nnoremap <leader>wk <C-W>k
nnoremap <leader>wj <C-W>j
nnoremap <leader>wo <C-W>o
" Buffer switching and removal.
nnoremap <leader><leader> :action RecentFiles<CR>
nnoremap <leader>bb :action RecentFiles<CR>
nnoremap <leader>s :action RecentFiles<CR>
nnoremap <leader>bd :tabclose<CR>
nnoremap <leader>bl :action NextTab<CR>
nnoremap <leader>bn :action NextTab<CR>
nnoremap <leader><TAB> :action NextTab<CR>
nnoremap <leader>` :action PreviousTab<CR>
nnoremap <leader>bh :action PreviousTab<CR>
nnoremap <leader>bp :action PreviousTab<CR>
nnoremap <leader>bo :action CloseAllEditorsButActive<CR>
" Previous Tab
nnoremap <leader>bj :action PreviousTab<CR>
vnoremap <leader>bj <Esc>:action PreviousTab<CR>
" Open recent projects.
nnoremap <leader>po :action ManageRecentProjects<CR>
vnoremap <leader>po <Esc>:action ManageRecentProjects<CR>
nnoremap <leader>pc :action CloseProject<CR>
nnoremap <leader>pd :action CloseProject<CR>
"nnoremap <leader>gg :action Git.Menu<CR>
nnoremap <leader>gg :action Vcs.QuickListPopupAction<CR>
nnoremap <leader>gc :action Git.Commit<CR>
nnoremap <leader>gl :action Git.Pull<CR>
nnoremap <leader>gf :action Git.Fetch<CR>
nnoremap <leader>gp :action Vcs.Push<CR>
nnoremap <leader>gb :action Git.Branches<CR>
nnoremap <leader>gh :action Vcs.ShowTabbedFileHistory<CR>
nnoremap <leader>gr :action Github.View.Pull.Request<CR>
nnoremap <leader>gi :action Vcs.QuickListPopupAction<CR>
nnoremap <leader>ga :action Annotate<CR>
nnoremap <leader>go :action ShowAnnotateOperationsPopupGroup<CR>
" nnoremap <leader>gd :action GoToDeclaration<CR>
" nnoremap gl :action RecentLocations<CR>
" nnoremap gn :action Forward<CR>
" nnoremap gf :action Forward<CR>
" nnoremap gp :action Back<CR>
" nnoremap gb :action Back<CR>
" nnoremap gh :action QuickJavaDoc<CR>
"TODO nnoremap gh :action show docs at cursor position (hints)
" TODO: step through and stage changes individually? maybe JumpToNextChange?
" TODO: explore macros: https://stackoverflow.com/a/33179362
" TODO: some nice ideas here: https://www.reddit.com/r/vim/comments/38d9ts/ideas_for_using_the_leader_key_feature/
" Terminal commands
nnoremap <leader>tt :action ActivateTerminalToolWindow<CR>
" Run commands
nnoremap <leader>ra :action RunAnything<CR>
" Find and replace
nnoremap <leader>ff :action Find<CR>
nnoremap <leader>rr :action Replace<CR>
" New files and folders
nnoremap <leader>fn :action ShowNavBar<CR>
"FileChooser.NewFolder
" Case-insensitive search unless a capital letter is used. (/Apple will not
" match APPLE or apple, but /apple matches all variants.)
set ignorecase
set smartcase
" Refactor commands
nnoremap <leader>rt :action Refactorings.QuickListPopupAction<CR>
" Shortcuts for this config file.
nnoremap <leader>ce :edit ~/.ideavimrc<CR>
nnoremap <leader>cs :source ~/.ideavimrc<CR>
" map <leader>c :action Stop<CR>
" map <leader>z :action ToggleDistractionFreeMode<CR>
"
" map <leader>s :action SelectInProjectView<CR>
" map <leader>a :action Annotate<CR>
" map <leader>h :action Vcs.ShowTabbedFileHistory<CR>
" map <S-Space> :action GotoNextError<CR>
"
" map <leader>b :action ToggleLineBreakpoint<CR>
" map <leader>o :action FileStructurePopup<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment