Skip to content

Instantly share code, notes, and snippets.

@kjm0001
Forked from johnnymillergh/.ideavimrc
Created October 3, 2022 11:11
Show Gist options
  • Save kjm0001/c4bce69bda7f72ca93a93b3c4a79357e to your computer and use it in GitHub Desktop.
Save kjm0001/c4bce69bda7f72ca93a93b3c4a79357e to your computer and use it in GitHub Desktop.
Vim
"" Source your .vimrc
"source ~/.vimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching.
set incsearch
" Don't use Ex mode, use Q for formatting.
map Q gq
" Join next line of text with current line with shift + j.
set ideajoin
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r <Action>(ReformatCode)
"" Map <leader>d to start debug
"map <leader>d <Action>(Debug)
"" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)
" Find more examples here: https://jb.gg/share-ideavimrc
" Shortcuts handler for conflicts between JetBrains and Vim
sethandler <C-;> a:vim
sethandler <C-S-;> a:vim
sethandler <C-A> a:vim
sethandler <C-C> a:ide
sethandler <C-D> a:ide
sethandler <C-E> a:ide
sethandler <C-F> a:ide
sethandler <C-H> a:vim
sethandler <C-K> a:ide
sethandler <C-L> a:vim
sethandler <C-R> a:ide
sethandler <C-S> a:vim
sethandler <C-T> a:ide
sethandler <C-U> a:vim
sethandler <C-V> a:ide
sethandler <C-W> a:vim
sethandler <C-X> a:ide
sethandler <C-Y> a:ide
" Activate the plugin: Which-Key
set which-key
set timeoutlen=2500
" Activate plugin: IdeaVimMulticursor
" set multicursor
" map q <Plug>(multicursor-ms/)
" map z <Plug>(multicursor-mcv)
" map Z <Plug>(multicursor-mcr)
" Activate plugin: IdeaVim-EasyMotion
set easymotion

Vim Cheatsheet

Johnny Miller, Sun Oct 2 13:58:53 CST 2022

Vim (/vɪm/; a contraction of Vi IMproved) is a free and open-source, screen-based text editor program. It is an improved clone of Bill Joy's vi.

📖 References

Table of Contents

[TOC]

🧭 Navigation

Keystroke(s) Description Note
h j k l Arrow keys (⬅️ ⬇️ ⬆️ ➡️)
b / w Previous/next word
ge / e Previous/next end of word
0 (zero) Start of line
^ Start of line (after whitespace)
$ End of line
gg First line
G Last line
:n Go to line n
nG Go to line n
zz Center this line in editor window
zt Top this line in editor window
zb Bottom this line
H Move to top of screen
M Move to middle of screen
L Move to bottom of screen
/pattern Search for pattern
?pattern Search backward for pattern
n Next matching search pattern
N Previous match
gd Go to definition JetBrains

📝 Editing

Keystroke(s) Description Note
a Append
A Append from end of line
i Insert
o / O Next line Add blank line below/above current line
J Join next line of text with current line JetBrains plugin: ideajoin
s Delete char and insert
S Delete line and insert
C Delete until end of line and insert
cc Delete whole line and insert
dd Delete line (Cut) The deleted texts will be copied in Vim’s clipboard
ciw Change (replace) entire word. (Delete current word that pointed by cursor)
u Undo changes
<C-R> Redo changes <C-R> = ctrl + r
Esc / <C-[> Exit insert mode <C-[> = ctrl + [
<C-C> Exit insert mode (corrupt), and abort current command <C-C> = ctrl + c

📋 Clipboard

Keystroke(s) Description Note
x Delete character (Cut) The deleted character will be copied in Vim’s clipboard
dd Delete line (Cut) Copy in Vim’s clipboard
yy Yank line (Copy) Copy in Vim’s clipboard
p Paste from Vim’s clipboard
P Paste before from Vim’s clipboard
"*p / "+p Paste from system clipboard
"*y / "+y Paste to system clipboard

👀 Mode Switching

Keystroke(s) Description Note
v Enter visual mode
V Enter visual line mode
<C-V> Enter visual block mode
a Enter insert node and append text after where cursor is
i Enter insert node and insert text before where cursor is
Esc / <C-[> Exit insert mode <C-[> = ctrl + [
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment