Jump to next instance of the word that is on the cursor
press *
Go back to the last position before jumping around using gg or G
press ''
Search for current selected text in visual mode
- y
- q /
- p
- Enter
Open URL
- gx
replace word with yanked word
- in visual mode, select the word that should be replaced, press p to paste in-place.
- The problem is, you cannot repeat this operation by
.. The paste buffer is overwritten by the replaced word. So it pastes the replaced word, not the original word you copied from somewhere else. - any better solution?
https://vi.stackexchange.com/questions/3328/how-to-replace-a-word-with-a-yanked-word-in-normal-mode
Plugins: surround
ysiw: add surrounding symbol. ‘yank surround’ is weird since it’s not yanking anything, and the command’s rather long, so I remappedystosds: delete surrounding symbolcs: change surrounding symbol
Coding
Go to pair brackets () []
- %
Indentation
>>and<<, can be remapped to<Tab>and<S-Tab>=is smart indent, but not very useful for bracket-less language like python
Plugin: mini.comment
gc: toggle comment
Plugin: wrapping
yow, toggle softwrap and hardwrap
Rather useless keys that should be remapped
,and;: repeat f, t movement - I can first jump back more before using the f, t movement, also,nandNmovements through searching are more directs: delete current word and go to insert mode - similar torandc. Should be remapped for surround pluginm: bookmark the position - too hard to use, search and''are simpler
Markdown
za: fold toggle, remmaped to z1z=: fix the spelling of the current word, remapped to,
Plugin: Smart yank
- share copied content between vim and system keyboards, does this automatically when the intent is clear.
Plugin: vim-exchange
tips on paste
- when the yanked content contains newline at the end, when you paste the content, vim will not paste at the cursor, instead, vim pastes the content at the line below the cursor. If you want to paste inline, don’t use
DDto yank the line, used$instead.