how to copy by specifying line numbers in vi

yank those lines in register: :364,757yEnter if you want to copy those lines and paste to some certain line, t is your friend. for example: :364,757t2Enter will copy those lines to under 2nd line. if you want to copy them to right under your current line: :364,757t.Enter

How to setup Vi Editing Mode for zsh

bindkey -v is enough to enable vi mode in ZSH. If you are worried the setting will be overwritten by another plugin, put the setting at the bottom of your ~/.zshrc. After vi mode is enabled, you enter the “insert” mode by default. To enter “normal” mode, use Esc. And i or a to switch … Read more

Omit ‘Pattern not found’ error message in Vim script

You can either use :silent or :silent! as a prefix to any command or you can add the ‘e’ option to the substitute, which is often easier. :%s/x/y/ge :silent! %s/x/y/g :silent %s/x/y/g For more information, see :help :silent :help :s_flags The information on the e flag is a few paragraphs down from the :s_flags help.

Vi/Vim restore opened files

You can map using :mksession and :source to a set of keys for easy saving and restoring. Here’s an example from my .vimrc that uses F2 and F3: map <F2> :mksession! ~/vim_session <cr> ” Quick write session with F2 map <F3> :source ~/vim_session <cr> ” And load session with F3

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)