How does the vim “write with sudo” trick work?

In :w !sudo tee %… % means “the current file” As eugene y pointed out, % does indeed mean “the current file name”, which is passed to tee so that it knows which file to overwrite. (In substitution commands, it’s slightly different; as :help :% shows, it’s equal to 1,$ (the entire file) (thanks to … Read more

How do I make git use the editor of my choice for editing commit messages?

Setting the default editor for Git Pick one: Set core.editor in your Git config: git config –global core.editor “vim” Set the GIT_EDITOR environment variable: export GIT_EDITOR=vim Setting the default editor for all programs Set the standardized VISUAL and EDITOR environment variables*: export VISUAL=vim export EDITOR=”$VISUAL” NOTE: Setting both is not necessarily needed, but some programs … Read more

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