2019-08-09 02:55:12 +00:00
|
|
|
### Remove trailing spaces
|
|
|
|
|
|
|
|
`:%s/\s\+$//e`
|
2019-08-09 02:58:57 +00:00
|
|
|
|
|
|
|
### Create a password-protected file using vim:
|
|
|
|
|
|
|
|
`vim -x ostechnix.txt`
|
|
|
|
|
|
|
|
### To remove the password, open the file using vim:
|
|
|
|
|
|
|
|
`vim ostechnix.txt`
|
|
|
|
|
|
|
|
And type:
|
|
|
|
|
|
|
|
`:set key=`
|
|
|
|
|
|
|
|
Finally type `:wq` to save and close the file.
|
2019-10-13 11:24:09 +00:00
|
|
|
|
|
|
|
### Indent the whole file in VIM ([src](https://stackoverflow.com/questions/506075/how-do-i-fix-the-indentation-of-an-entire-file-in-vi))
|
|
|
|
|
|
|
|
`gg=G`
|
2020-07-13 16:32:05 +00:00
|
|
|
|
|
|
|
### Text selection ([Source](https://www.cs.swarthmore.edu/oldhelp/vim/selection.html))
|
|
|
|
```
|
|
|
|
V - selects entire lines
|
|
|
|
v - selects range of text
|
|
|
|
ctrl-v - selects columns
|
|
|
|
gv - reselect block
|
|
|
|
```
|