Skip to content
Archive of posts filed under the Vim Tips category.

Know when you will type :q in your term instead of vi(m), the alias will chewed you out.

most simple solution is to alias :q like so: alias :q=`echo \”This is not vim\”` but as someone suggested in commandlinefu, you can use tput to put some color and fun into this. alias :q=\’tput setaf 1; echo >&2 \”this is NOT vi(m) :/\”; tput sgr0\’ Sphere: Related Content Technorati Tags: Alias, bash, vi, vim

Add current date and time in vim

Last few days I was quite busy. So this time very quick tip Add the following to the ~/.vimrc file imap dt :r! dateA And now whenever you type dt in the insert mode in vi, date will be inserted. Sphere: Related Content Technorati Tags: Linux, Vim Tips

stop indentation on current file in vim to keep the indentation from copied text.

I have been looking for this for quite some time. Finally found two easy ways to do it: :setlocal noautoindent :setlocal nocindent :setlocal nosmartindent :setlocal indentexpr= Just use the above four commands when the file is already open to stop all the indentation/smart indentation/auto indentation in vim for the current file. If you want to [...]