AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Vim yoink9/22/2023 ![]() ![]() GitHub - rkosai/rkosai-dotfiles: A few of the dotfiles that I want to. without needing to know the line numbers. GitHub - svermeulen/vim-yoink: Vim plugin that maintains a yank history to cycle. You can yank to named buffers, copy, delete lines, search&replace just portions of your code, etc. Typing '' moves you back to previous position (unfortuantely only remembers the previous position, not two back). vim-yoink Compare vim-cutlass vs vim-yoink and see what are their differences. In command mode you can move back to marks by simply typing 'a to move back to the line marked a. Shift lines of code, between mark a through mark b, one tab to the right (use opposite chevron, To copy mark a through mark b and paste below the current position (the 'dot' always references the line where the cursor currently is positioned): :'a,'bco. To search from mark a to mark b and replace 'ine' with 'ink': :'a,'bs/ine/ink/g To delete from mark a to mark b type: :'a,'bdel To yank from mark a to mark b type: :'a,'byank When in command mode move cursor to line 2, type ma. To return to a mark preface the named mark with a single quote ( 'a)These marks can be used as the range. It works like this: m is the 'mark' character then use any letter to identify/name the mark. In my defense, my help yank does not convey that ya is a possible alias of yank.Īs a long time Vi/Vim user I tend to use 'marks' instead of line numbers (or 'line markers'). This was incorrect and the "a" in ya is completely unnecessary. I previously confused ya in :91,95ya a to be somehow synonymous with ya where the motion was supplied by 91,95. Which means move the four lines positioned 10 lines ahead of current cursor, to below the current line. ![]() Moving blocks of text around, looks like this: :+10,+13m. I personally use letters reached by my left hand for yanks, and letters reached by my right hand for macros. Which is why, coincidentally, you can paste a macro, edit it, and then yank it back into it's register. ![]() Note: If you have a macro in buffer a it was just overwritten by the previous yank, as yank registers and macro registers are really the same thing. Would yank the 5 lines after the current cursor position into buffer a. Would yank the text from 5 lines above to current cursor position into named buffer a, and: :,+5y a it would yank( y) 21 lines around the current cursor position and put them in register b.Īn absence of input actually represents the current cursor position as well, which means that this: :-5,y a Using plus (+) or minus (-) references lines relative to the current cursor position: :-10,+10y b Capitalization of the register always works like this, e.g. the capitalization of the A register causes an appending operation into register a instead of an overwrite. In addition to :91,96y a which yanks ( y) lines 91 through 96 into register a, (pasted with "ap), the yanked lines can be appended to the register with: :91,96y A ![]()
0 Comments
Read More
Leave a Reply. |