Hot answers tagged vim
You can append to a register instead of erasing it by using the upper-case letter instead of the lower-case one. For example: :1y a # copy line 1 into register a (erases it beforehand) :3y A # copy line 3 into register a (after its current content) 8G # go to line 8 "ap # print register a
sed does not understand \d. You can use [0-9] or, more generally, [[:digit:]] in its place: $ sed -r 's/.*(X[[:digit:]])(.*)45.*/\1\2/' test.txt X1yad X2fad X3had X4wad X5mad
One option may be to remove the "r" formatoption, with: :set formatoptions-=r and also possibly other options, all of which I found at: http://vi.stackexchange.com/questions/1983/how-can-i-get-vim-to-stop-putting-comments-in-front-of-new-lines
Go into paste mode: :set paste after pasting, you want to end paste mode: :set nopaste
A solution from the StackOverflow: :help 'viminfo' ... < Maximum number of lines saved for each register. ... :set viminfo? :set viminfo='100,<100,s10,h
T$c, Or if you want to create a text object: onoremap i$ :normal! T$v,<cr> vnoremap i$ <esc>T$v,
If you need to delete text with d without altering your yank register (say, you've already yanked text in it that you're not ready to paste before your delete some other text for instance), you can use the black hole register _. If you do "_dd for example, the current line will be immediately deleted and forgotten. Actually, I don't use this register very ...
If that is a static file, most likely your browser doesn't really retrieve the new file, you can check that by pressing Shift while clicking refresh (at least in Firefox). If that doesn't work, it is probably your webserver doesn't notice the change in that case reloading the webserver is normally enough. E.g for apache2 service apache2 reload or ...
sed 's/abcd\(X[0-9][a-z]ad\)45das/\1/g' your_file_name should do it.
You can use the :copy command, which can be abbreviated as :t: :1t8 :3t8 If you want to copy a range of lines (e.g. all lines from 1 to 3) you can do it like this: :1,3t8
Only top voted, non community-wiki answers of a minimum length are eligible