Vim

scp/ssh edit

vim scp://foouser@barserver//etc/hosts

Remove Multi-Line HTML Tags

%s/<aside\_.\{-}<\/aside>//gi

Write Changes as Root (sudo Required)

:w !sudo tee %

Add 23 to the Number in Column 42

%s/\%42\d\+/\=submatch(0) + 23

Use Vimdiff to Compare Remote Files

vimdiff scp://host1//etc/passwd scp://host2//etc/passwd

Change Tab/Space Behaviour

Display unprintable characters :set list Use spaces instead of tabs :set expandtab Length of an Tab :set tabstop=4 Number of spaces used for (auto)indent. :set shiftwidth=4 Apply settings to existing text :retab

Set Current Direcory to the one of the File Currently Open

:cd %:p:h

Resources

  • unix/vim.txt
  • Last modified: 2019-05-02T10:45:29+0200
  • by Wolfgang