vim¶
Howto¶
Remove trailing whitespace¶
-
On current line:
-
On all lines in the file:
(The 'e' flag prevents error messages if no trailing spaces are found) -
On selected lines:
- First, visually select the lines (V)
- Then apply the substitution to the selection:
Disable modelines (security risk)¶
Add to ~/.vimrc
" [security](https://www.techrepublic.com/article/turn-off-modeline-support-in-vim/)
set modelines=0
set nomodeline
Make VIM default editor¶
dnf install -y --allowerasing vim-default-editor
Delete all comments¶
:g/^#/d
Delete all blank lines¶
:g/^$/d
redhat / centos vi sucks¶
# ~/.bashrc
alias vi=vim
Set default editor on ubuntu¶
sudo update-alternatives --config editor
See also¶
- http://vimcasts.org/
- Book Practical Vim, Second Edition Edit Text at the Speed of Thought by Drew Neil (pragprog.com)