From 81fcd18ee96133072bbab7c7bf3b619183805245 Mon Sep 17 00:00:00 2001 From: Hizenberg469 Date: Sat, 23 Aug 2025 19:49:04 +0300 Subject: [PATCH] Text object, macro and Visual mode done --- .searching.txt.swo => .visual.txt.swp | Bin 12288 -> 12288 bytes "\\" | 796 ++++++++++++++++++++++++++ macros.txt | 62 +- searching.txt | 2 +- textobjects.txt | 6 +- vim-commands | 292 ++++++++++ 6 files changed, 1121 insertions(+), 37 deletions(-) rename .searching.txt.swo => .visual.txt.swp (76%) create mode 100644 "\\" diff --git a/.searching.txt.swo b/.visual.txt.swp similarity index 76% rename from .searching.txt.swo rename to .visual.txt.swp index db7f0a0abced1765a77994f37a266908a55060e6..580df13a6ac2f7746fe1e5f2c551fc9b355037d0 100644 GIT binary patch literal 12288 zcmeI2O>7%Q6vwAXeD(t%^@JCwic$61`MNNL-3Iq6!I>iVGLGaN+>>N+8Z0DF^=R-MFo52aqZu&{+D#Z{B+| zZ|CpXSx27wWOZSQ9!pOWyq+QC>b@)P<=6I-=Tn6EO6kb`SFc&#oJ@OZEn0l0(+<+M zr$T2)rwLcJ_{55@&T(4@6IIbl=};?QFfW+sh#+JbWb<#895T9b83l|2+bgh}9Gaf$ z-Rk?tUZ>CPUE4n0M2!MQ0i%FXz$jo8FbWt2i~>f1|CIu|y@R}q89kEB>TL49W8gh$ znm40>QNSo*6fg=H1&jhl0i%FXz$jo8FbWt2{(}lI{7`@8Q9|}Sj*G|d|6Bk6|M)Z^ zH^3$E9;kv>!7JeQ9zuQq-+`~e7vMASG58Q%0vEwK@Fq9~j)EhAf<55(-GuxCz6UqK zC*T91!P}q)${+_)U@!P>7a>1^Z@>-kDYy=u*>)_ zvSu1JRfA?*+!r>BJv7JKLNgCq1e%P>wX)h{QZwrmSN^(SqZ2F4^O(zmfOBi!!%0AA zo8-LeaNo*vk8LoYj~?_i^L0b{j+IkV;-sOl!)>lL&t)`hPN6(=)aYT$%=TG}ORcON z^8_l$?WR@~T6^5e`b{PS7K|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R=6e;;?nBI=FO|C+v{h>Gv&vjbm(>9W~%4D>!n$}QeDIUnKU4iuFGe=1*os`=($)lEJ z>7dxcmXmVR70SrM*@>A;LbbB9mAXk32( z@$b@<ea>no6xmEXW%(ijibb#!#7w z>&h5JXRZuO&+&j&n_kXqZAi|YEy;8I<~4beEQ>W2GO??R;nC|0LC(nca;Epmj*NzB ze8`OU2V-_@0X;j7@(}E-jyMAiZ0-VKrpZ0*V1?V{y@pV9Zi(`V_d0C`?dZhCh&jQin3_HlS5;>q*6PYoM4l^Kz|Gd{s?wom zi7Q5fCCIqBk*=UE*yv97%5VDUq1Su1o130%9DCLQuG6Bo%x-<51?rM;R=NLDV-k-i*7pdTd}9Abe~h76`NvF5r88%tLKGm=QhmJ^lJ zu2jv6ETMVI8cOXWR~u4K4lE2CGI37Dnhh!7M`6?)ZlgMJNg?1X1KESC$O{L*&Qh!) zoG&cRmFF_&pyjHkas>;xclo&7!2}CtF}3&n#wv32j6JfAe@j6`y%0*17>i)t9i h=k`N>P2Pti{)0@)RTJC_F23A@4NeIJF$64#zW^FugV6v0 diff --git "a/\\" "b/\\" new file mode 100644 index 0000000..bc49807 --- /dev/null +++ "b/\\" @@ -0,0 +1,796 @@ +Normal mode commands: + +-> for navigating the file opened in vim: + + h: to go left. + l: to go right. + j: to go down. + k: to go up. + + ctrl + f: To do page down. Similar to page down button. + ctrl + b: To do page up. Similar to page up button. + z + : To bring the focus of vision to the top + where the cursor is currently present. + z + z: To bring the focus of vision to the center + where the cursor is currently present. + w: To move the cursor by one word on the file. It include the + punctuation as a word.(move one word forward) + W: To move the cursor by one word on file. It don't include the + punctuation as a word.(move one word forward) + b: To move the cursor by one word on file. It include the + punctuation as a word.(move on word backward) + B: To move the cursor by one word on file. It don't include the + punctuation as a word.(move on word backward) + + 0: To move the first column of the current line the cursor + is present. + ^: To move the first letter of the first word of the current + line the cursor is present. + $: To move the last letter of the last word of the current + line the cursor is present. + gg: To move the first column of the first line of the file. + G: To move to the last line of the file. + gg or G: To move the particular + as mentioned. + ctrl + g: To know the current line we are on, the file name, + the percentage of we have covered according to + current cursor position. + + g + (ctrl+g): To get more detailed information of whatever + the previous was showing. + +-> Deleting text from file in normal mode: + + x: To delete the right side byte of the current cursor position. + X: To delete the left side byte of the current cursor position. + + Using d to delete words with motion operation: + + {motion} + for ex: + dw (this delete the what the w command would move + the cursor by) + + dw: To delete a word in front of the current cursor position. + + dl: To delete next byte towards right from current cursor position on + current line. + dh: To delete next byte towards left from current cursor position on + current line. + dj: To delete whole current line and the line below. + dk: To delete whole current line and the line above. + d$: To delete from current position of cursor to the end of + the line. + d0: To delete from current position to the first letter of the + current line the cursor is present. + D: Equivalent of of what d$ + dd: To delete the current line entirely no matter where the cursor + is present currently on that same line. + + dd: To delete the 3 lines below from current line where + the cursor is present. + + + Note: is telling in short hand on how many + times the delete-command given should be executed. Same as the + command shown above (dd). + + dw: delete-word command to be executed numbers of times. + + For ex: + 3w = Repeat word motion 3 times. + + d3w = Delete the 3w motion. + + 2d3w = Delete the 3w motion 2 times. + +Line mode: + +-> for navigating using line mode: + + : : To go to the particular . + :$ : To move to the last line in the file. + + !(exclamation mark): This Operator can be used to force the commands + + for ex: + + :q! is used to force quit the vim even if the changes on files + are not saved. + +-> help command (for vim documentation): + + :help : It will open vim documentation. + + :help [command] : It will open documentation to a specific location where + the specification for that specific command is present. + + :help {subject} : It will open documentation to a specific location where + the specification for the given subject. + + :h : It is a short cut for :help in line mode. + + (CTRL+w) + (CTRL+w): It is used to switch b/w windows currently open in vim + for editing. + + (CTRL+o): Take you to the location where the previous search is done in the + document. + + (CTRL+i): Take you to the location where the next search is done in the + document. + + (CTRL+]): Place the cursor on the "subject" you want to search (for ex. linewise) + and press this command. + + Note: Anything between [] in help documentation means it is optional in vim. + + + For autocompleting a command which is to be searched in help documentation + click CTRL+D, which shows suggestation. To iterate through all the suggestion + without writing it explicity use key. To iterate in reverse order use + +. + + +-> Cut, Copy and Paste: + + * d and x cut text, not just delete it. + * cut = delete and save into a register. + * Register is a clipboard-like storage location. + * This register is also known as default register or unnamed register. + + > for pasting the text present in the default register use p command. + > if the line is cut using dd command then using 'p' will paste it below the current line where + the cursor is present. + > if 'P' command is used then it will paste above the current line where the cursor is + present. + > if a character is cut using 'x' or 'X' command using 'p' will paste the character + just after the current postion of the cursor. + > similarly, if 'P' command is used it will paste the character just before the current + position of the cursor. + + Note: + > The data cutted is linewise then it will paste below/above current line. + > The data cutted is characterwise then it will paste before or after the current line. + + > Standard - Vim terminology: + + Cut = Delete + Copy = yank + paste = put + + > for yanking(copying) use 'y' command. + > Just like 'd' command behavior with 'p' command is same. + + * Undo command: + + > To undo the action of previous command, use 'u' command to + undo the action. + > To redo the same command undone by undo 'u' command use 'CTRL+r' + command. + + * Type of registers: + + > Named registers : "a to "z + > Number register : "0 to "9 + > unnamed register : "" + + > unnamed register contains the data with acquired from one of the + commmands d, x, c, y and s. + c -> , s -> substitute. + + > "0 : Most recently yanked data + > "1 : The data which is deleted recently. + > "2 : The data which was deleted second last time. + > "3 : and so on till "9.... + + > use :reg to see the content of each register. + > use :reg + wherer arg -> register name to show the content + + arg can be string containing all the + registers named concatenated into a + single string. + +-> Transforming and Substituting: + + + * Inserting: + + @ Command :- Shift + i or CAPS + i (Capital i) + + What does it do? + + It put the mode in insert mode and put the cursor in + the first character of the first word of the current + line where the cursor is present. + + @ Command :- Shift + a or CAPS + a (Capital a) + + What does it do? + + It put the mode in insert mode and put the cursor after + the last character of the last word of the current + line where the cursor is present. + + @ Command :- o + + What does it do? + + It puts the mode in insert mode and put the cursor below + the line where the current cursor is present. + + @ Command :- Shift + o + + What does it do? + + It puts the mode in insert mode and put the cursor above + the line where the current cursor is present. + + * Replacing (Replace Mode): + + @ Command :- Shift + r or CAPS + r (Capital r) + + What does it do? + + It pust the mode in replace mode. In replace mode, wherever + the cursor is present, it will start to replace each character + as we type and the previous character will be over-written by the + new character. + + * Changing (Changing Mode): + + @ Command :- + c + + + What does it do? + + It delete the series of bytes, based on the word-motion given, + and put the mode in INSERT mode. can be any + type of word motion that we have learnt. Here, + can be used to put the deleted or "replaced" word into the register + which we use to store as intended. + + For example: + + "a + c + w + + It will store the word into register "a which is replaced by using + command c + w. + + @ Command :- Shift + c or CAPS + c (capital + c) + + What does it do? + + Replace the sequence of characters from current cursor position is present at till end + of the line. + + @ Command :- cc + + Replace the entire current line where the cursor is present. + + @ Command :- ~ + + What does it do? + + Switch over the case of the character where the current is present. + + @ Command :- g + ~ + + + What does it do? + + Switch over the cases of the each character based on the motion command + range. + + @ Command :- g + U + + + What does it do? + + Changes the entire case of each character to upper-case based on the motion command + range. + + @ Command :- g + u + + + What does it do? + + Changes the entire case of each character to lower-case based on the + motion comand range. + + -> Joining: + + @ Command :- Shift + j or CAPS + j (Capital + j) + + What does it do? + + Joins the line below the current line where the cursor is present + to single line and add a space to it or add a double space if there + is a period at the end of the current line. + + @ Command :- g + J + + + What does it do? + + Do the same thing as "J" command. Only difference is that it doesn't + add any space between joining lines. + + +-> Searching commands: + + + @ Command :- f + + + What does it do? + + Searches for the next occurence of the character passed as an argument + from current cursor position on the same line. + NOTE THE WORD, SAME LINE. + + @ Command :- F + + + What does it do? + + Do the same thing as previous command, but in opposite direction. + + @ Command :- ; + + What does it do? + + It repeat the command from the above two, whichever was executed + first. For example, if F + is executed, it will repeat + the same command. + + @ Command :- , + + What does it do? + + It do the opposite of what ";" command does. For example, if + F + is executed, it will execute f + + action, repeatedly. It will do the opposite of whichever + above mentioned command was executed first. + + @ Command :- t + + + + What does it do? + + It search for the and place the cursor just one + position before the current cursor. Note that, using the same + command again will not move the cursor to next position w.r.t + same that was mentioned earlier. + + We can use ";" and "," command to repeat the mentioned command + even if the cursor is present just before the searched , + it pass through the current position. + + Note that the searching is done from left to right. + + @ Command :- T + + + What does it do? + + It perform operation and behave in similar manner as done by t + + command. But, the searching is done in reverse order. + + **Note** + + All these are motion-commands. That means, we can use it with Editing + commands like d (delete), c (changing), y (yanking), etc. + + + @ Command :- / + + What does it do? + + It searches for the . + + Using "n" command will search for next occurance in current + opened file. + + Using "N" command does the same thing. But, in opposite direction. + + **Note** + + For "/" command for searching the incsearch option should be set. + + If it is not, we can use following line command: + + :set is + + To check if the configuration is set use command: + + :set is? + + For highlighting the searches, check for: + + Check :set hls? + + Output: nohlsearch + + Do: :set hls + + Note that hlsearch is enabled will highlight the s' until + new search is done which in turn highlight the new . + To turn off the highlight, use: + + :nohls. + + It will turn-off the highlights not disable it permanently. + + + %% Trick %% + + > Using "/" command to find a string or string containing the pattern specified + and pressing enter will take to the first such matching string. + + > If we now use "c + w" command the cursor which is present at the first letter + of the word will delete that word and we type certain word. + + > After getting out of the insert mode, pressing "n" command will move the cursor + the cursor to the next string and pressing the command "." will repeat the changes + that we did for first string i.e. repeat the process that we performed above. + + + @ Command: "? + + + What does it do? + + It search for the string matching the pattern in reverse direction of the current + cursor postion. + + Here, "n" search for next pattern match in reverse direction. "N" does the reverse + of what "n" command does. + + + @ Command: "*" + + What does it do? + + It search for the next occurances of the exact string(not string-pattern) which is near or where + the current cursor is positioned. + + + @ Commmand: "#" + + What does it do? + + It seah for the next occurances of the exact string(not string-pattern) which is near or where + the current cursor is positioned. + + %% TIPS %% + + We can use editing commands like deleting(d), yanking(y), etc. with these searching command. + + For ex: + + Pressing "d" command and then using "/" will leads to deleting of characters + from the current cursor position to the next occurance of the . + + Pressing " with "y" command and then using "/" will leads to + yanking(copying) from the current cursor position to the next occurance of the . + + + @ Command : [range]s///[flag] (Its a line command) + ^ ^ + | | + optional optional + + + What does it do? + + It replace the occurance of old string to new string over the range + in the file. + + [flag] + + * g : It represent to replace all the occurance of to in + current line where the cursor is present. + + + [range] + + Define the range of this command. Could be single line, multiple line + and even all the lines in the file, etc. + + * : On which line number this command to be executed. + To execute the command on same line as cursor, + don't mention . + + * , : From the starting line number + to the ending line number to + to execute the command. + + For ex: + :1s///g + + It will replace with in the entire line of line number 1. + + :1,5s///g + + It will do the same form line number 1 to 5. + + ://,//s///g + + It will do the same from line which has pattern matching with + with and ending with line which has pattern + matching with pattern . + + + ------------------------------------ + + + $ = last line; . = current line + + :.,$s///g + + % = All the line (entire file) + + :%s///g + + ----------------------------------- + + + For including character such as "/" for and + we can use "\" which is a escape character. + + For ex: + + :s/\/\//\/\// + + OR + + we can use other non-alphanumeric character as a separator. + + For ex: + + :s#//#// + + %% TIPS %% + + To set options in VIM, we can use :set