DispersedNet
SiteMap
Unix Concepts
Shell Programming
Shell Scripting
Unix Questions
vi editing
«Prev
Unix Concepts
File Management
List Files Command
Copy Directories Command
Removing Directories Quickly
Unix About Links
Creating File Link
Find Command Search
File Management Conclusion
Unix Customization
Creating Aliases Unix
list current Aliases
Displaying Previous Commands
Repeating Previous Commands
Modifying Previous Command
Changing System Prompt
Storing shell Settings
Customize-environment
Grep Regular Expression
Define Regex
Using Quotes with Regex
Matching Pattern Occurrences
Matching Pattern Position
Turnoff Character Meaning
Regex Conclusion
Pattern Matching - Quiz
editing with vi
vi Review
Text in vi
Creating Text
Creating Command Shortcuts
Configure Editing Environment
Storing Custom Settings
Esditing Multiple Files
Pasting Text Files
vi Editing Conclusion
Managing Disk Space
Keyboard macros
In a file named text, there are two lines where you want to transpose words.
The dw command deletes the word upon, and the cursor ends up on the o in the word once.
The w command moves the cursor one word forward. The cursor is now on the word a.
The P command puts the deleted word, upon, before the cursor location. This trial runs show that the command sequence dwwP will transpose two words.
Use the :map command, you can assign the sequence dwwP to the letter V. Now typing V in command mode is the same as typing dwwP.
Here, the cursor is move to another line where you want to transpose words. The cursor is on the u of upon.
This time, you can simply press the V key to switch the two words, upon and once.