Skip to content

Instantly share code, notes, and snippets.

@deidine
Last active April 6, 2024 09:16
Show Gist options
  • Save deidine/73f983351f7b2c08c42c9c52c86c719a to your computer and use it in GitHub Desktop.
Save deidine/73f983351f7b2c08c42c9c52c86c719a to your computer and use it in GitHub Desktop.
this file for vim commeands
#my own reaserch
1) 0 and ^ go to the beginning of the line.
2) $ goes to the end of the line.
3) 0 goes to the beginning of a word, w goes to the next word, e goes to the end of the word.
4) d$ deletes the entire line; cc and dd for deleting lines; x for cutting one character.
dw deletes a single word; 3d deletes 3 lines.
5) f "the char you want" goes to a specific character in the line. If you want to go to another character, use ; for forward and , for backward.
5-1) F "the char you want" goes back to a specific character in the line.
6) t "the char you want" goes to a specific character in the line.
6-1) T "the char you want" goes back to a specific character in the line.
7) b for moving back in the word.
8) e for moving forward in the word; and w does the same.
9) d + f "the char you want" will delete all the characters until the last one.
10) y + f "the char you want" will copy all the characters until the last one.
11) p for paste.
12) v + f "the char you want" will select all the characters until the last one.
12-1) V + y to copy. If you paste it, it will create a new line in visual line mode.
13) v + e will select forward every time e is pressed.
14) h moves back one character.
15) l moves forward one character.
16) a and A and o and O and L and i and s and I for insert mode. A insert begin line I insert end of line o insert mode and new line likw enter O the same but abofe the line
17) j for moving up, k for moving down; 5k goes 5 lines up.
18) u for undo; Ctrl + r for redo.
19) / "search word" + n goes to the next pattern, + N goes back to the previous pattern.
20) R for replacing a string.
21) J for deleting spaces and letting all code be on one line.
22) :w for svaing file without quit
23) :%!fmt // Format the entire file using fmt
#others
1) 0 and ^: Go to the beginning of the line.
2) $: Go to the end of the line.
3) w: Move to the beginning of the next word.
4) e: Move to the end of the current word.
5) b: Move back to the beginning of the current word.
6) ( and ): Move back or forward to the beginning of the previous or next sentence.
7) { and }: Move back or forward to the beginning of the previous or next paragraph.
8) gg: Go to the first line of the document.
9) G: Go to the last line of the document.
10) <number>G: Go to a specific line number.
11) H, M, L: Move to the top, middle, or bottom of the screen respectively.
12) fx: Find the next occurrence of the character 'x' on the current line.
13) tx: Move to one character before the next occurrence of the character 'x' on the current line.
14) F and T: Similar to f and t, but in the opposite direction.
15) Ctrl + f: Move forward one full screen.
16) Ctrl + b: Move backward one full screen.
17) Ctrl + d: Move forward (down) half a screen.
18) Ctrl + u: Move backward (up) half a screen.
19) *: Search forward for the word under the cursor.
20) #: Search backward for the word under the cursor.
21) %: Jump to the matching parenthesis, brace, or bracket.
22) :n: Move to the next file in the argument list.
23) :N: Move to the previous file in the argument list.
24) zz: Center the current line in the middle of the screen.
25) zt: Move the current line to the top of the screen.
26) zb: Move the current line to the bottom of the screen.
27) zz: Center the current line on the screen.
28) zt: Move the current line to the top of the screen.
29) zb: Move the current line to the bottom of the screen.
30) .: Repeat the last change.
31) u: Undo the last change.
32) Ctrl + r: Redo the last undone change.
33) :q: Quit Vim.
34) :w: Save the current file.
35) :wq or :x: Save and quit.
36) :q!: Quit without saving.
37) :e filename: Open a new file named filename.
38) :sp filename: Split the window and edit a new file named filename.
39) :vsp filename: Split the window vertically and edit a new file named filename.
40) :set number: Show line numbers.
41) :set nonumber: Hide line numbers.
{
"java.debug.settings.onBuildFailureProceed": true,
"vim.insertModeKeyBindings": [
{
"before": ["j", "j"],
"after": ["<esc>"]
}
,
{
"vim.leader": " ",
"vim.hlsearch": true,
"vim.useSystemClipboard": true,
"vim.smartRelativeLine": true,
}
],
"vim.useCtrlKeys": true,
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["u"],
"commands": ["undo"]
},
{
"before": ["<C-r>"],
"commands": ["redo"]
},
{
"before": ["<"],
"commands" : ["tab"]
},
{
"before": [">"],
"commands" : ["outdent"]
},
{
"before": ["<leader>", "n"],
"commands": ["workbench.action.toggleSidebarVisibility"]
},
{
"before": ["K"],
"commands": ["editor.action.showHover"]
},
]}
normal mode
visial insert command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment