Below, I have listed examples of the many common commands and use cases for Vim, Sublime Text, and Tmux.
To open a file in vim, just type
vim <filename>
To save and exit files, you must be in command mode (click esc). You must type the :
before each of the lettered commands.
- :q exit editor
- :w save changes
- :wq save changes and exit editor
- :q! force quit editor without saving changes
- h move the cursor to the left
- l move it to the right
- k move up
- j move down
- or use the arrow keys
- **^** move the cursor to the begnning of the line - **$** move the cursor to the end of the line - **gg** move the cursor to the beginning of file - **G** move the cursor to the end of the file
- This will allow you to type and make changes just like you would in gedit or similar
- i insert mode
To exit editing mode, press
ESC
key.
- dd will delete current line
- n dd will delete n lines including and below current line
- dw will delete the word to the right of the cursor
- n dw will delete n words to the right of the cursor
- x will delete letter highlighted by the cursor
- :n go to the nth line in the file.
Ctrl+Shift+P
Ctrl+P
Ctrl+P @
Package control lets you install plugins for Sublime on the fly. You can install it by going to https://sublime.wbond.net/installation.
Ctrl+Shift+P "Package Control"
After selecting "Install Package," you type the name of the package you want to install, and click enter.
Multiple Cursors are incredibly useful. Naturally, they let you select multiple blocks of text and type at the same time.
There are two ways to get multiple cursors.
- Selecting text and hitting
Ctrl+D
- Selecting lines and hitting
Ctrl+Shift+L
# to open a new tmux session
tmux
# list all tmux sessions
tmux ls
# attach to a tmux session
tmux a -t <number> # tmux a -t 2
# enter tmux command mode
Control+B
# detach from tmux
Control+B, d
# rename pane
Control+B, :rename <name> # :rename testing
# vertical split panes
Control+B, %
# horizontal split panes
Control+B, “
# switch between panes
Control+B, <Left, Right, Up, or Down>
# new window
Control+B, c
# switch between windows
Control+B, n
Here is a great example of using multiple Tmux panes.