# copy the line
yy
# paste the copied or cut line
p
# change word
cw
# cut the line
dd
# cuts a user-defined number of rows
${number of rows} + dd
# cut all rows from where you are to the end of the file
d + Shift + G
# will delete all rows from where you are to the beginning of the file
d + g
# will delete from the current line to the end of file
d + G
Examples:
:sort
Examples:
:set nu
- :[%s] substitute /pattern_to_find/pattern_to_substitute/
Examples:
:%s/http:/https:/
:%s/https:\/\/www/https:\/\/test-liferay/gc
:%s/10\.1\.1\.67/10\.1\.102\.43
- The regex is 'blank line' and the command is :d (delete)
- https://vim.fandom.com/wiki/Remove_unwanted_empty_lines
- https://vim.fandom.com/wiki/Power_of_g#Examples
Examples:
:g/^$/d
- https://stackoverflow.com/questions/811193/how-to-convert-the-m-linebreak-to-normal-linebreak-in-a-file-opened-in-vim
Example:
### Note - :e ++ff=dos followed by :set ff=unix will convert the endings to a sane format.
:e ++ff=dos
https://stackoverflow.com/questions/253380/how-to-insert-text-at-beginning-of-a-multi-line-selection-in-vi-vim
Example:
%s!^!<Value><\![CDATA[
- https://stackoverflow.com/questions/11303032/how-to-add-text-at-the-end-of-each-line-in-vim/11305004
Example:
:%s/$/]]><\/Value>/