2022-06-25 11:40:05 +02:00
|
|
|
---
|
|
|
|
title: Vim
|
2022-11-19 15:25:20 +01:00
|
|
|
visible: true
|
2022-06-25 11:40:05 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
[toc]
|
|
|
|
## Get output from command
|
|
|
|
`:r!(command)`
|
|
|
|
|
|
|
|
*Example to get UUID for a disk*
|
|
|
|
`:r!blkid /dev/(partition) -sUUID -ovalue`
|
|
|
|
|
|
|
|
## Write as sudo user
|
|
|
|
`:w !sudo tee %`
|
|
|
|
|
|
|
|
## Replace strings
|
|
|
|
Globally replace strings
|
|
|
|
`:%s/foo/bar/g`
|
|
|
|
|
|
|
|
Replace strings in line 6 to 10
|
2022-11-19 15:25:20 +01:00
|
|
|
`:6,10s/foo/bar/g`
|